Skip to content

Commit

Permalink
fix test by relaxing it, with explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Oct 10, 2021
1 parent 0f4f73b commit 0e4e1a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ for compatibility and by packages (e.g., FlameGraphs.jl) that would rather not d
details of the metadata format.
"""
function add_fake_meta(data; threadid = 1, taskid = 0xf0f0f0f0)
threadid == 0 && error("Fake threadid cannot be 0")
taskid == 0 && error("Fake taskid cannot be 0")
any(Base.Fix1(is_block_end, data), eachindex(data)) && error("input already has metadata")
cpu_clock_cycle = UInt64(99)
data_with_meta = similar(data, 0)
Expand Down
5 changes: 4 additions & 1 deletion stdlib/Profile/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ end
@test_throws "input already has metadata" Profile.add_fake_meta(data_with)
data_stripped = Profile.strip_meta(data_with_fake)
@test data_stripped == data_without
@test length(data_with_fake) == length(data_with)
# ideally the test below would be a test for equality, but real sample ips can be nulls, and thus
# adding metadata back in can convert those ips to new block ends, and the length is then longer
@test length(data_with_fake) >= length(data_with)

end

Profile.clear()
Expand Down

0 comments on commit 0e4e1a1

Please sign in to comment.