Skip to content

Commit 480a68f

Browse files
Fix Hwloc parse error in test/runtests.jl
Add try-catch blocks around Hwloc.num_physical_cores() and Hwloc.num_virtual_cores() calls to handle cases where Hwloc fails (e.g., on some CI environments like macOS aarch64). This fixes the ArgumentError: input string is empty or only contains whitespace error that occurs when Hwloc functions fail and return unexpected values. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent ee49e88 commit 480a68f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

test/runtests.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,23 @@ length(EXTRA_PKGS) ≥ 1 && Pkg.add(EXTRA_PKGS)
2121
const RETESTITEMS_NWORKERS = if GROUP == "wrappers"
2222
0 # Sequential execution for wrapper tests
2323
else
24-
parse(
25-
Int, get(ENV, "RETESTITEMS_NWORKERS",
26-
string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4))
27-
)
28-
)
24+
default_workers = try
25+
min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4)
26+
catch
27+
# Fallback if Hwloc fails (e.g., on some CI environments)
28+
0
29+
end
30+
parse(Int, get(ENV, "RETESTITEMS_NWORKERS", string(default_workers)))
2931
end
3032
const RETESTITEMS_NWORKER_THREADS = parse(Int,
3133
get(
3234
ENV, "RETESTITEMS_NWORKER_THREADS",
33-
string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1))
35+
string(try
36+
max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1)
37+
catch
38+
# Fallback if Hwloc fails
39+
1
40+
end)
3441
)
3542
)
3643

0 commit comments

Comments
 (0)