From 0e4e1a173b5bc10e54a634243e86e9730c5fa546 Mon Sep 17 00:00:00 2001 From: Ian Date: Sat, 9 Oct 2021 23:08:09 -0400 Subject: [PATCH] fix test by relaxing it, with explanation --- stdlib/Profile/src/Profile.jl | 2 ++ stdlib/Profile/test/runtests.jl | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index f201158e40a37..3c608f358b694 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -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) diff --git a/stdlib/Profile/test/runtests.jl b/stdlib/Profile/test/runtests.jl index 23c731667b484..092372358e07f 100644 --- a/stdlib/Profile/test/runtests.jl +++ b/stdlib/Profile/test/runtests.jl @@ -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()