Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run each failing test 1000x to see if we can reproduce consistently #1156

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions test/failing_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using HDF5, Test

@testset "h5a_iterate failing" begin
for i in 1:1000
filename = tempname()
f = h5open(filename, "w")

write_attribute(f, "a", 1)
write_attribute(f, "b", 2)

# iterate over attributes
names = String[]
@test HDF5.API.h5a_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
push!(names, unsafe_string(name))
return false
end == 2
@test names == ["a", "b"]

# iterate over attributes in reverse
names = String[]
@test HDF5.API.h5a_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_DEC
) do loc, name, info
push!(names, unsafe_string(name))
return false
end == 2
@test names == ["b", "a"]

# only iterate once
names = String[]
@test HDF5.API.h5a_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
push!(names, unsafe_string(name))
return true
end == 1
@test names == ["a"]

@test_throws AssertionError HDF5.API.h5a_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
@assert false
end

# HDF5 error
@test_throws HDF5.API.H5Error HDF5.API.h5a_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
return -1
end

close(f)
end
end

@testset "h5l_iterate failing" begin
for i in 1:1000
filename = tempname()
f = h5open(filename, "w")

create_group(f, "a")
create_group(f, "b")

# iterate over groups
names = String[]
@test HDF5.API.h5l_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
push!(names, unsafe_string(name))
return false
end == 2
@test names == ["a", "b"]

# iterate over attributes in reverse
names = String[]
@test HDF5.API.h5l_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_DEC
) do loc, name, info
push!(names, unsafe_string(name))
return false
end == 2
@test names == ["b", "a"]

# only iterate once
names = String[]
@test HDF5.API.h5l_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
push!(names, unsafe_string(name))
return true
end == 1
@test names == ["a"]

# HDF5 error
@test_throws HDF5.API.H5Error HDF5.API.h5l_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
return -1
end

# Julia error
@test_throws AssertionError HDF5.API.h5l_iterate(
f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC
) do loc, name, info
@assert false
end

close(f)
end
end
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ end
include("ros3.jl")
end

include("failing_tests.jl")

# Clean up after all resources
HDF5.API.h5_close()
end
Loading