Skip to content

Commit

Permalink
Fix H5Oexist test result after HDF5 bugfix (#1170)
Browse files Browse the repository at this point in the history
A bugfix in the HDF5 library changed the return value of the
H5Oexists(_by_name) API call. In earlier versions of the library,
when the ID was a file ID and the object doesn't exist, the call
would return FAIL (-1). The correct behavior is to return false (0).
This change will appear in the next released version of HDF5,
which is planned to be 2.0.0.

This change updates the object test to expect FAIL for 1.14.5 and
earlier and false for later versions.
  • Loading branch information
derobins authored Oct 24, 2024
1 parent fbcd95d commit 612cec7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/objects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ using HDF5.API
h5open(fn, "r") do h5f
@test API.h5o_exists_by_name(h5f, "data")
@test API.h5o_exists_by_name(h5f, "lore")
@test_throws API.H5Error API.h5o_exists_by_name(h5f, "noonian")
@static if HDF5.API.h5_get_libversion() <= v"1.14.5"
# Buggy behavior in earlier versions of HDF5 returns FAIL (-1)
@test_throws API.H5Error API.h5o_exists_by_name(h5f, "noonian")
else
# The correct behavior is to return false (0)
@test API.h5o_exists_by_name(h5f, "noonian") == 0
end

loc_id = API.h5o_open(h5f, "data", API.H5P_DEFAULT)
try
Expand Down

0 comments on commit 612cec7

Please sign in to comment.