Skip to content

Commit 534810b

Browse files
Update CI to use julia-actions/cache and 1.12 + fixes for 1.12 (#221)
* Use julia-actions/cache * run against v1.12 * Start updating tests for 1.12 * Put `walkdir` behind `isdir` check * Fix `should_skip` for v1.12 * fixup! Fix `should_skip` for v1.12 * Update tests to meet `isdir` assumption * Try fix CPU Profile log test regex * Bump version for `skip` bugfix * Fix profile tests on MacOS --------- Co-authored-by: Tomáš Drvoštěp <tomas.drvostep@gmail.com>
1 parent b381807 commit 534810b

File tree

6 files changed

+34
-38
lines changed

6 files changed

+34
-38
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
version:
2020
- '1.8'
2121
- '1.10'
22-
- '1.11'
22+
- '~1.12.0-rc1'
2323
os:
2424
- ubuntu-latest
2525
- macOS-latest
@@ -35,25 +35,14 @@ jobs:
3535
- os: windows-latest
3636
arch: x64
3737
- os: windows-latest
38-
version: 1.8
39-
- os: windows-latest
40-
version: 1.11
38+
version: '1.8'
4139
steps:
4240
- uses: actions/checkout@v4
4341
- uses: julia-actions/setup-julia@v2
4442
with:
4543
version: ${{ matrix.version }}
4644
arch: ${{ matrix.arch }}
47-
- uses: actions/cache@v4
48-
env:
49-
cache-name: cache-artifacts
50-
with:
51-
path: ~/.julia/artifacts
52-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
53-
restore-keys: |
54-
${{ runner.os }}-test-${{ env.cache-name }}-
55-
${{ runner.os }}-test-
56-
${{ runner.os }}-
45+
- uses: julia-actions/cache@v2
5746
- uses: julia-actions/julia-buildpkg@v1
5847
- uses: julia-actions/julia-runtest@v1
5948
- uses: julia-actions/julia-processcoverage@v1

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ReTestItems"
22
uuid = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
3-
version = "1.33.1"
3+
version = "1.33.2"
44

55
[deps]
66
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

src/ReTestItems.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ end
776776

777777
# for each directory, kick off a recursive test-finding task
778778
# Returns (testitems::TestItems, setups::Dict{Symbol,TestSetup})
779+
# Assumes `isdir(project_root)`, which is guaranteed by `_runtests`.
779780
function include_testfiles!(project_name, projectfile, paths, ti_filter::TestItemFilter, verbose_results::Bool, report::Bool)
780781
project_root = dirname(projectfile)
781782
subproject_root = nothing # don't recurse into directories with their own Project.toml.
@@ -991,13 +992,8 @@ function should_skip(ti::TestItem)
991992
skip_body = deepcopy(ti.skip::Expr)
992993
softscope_all!(skip_body)
993994
# Run in a new module to not pollute `Main`.
994-
# Need to store the result of the `skip` expression so we can check it.
995-
mod_name = gensym(Symbol(:skip_, ti.name))
996-
skip_var = gensym(:skip)
997-
skip_mod_expr = :(module $mod_name; $skip_var = $skip_body; end)
998-
skip_mod = Core.eval(Main, skip_mod_expr)
999-
# Check what the expression evaluated to.
1000-
skip = getfield(skip_mod, skip_var)
995+
mod = Module(Symbol(:skip_, ti.name))
996+
skip = Core.eval(mod, skip_body)
1001997
!isa(skip, Bool) && _throw_not_bool(ti, skip)
1002998
return skip::Bool
1003999
end

test/integrationtests.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ end
173173
@test_throws ReTestItems.NoTestException runtests(ti -> :b_tag in ti.tags, pkg; name="b", tags=[:nope])
174174

175175
# can only filter on `ti.name` and `ti.tags` (at least for now)
176-
@test_throws "no field file" runtests(ti -> contains(ti.file, "bar_"), pkg)
176+
expected = if VERSION < v"1.12.0-DEV"
177+
"no field file"
178+
else
179+
"no field `file`"
180+
end
181+
@test_throws expected runtests(ti -> contains(ti.file, "bar_"), pkg)
177182
end
178183

179184
@testset "`@testitem` scoping rules" begin
@@ -942,7 +947,7 @@ end
942947
@testset "non-zero timeout_profile_wait means we collect a CPU profile" begin
943948
capture_timeout_profile(5) do logs
944949
@test occursin("Information request received. A stacktrace will print followed by a $(default_peektime) second profile", logs)
945-
@test count(r"pthread_cond_wait|__psych_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
950+
@test count(r"pthread_cond_wait|__psynch_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
946951
@test occursin("Profile collected.", logs)
947952
end
948953
end
@@ -951,7 +956,7 @@ end
951956
@testset "`set_peek_duration` is respected in `worker_init_expr`" begin
952957
capture_timeout_profile(5, worker_init_expr=:(using Profile; Profile.set_peek_duration($default_peektime + 1.0))) do logs
953958
@test occursin("Information request received. A stacktrace will print followed by a $(default_peektime + 1.0) second profile", logs)
954-
@test count(r"pthread_cond_wait|__psych_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
959+
@test count(r"pthread_cond_wait|__psynch_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
955960
@test occursin("Profile collected.", logs)
956961
end
957962
end
@@ -962,7 +967,7 @@ end
962967
withenv("RETESTITEMS_TIMEOUT_PROFILE_WAIT" => "5") do
963968
capture_timeout_profile(nothing) do logs
964969
@test occursin("Information request received", logs)
965-
@test count(r"pthread_cond_wait|__psych_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
970+
@test count(r"pthread_cond_wait|__psynch_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
966971
@test occursin("Profile collected.", logs)
967972
end
968973
end
@@ -972,7 +977,7 @@ end
972977
@testset "CPU profile with $(repr(log_capture))" for log_capture in (:eager, :batched)
973978
capture_timeout_profile(5, nworker_threads=VERSION >= v"1.9" ? "3,2" : "3", logs=log_capture) do logs
974979
@test occursin("Information request received", logs)
975-
@test count(r"pthread_cond_wait|__psych_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
980+
@test count(r"pthread_cond_wait|__psynch_cvwait", logs) > 0 # the stacktrace was printed (will fail on Windows)
976981
@test occursin("Profile collected.", logs)
977982
end
978983
end

test/internals.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,18 @@ end
9292
shouldrun = TestItemFilter(Returns(true), nothing, nothing)
9393
verbose_results = false
9494
report = false
95+
project = touch(joinpath(mktempdir(), "Project.toml"))
9596

9697
# Requesting only non-existent files/dirs should result in no files being included
97-
ti, setups = include_testfiles!("proj", "/this/file/", ("/this/file/is/not/a/t-e-s-tfile.jl",), shouldrun, verbose_results, report)
98+
ti, setups = include_testfiles!("proj", project, ("/this/file/is/not/a/t-e-s-tfile.jl",), shouldrun, verbose_results, report)
9899
@test isempty(ti.testitems)
99100
@test isempty(setups)
100101

101-
ti, setups = include_testfiles!("proj", "/this/file/", ("/this/file/does/not/exist/imaginary_tests.jl",), shouldrun, verbose_results, report)
102+
ti, setups = include_testfiles!("proj", project, ("/this/file/does/not/exist/imaginary_tests.jl",), shouldrun, verbose_results, report)
102103
@test isempty(ti.testitems)
103104
@test isempty(setups)
104105

105-
ti, setups = include_testfiles!("proj", "/this/dir/", ("/this/dir/does/not/exist/", "/this/dir/also/not/exist/"), shouldrun, verbose_results, report)
106+
ti, setups = include_testfiles!("proj", project, ("/this/dir/does/not/exist/", "/this/dir/also/not/exist/"), shouldrun, verbose_results, report)
106107
@test isempty(ti.testitems)
107108
@test isempty(setups)
108109

@@ -300,7 +301,7 @@ end
300301
end
301302

302303
@testset "should_skip" begin
303-
should_skip = ReTestItems.should_skip
304+
using ReTestItems: should_skip
304305

305306
ti = @testitem("x", skip=true, _run=false, begin end)
306307
@test should_skip(ti)

test/workers.jl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,20 @@ using Test
107107
return read(path, String)
108108
end
109109

110-
@test occursin(r"Thread 1 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
111-
@test occursin(r"Thread 2 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
112-
@test occursin(r"Thread 3 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
110+
# In Julia v1.12+ looks it prints the threadpool, like:
111+
# Thread 1 (interactive) Task 0x00007f03563fc010 Total snapshots: 597. Utilization: 0%
112+
# Thread 5 (default) Task 0x00007f03563fe2c0 Total snapshots: 597. Utilization: 20%
113+
re_thread(i::Int) = Regex("Thread $i( \\((default|interactive)\\))? Task 0x")
114+
@test occursin(re_thread(1), logs)
115+
@test occursin(re_thread(2), logs)
116+
@test occursin(re_thread(3), logs)
117+
113118
if VERSION >= v"1.9"
114-
@test occursin(r"Thread 4 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
115-
@test occursin(r"Thread 5 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
116-
@test !occursin(r"Thread 6 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
119+
@test occursin(re_thread(4), logs)
120+
@test occursin(re_thread(5), logs)
121+
@test !occursin(re_thread(6), logs)
117122
else
118-
@test !occursin(r"Thread 4 Task 0x\w+ Total snapshots: \d+. Utilization: \d+%", logs)
123+
@test !occursin(re_thread(4), logs)
119124
end
120125
end
121126
end

0 commit comments

Comments
 (0)