Skip to content

Commit 78da0b5

Browse files
committed
Run linux perf integration test only on buildkite
1 parent 279ebd3 commit 78da0b5

File tree

6 files changed

+81
-51
lines changed

6 files changed

+81
-51
lines changed

.buildkite/pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
steps:
3-
- label: ":test_tube: Test the package"
3+
- label: "Julia 1 - Test LinuxPerf Integration"
44
plugins:
55
- JuliaCI/julia#v1:
66
version: "1"
7-
commands: |
8-
julia --version
7+
- JuliaCI/julia-test#v1:
98
agents:
109
queue: "juliaecosystem"
1110
os: "linux"
1211
arch: "x86_64"
12+
timeout_in_minutes: 15

.github/workflows/CI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
${{ runner.os }}-
5252
- uses: julia-actions/julia-buildpkg@v1
5353
- uses: julia-actions/julia-runtest@v1
54+
env:
55+
TEST_PERF_INTEGRATION: false
5456
- uses: julia-actions/julia-processcoverage@v1
5557
- uses: codecov/codecov-action@v3
5658
with:

test/ExecutionTests.jl

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module ExecutionTests
33
using BenchmarkTools
44
using Profile
55
using Test
6-
using LinuxPerf
76

87
seteq(a, b) = length(a) == length(b) == length(intersect(a, b))
98

@@ -383,34 +382,4 @@ b = x = nothing
383382
GC.gc()
384383
@test x_finalized
385384

386-
##################################
387-
# Linux Perf Integration #
388-
##################################
389-
390-
b = @benchmarkable sin($(Ref(42.0))[])
391-
results = run(b; seconds=1, enable_linux_perf=false)
392-
@test results.linux_perf_stats === nothing
393-
394-
b = @benchmarkable sin($(Ref(42.0))[])
395-
results = run(b; seconds=1)
396-
@test results.linux_perf_stats === nothing
397-
398-
b = @benchmarkable sin($(Ref(42.0))[])
399-
results = run(b; seconds=1, enable_linux_perf=true, evals=10^3)
400-
@test results.linux_perf_stats !== nothing
401-
@test any(results.linux_perf_stats.threads) do thread
402-
instructions = LinuxPerf.scaledcount(thread["instructions"])
403-
!isnan(instructions) && instructions > 10^4
404-
end
405-
406-
tune!(groups)
407-
results = run(groups; enable_linux_perf=true)
408-
for (name, group_results) in BenchmarkTools.leaves(results)
409-
@test group_results.linux_perf_stats !== nothing
410-
@test any(group_results.linux_perf_stats.threads) do thread
411-
instructions = LinuxPerf.scaledcount(thread["instructions"])
412-
!isnan(instructions) && instructions > 10^3
413-
end
414-
end
415-
416385
end # module

test/LinuxPerfIntegrationTests.jl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module LinuxPerfIntegrationTests
2+
3+
using BenchmarkTools
4+
using Test
5+
using LinuxPerf
6+
7+
### Serialization Test ###
8+
b = @benchmarkable sin(1) enable_linux_perf = true
9+
tune!(b)
10+
bb = run(b)
11+
12+
withtempdir() do
13+
tmp = joinpath(pwd(), "tmp.json")
14+
15+
BenchmarkTools.save(tmp, b.params, bb)
16+
@test isfile(tmp)
17+
18+
results = BenchmarkTools.load(tmp)
19+
@test results isa Vector{Any}
20+
@test length(results) == 2
21+
@test eq(results[1], b.params)
22+
@test eq(results[2], bb)
23+
end
24+
25+
##################################
26+
# Linux Perf Integration #
27+
##################################
28+
29+
b = @benchmarkable sin($(Ref(42.0))[])
30+
results = run(b; seconds=1, enable_linux_perf=false)
31+
@test results.linux_perf_stats === nothing
32+
33+
b = @benchmarkable sin($(Ref(42.0))[])
34+
results = run(b; seconds=1)
35+
@test results.linux_perf_stats === nothing
36+
37+
b = @benchmarkable sin($(Ref(42.0))[])
38+
results = run(b; seconds=1, enable_linux_perf=true, evals=10^3)
39+
@test results.linux_perf_stats !== nothing
40+
@test any(results.linux_perf_stats.threads) do thread
41+
instructions = LinuxPerf.scaledcount(thread["instructions"])
42+
!isnan(instructions) && instructions > 10^4
43+
end
44+
45+
tune!(groups)
46+
results = run(groups; enable_linux_perf=true)
47+
for (name, group_results) in BenchmarkTools.leaves(results)
48+
@test group_results.linux_perf_stats !== nothing
49+
@test any(group_results.linux_perf_stats.threads) do thread
50+
instructions = LinuxPerf.scaledcount(thread["instructions"])
51+
!isnan(instructions) && instructions > 10^3
52+
end
53+
end
54+
55+
end

test/SerializationTests.jl

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,21 @@ function withtempdir(f::Function)
3030
end
3131

3232
@testset "Successful (de)serialization" begin
33-
for enable_linux_perf in (false, true)
34-
b = @benchmarkable sin(1) enable_linux_perf = enable_linux_perf
35-
tune!(b)
36-
bb = run(b)
37-
38-
withtempdir() do
39-
tmp = joinpath(pwd(), "tmp.json")
40-
41-
BenchmarkTools.save(tmp, b.params, bb)
42-
@test isfile(tmp)
43-
44-
results = BenchmarkTools.load(tmp)
45-
@test results isa Vector{Any}
46-
@test length(results) == 2
47-
@test eq(results[1], b.params)
48-
@test eq(results[2], bb)
49-
end
33+
b = @benchmarkable sin(1)
34+
tune!(b)
35+
bb = run(b)
36+
37+
withtempdir() do
38+
tmp = joinpath(pwd(), "tmp.json")
39+
40+
BenchmarkTools.save(tmp, b.params, bb)
41+
@test isfile(tmp)
42+
43+
results = BenchmarkTools.load(tmp)
44+
@test results isa Vector{Any}
45+
@test length(results) == 2
46+
@test eq(results[1], b.params)
47+
@test eq(results[2], bb)
5048
end
5149

5250
# Nested BenchmarkGroups

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ println("done (took ", took_seconds, " seconds)")
3434
print("Testing serialization...")
3535
took_seconds = @elapsed include("SerializationTests.jl")
3636
println("done (took ", took_seconds, " seconds)")
37+
38+
if parse(Bool, get(ENV, "TEST_PERF_INTEGRATION", "true"))
39+
print("Testing Perf integration...")
40+
took_seconds = @elapsed include("LinuxPerfIntegrationTests.jl")
41+
println("done (took ", took_seconds, " seconds)")
42+
end

0 commit comments

Comments
 (0)