|
1 | | -using ExponentialFamilyProjection, Test, ReTestItems, Random |
| 1 | +using Aqua, Hwloc, ReTestItems, ExponentialFamilyProjection, Random |
2 | 2 |
|
3 | 3 | # Set the random seed for reproducibility of kl-divergence tests |
4 | 4 | Random.seed!(42) |
5 | 5 |
|
6 | | -runtests(ExponentialFamilyProjection; memory_threshold = 1.0) |
| 6 | +if get(ENV, "RUN_AQUA", "true") == "true" |
| 7 | + Aqua.test_all(ExponentialFamilyProjection; ambiguities = false, piracies = false, deps_compat = (; check_extras = false, check_weakdeps = true)) |
| 8 | +end |
| 9 | + |
| 10 | +nthreads, ncores = Hwloc.num_virtual_cores(), Hwloc.num_physical_cores() |
| 11 | +nthreads, ncores = max(nthreads, 1), max(ncores, 1) |
| 12 | +nworker_threads = Int(nthreads / ncores) |
| 13 | +memory_threshold = 1.0 |
| 14 | + |
| 15 | +pkg_root = dirname(pathof(ExponentialFamilyProjection)) |> dirname |
| 16 | +test_root = joinpath(pkg_root, "test") |
| 17 | + |
| 18 | +if isempty(ARGS) |
| 19 | + runtests(ExponentialFamilyProjection; nworkers = ncores, nworker_threads = nworker_threads, memory_threshold = memory_threshold) |
| 20 | +else |
| 21 | + for arg in ARGS |
| 22 | + # Translate colon syntax (e.g., rules:normal_mean_variance → rules/normal_mean_variance) |
| 23 | + candidate = join(split(arg, ":"), "/") |
| 24 | + |
| 25 | + # Build possible test paths relative to the package test directory |
| 26 | + paths = [joinpath(test_root, candidate), joinpath(test_root, candidate * ".jl")] |
| 27 | + |
| 28 | + path = findfirst(ispath, paths) |
| 29 | + |
| 30 | + if path !== nothing |
| 31 | + selected_path = paths[path] |
| 32 | + @info "Running selective tests from $selected_path" |
| 33 | + runtests(selected_path; nworkers = ncores, nworker_threads = nworker_threads, memory_threshold = memory_threshold) |
| 34 | + else |
| 35 | + @warn "Test target not found: $arg" |
| 36 | + end |
| 37 | + end |
| 38 | +end |
0 commit comments