Skip to content

Commit e632d7b

Browse files
committed
Update test suite and gitignore configuration
1 parent 74e14b0 commit e632d7b

15 files changed

Lines changed: 48 additions & 67 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ reports/
3232
# claude
3333
CLAUDE.local.md
3434
.claude/
35+
.coverage/

test/coverage.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ==============================================================================
2+
# CTParser Coverage Post-Processing
3+
# ==============================================================================
4+
#
5+
# See test/README.md for details.
6+
#
7+
# ⚠️ Prerequisites:
8+
# The Coverage package must be installed in your base Julia environment:
9+
# julia --project=@v1.12 -e 'using Pkg; Pkg.add("Coverage")'
10+
#
11+
# Usage:
12+
# julia --project=@. -e 'using Pkg; Pkg.test("CTParser"; coverage=true); include("test/coverage.jl")'
13+
#
14+
# ==============================================================================
15+
using Coverage
16+
using CTBase
17+
CTBase.postprocess_coverage(; root_dir=dirname(@__DIR__), dest_dir=".coverage")

test/runtests.jl

Lines changed: 30 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# ==============================================================================
2+
# CTParser Test Runner
3+
# ==============================================================================
4+
5+
# Test dependencies
16
using Test
27
using Aqua
38
using OrderedCollections: OrderedDict
@@ -59,73 +64,31 @@ include("utils.jl")
5964
const VERBOSE = true
6065
const SHOWTIMING = true
6166

62-
"""Return the default set of tests enabled for CTParser."""
63-
function default_tests()
64-
return OrderedDict(
65-
:aqua => true,
66-
:exa_linalg => true,
67-
:initial_guess => true,
68-
:utils => true,
69-
:utils_bis => true,
70-
:prefix => true,
71-
:prefix_bis => true,
72-
:onepass_fun => true,
73-
:onepass_fun_bis => true,
74-
:onepass_exa => true,
75-
:onepass_exa_bis => true,
76-
:dynamics_exa => true,
77-
)
78-
end
79-
80-
const TEST_SELECTIONS = isempty(ARGS) ? Symbol[] : Symbol.(ARGS)
81-
82-
function selected_tests()
83-
tests = default_tests()
84-
sels = TEST_SELECTIONS
85-
86-
# No selection: use defaults
87-
if isempty(sels)
88-
return tests
89-
end
67+
# Run tests using the TestRunner extension
68+
CTBase.run_tests(;
69+
args=String.(ARGS),
70+
testset_name="CTParser tests",
71+
available_tests=(
72+
"suite/test_*",
73+
),
74+
filename_builder=name -> "test_$(name).jl",
75+
funcname_builder=name -> "test_$(name)",
76+
verbose=VERBOSE,
77+
showtiming=SHOWTIMING,
78+
test_dir=@__DIR__,
79+
)
9080

91-
# Single :all selection: enable everything
92-
if length(sels) == 1 && sels[1] == :all
93-
for k in keys(tests)
94-
tests[k] = true
95-
end
96-
return tests
97-
end
81+
# If running with coverage enabled, remind the user to run the post-processing script
82+
# because .cov files are flushed at process exit and cannot be cleaned up by this script.
83+
if Base.JLOptions().code_coverage != 0
84+
println(
85+
"""
86+
================================================================================
87+
Coverage files generated. To process them, please run:
9888
99-
# Otherwise, start with everything disabled
100-
for k in keys(tests)
101-
tests[k] = false
102-
end
89+
julia --project -e 'using Pkg; Pkg.test("CTParser"; coverage=true); include("test/coverage.jl")'
10390
104-
# Enable explicit selections
105-
for sel in sels
106-
if sel == :all
107-
for k in keys(tests)
108-
tests[k] = true
109-
end
110-
break
111-
end
112-
if haskey(tests, sel)
113-
tests[sel] = true
114-
end
115-
end
116-
117-
return tests
118-
end
119-
120-
const SELECTED_TESTS = selected_tests()
121-
122-
@testset verbose = VERBOSE showtiming = SHOWTIMING "CTParser tests" begin
123-
for (name, enabled) in SELECTED_TESTS
124-
enabled || continue
125-
@testset "$(name)" begin
126-
test_name = Symbol(:test_, name)
127-
include("$(test_name).jl")
128-
@eval $test_name()
129-
end
130-
end
131-
end
91+
================================================================================
92+
"""
93+
)
94+
end

0 commit comments

Comments
 (0)