Skip to content

Give each HDF5RoundtripTest its own test file - #15

Open
mkitti wants to merge 1 commit into
load-library-init-orderfrom
unique-test-files
Open

mkitti wants to merge 1 commit into
load-library-init-orderfrom
unique-test-files

Conversation

@mkitti

@mkitti mkitti commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #14.

Problem

In a Windows run against a #1814 build of the HDF5 preset (run 37877788908), HDF5RoundtripTest.testMDShortArrayRankMismatchDetached failed with:

Expected exception of type class ch.systemsx.cisd.hdf5.exceptions.HDF5SpaceRankMismatch but got java.lang.AssertionError
	at ch.systemsx.cisd.hdf5.HDF5RoundtripTest.testMDShortArrayRankMismatchDetached(HDF5RoundtripTest.java:3444)

Line 3444 is assertFalse(shortArrayFile.exists()), right after shortArrayFile.delete(), so the test failed before it touched HDF5. The same code passed in two earlier Windows runs.

testMDShortArrayRankMismatch runs just before it and writes the same file, MDShortArrayRankMismatch.h5. On Windows a file can't be deleted while any process still holds it open. A virus scanner briefly opening the freshly written file is enough, and File.delete() then returns false without an error. No HDF5 handle was involved: the test's own getOpenHDF5FileCount() == 0 check, just before it, passed.

Fix

Eight pairs of tests in HDF5RoundtripTest shared a file name. The second test of each pair now gets its own:

Test Old file New file
testMDShortArrayRankMismatchDetached MDShortArrayRankMismatch.h5 MDShortArrayRankMismatchDetached.h5
testAccessClosedReaderWriter datasetsNonExtendable.h5 accessClosedReaderWriter.h5
testGetDataSetInformationFailed dsInfo.h5 dsInfoFailed.h5
testFixedLengthStringArray stringArray.h5 fixedLengthStringArray.h5
testWriteToEmptyFile testStrangeDataSetName.h5 writeToEmptyFile.h5
testTimeDurationMDArray timedurationarray.h5 timedurationmdarray.h5
testWriteByteArrayDataSetBlockWiseMismatch writeByteArrayBlockWise.h5 writeByteArrayBlockWiseMismatch.h5
testWriteOpaqueByteArrayDataSetBlockWiseMismatch writeOpaqueByteArrayBlockWise.h5 writeOpaqueByteArrayBlockWiseMismatch.h5

All 16 tests delete and recreate their file before using it, so none relied on another test's file. Every file name in the class is now used by exactly one test.

Verification

  • macOS arm64 (local), against the #1814 build: 348/348 pass.
  • Fork workflow against a #1814 build (run 37880021103): Windows 348 run, 0 failed, 5 skipped on both Java 21 and Java 8; Linux 348/348 on both; n5-hdf5 #50 against it 47 run, 0 failed, 5 skipped on both platforms.

🤖 Generated with Claude Code

Eight pairs of tests used the same file name, and TestNG runs some of
them back to back. On Windows a file can't be deleted while another
process (e.g. a virus scanner looking at the freshly written file) still
has it open, so the second test's delete() could fail silently and its
assertFalse(file.exists()) fail. testMDShortArrayRankMismatchDetached
failed this way on a Windows CI run. Every test now uses a file name no
other test uses; no test relied on another's file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant