Skip to content

Commit 52aff04

Browse files
fix tests
1 parent 3d23b69 commit 52aff04

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

stdlib/Profile/Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
55
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
66

77
[extras]
8-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
99
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
10+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1011

1112
[targets]
12-
test = ["Test", "Serialization"]
13+
test = ["Logging", "Serialization", "Test"]

stdlib/Profile/test/runtests.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
using Test, Profile, Serialization
3+
using Test, Profile, Serialization, Logging
44

55
Profile.clear()
66
Profile.init()
@@ -60,11 +60,13 @@ let iobuf = IOBuffer()
6060
end
6161

6262
@testset "Profile.print() groupby options" begin
63-
for tasks in [typemin(UInt):typemax(UInt), UInt(0), UInt(0):UInt(1), [UInt(0), UInt(3)]]
64-
for threads in [1:Threads.nthreads(), 1, 1:1, 1:2, [1,3]]
65-
for groupby in [:none, :thread, :task, [:thread, :task], [:task, :thread]]
66-
@testset "tasks = $tasks threads = $threads groupby = $groupby" begin
67-
Profile.print(devnull; groupby, threads, tasks)
63+
iobuf = IOBuffer()
64+
with_logger(NullLogger()) do
65+
@testset for format in [:flat, :tree]
66+
@testset for threads in [1:Threads.nthreads(), 1, 1:1, 1:2, [1,2]]
67+
@testset for groupby in [:none, :thread, :task, [:thread, :task], [:task, :thread]]
68+
Profile.print(iobuf; groupby, threads, format)
69+
@test !isempty(String(take!(iobuf)))
6870
end
6971
end
7072
end

0 commit comments

Comments
 (0)