Skip to content

Commit b3a62b4

Browse files
authored
Restore cmdlineargs tests on non-Windows platforms (JuliaLang#55368)
1 parent 016d035 commit b3a62b4

File tree

1 file changed

+29
-35
lines changed

1 file changed

+29
-35
lines changed

test/cmdlineargs.jl

+29-35
Original file line numberDiff line numberDiff line change
@@ -339,43 +339,37 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
339339
@test errors_not_signals(`$exename -C invalidtarget`)
340340
@test errors_not_signals(`$exename --cpu-target=invalidtarget`)
341341

342-
if Sys.iswindows()
343-
# -t, --threads
344-
code = "print(Threads.threadpoolsize())"
345-
cpu_threads = ccall(:jl_effective_threads, Int32, ())
346-
@test string(cpu_threads) ==
347-
read(`$exename --threads auto -e $code`, String) ==
348-
read(`$exename --threads=auto -e $code`, String) ==
349-
read(`$exename -tauto -e $code`, String) ==
350-
read(`$exename -t auto -e $code`, String)
351-
for nt in (nothing, "1")
352-
withenv("JULIA_NUM_THREADS" => nt) do
353-
@test read(`$exename --threads=2 -e $code`, String) ==
354-
read(`$exename -t 2 -e $code`, String) == "2"
355-
end
356-
end
357-
# We want to test oversubscription, but on manycore machines, this can
358-
# actually exhaust limited PID spaces
359-
cpu_threads = max(2*cpu_threads, min(50, 10*cpu_threads))
360-
if Sys.WORD_SIZE == 32
361-
cpu_threads = min(cpu_threads, 50)
362-
end
363-
@test read(`$exename -t $cpu_threads -e $code`, String) == string(cpu_threads)
364-
withenv("JULIA_NUM_THREADS" => string(cpu_threads)) do
365-
@test read(`$exename -e $code`, String) == string(cpu_threads)
342+
# -t, --threads
343+
code = "print(Threads.threadpoolsize())"
344+
cpu_threads = ccall(:jl_effective_threads, Int32, ())
345+
@test string(cpu_threads) ==
346+
read(`$exename --threads auto -e $code`, String) ==
347+
read(`$exename --threads=auto -e $code`, String) ==
348+
read(`$exename -tauto -e $code`, String) ==
349+
read(`$exename -t auto -e $code`, String)
350+
for nt in (nothing, "1")
351+
withenv("JULIA_NUM_THREADS" => nt) do
352+
@test read(`$exename --threads=2 -e $code`, String) ==
353+
read(`$exename -t 2 -e $code`, String) == "2"
366354
end
367-
@test errors_not_signals(`$exename -t 0`)
368-
@test errors_not_signals(`$exename -t -1`)
355+
end
356+
# We want to test oversubscription, but on manycore machines, this can
357+
# actually exhaust limited PID spaces
358+
cpu_threads = max(2*cpu_threads, min(50, 10*cpu_threads))
359+
if Sys.WORD_SIZE == 32
360+
cpu_threads = min(cpu_threads, 50)
361+
end
362+
@test read(`$exename -t $cpu_threads -e $code`, String) == string(cpu_threads)
363+
withenv("JULIA_NUM_THREADS" => string(cpu_threads)) do
364+
@test read(`$exename -e $code`, String) == string(cpu_threads)
365+
end
366+
@test errors_not_signals(`$exename -t 0`)
367+
@test errors_not_signals(`$exename -t -1`)
369368

370-
# Combining --threads and --procs: --threads does propagate
371-
withenv("JULIA_NUM_THREADS" => nothing) do
372-
code = "print(sum(remotecall_fetch(Threads.threadpoolsize, x) for x in procs()))"
373-
@test read(`$exename -p2 -t2 -e $code`, String) == "6"
374-
end
375-
else
376-
@test_skip "Command line tests with -t are flakey on non-Windows OS"
377-
# Known issue: https://github.com/JuliaLang/julia/issues/49154
378-
# These tests should be fixed and reenabled on all operating systems.
369+
# Combining --threads and --procs: --threads does propagate
370+
withenv("JULIA_NUM_THREADS" => nothing) do
371+
code = "print(sum(remotecall_fetch(Threads.threadpoolsize, x) for x in procs()))"
372+
@test read(`$exename -p2 -t2 -e $code`, String) == "6"
379373
end
380374

381375
# Combining --threads and invalid -C should yield a decent error

0 commit comments

Comments
 (0)