diff --git a/stdlib/Profile/Project.toml b/stdlib/Profile/Project.toml index 6aca0601439e3..1d13dad22233a 100644 --- a/stdlib/Profile/Project.toml +++ b/stdlib/Profile/Project.toml @@ -5,8 +5,9 @@ uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" [extras] -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "Serialization"] +test = ["Logging", "Serialization", "Test"] diff --git a/stdlib/Profile/test/runtests.jl b/stdlib/Profile/test/runtests.jl index cf0790e606615..777122e571aed 100644 --- a/stdlib/Profile/test/runtests.jl +++ b/stdlib/Profile/test/runtests.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using Test, Profile, Serialization +using Test, Profile, Serialization, Logging Profile.clear() Profile.init() @@ -60,11 +60,13 @@ let iobuf = IOBuffer() end @testset "Profile.print() groupby options" begin - for tasks in [typemin(UInt):typemax(UInt), UInt(0), UInt(0):UInt(1), [UInt(0), UInt(3)]] - for threads in [1:Threads.nthreads(), 1, 1:1, 1:2, [1,3]] - for groupby in [:none, :thread, :task, [:thread, :task], [:task, :thread]] - @testset "tasks = $tasks threads = $threads groupby = $groupby" begin - Profile.print(devnull; groupby, threads, tasks) + iobuf = IOBuffer() + with_logger(NullLogger()) do + @testset for format in [:flat, :tree] + @testset for threads in [1:Threads.nthreads(), 1, 1:1, 1:2, [1,2]] + @testset for groupby in [:none, :thread, :task, [:thread, :task], [:task, :thread]] + Profile.print(iobuf; groupby, threads, format) + @test !isempty(String(take!(iobuf))) end end end