Skip to content

Commit dc37432

Browse files
committed
Allow for testing with multithreading disabled
1 parent 7422a3c commit dc37432

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

test/test_onprocs.jl

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ using ParallelProcessingTools
55

66
using Distributed
77

8-
if length(workers()) < 2
9-
addprocs(2, exename = ParallelProcessingTools.mtjulia_exe())
10-
end
11-
128

13-
@testset "distexec" begin
9+
@testset "onprocs" begin
1410
@testset "worker-init" begin
11+
if length(workers()) < 2
12+
@test addprocs(2, exename = ParallelProcessingTools.mtjulia_exe()) == [2, 3]
13+
end
1514
@test length(workers()) >= 2
1615
end
1716

18-
@testset "onprocs" begin
17+
@testset "macro onprocs" begin
1918
@everywhere using ParallelProcessingTools, Base.Threads
2019

2120
@test (@onprocs workers() myid()) == workers()

test/test_onthreads.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ using ParallelProcessingTools
66
using Base.Threads
77

88

9-
@testset "distexec" begin
10-
@testset "threads-init" begin
11-
@test nthreads() >= 2
9+
@testset "onthreads" begin
10+
if nthreads() < 2
11+
@warn "JULIA multithreading not enabled"
1212
end
1313

14-
@testset "onprocs" begin
14+
@testset "macro onthreads" begin
1515
@test (begin
1616
tl = ThreadLocal(0)
1717
@onthreads allthreads() tl[] = threadid()

0 commit comments

Comments
 (0)