-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
238 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Pkg | ||
using Coverage | ||
|
||
try | ||
Pkg.test("Visor"; coverage=true) | ||
catch e | ||
@error "coverage: $e" | ||
finally | ||
coverage = process_folder() | ||
LCOV.writefile("lcov.info", coverage) | ||
end | ||
|
||
for dir in ["src", "test"] | ||
foreach(rm, filter(endswith(".cov"), readdir(dir; join=true))) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Visor | ||
using Test | ||
|
||
terminated = true | ||
|
||
function terminate(::Timer) | ||
global terminated | ||
terminated = false | ||
@error "[tast_one_terminate_all] failed to stop all processes" | ||
shutdown() | ||
|
||
return nothing | ||
end | ||
|
||
function task_one(pd) | ||
return sleep(0.5) | ||
end | ||
|
||
function task_all(pd) | ||
for msg in pd.inbox | ||
if isshutdown(msg) | ||
break | ||
end | ||
end | ||
end | ||
|
||
Timer(terminate, 5) | ||
|
||
try | ||
#spec = [process(task_all), process(task_one), process(task_all)] | ||
spec = [process("p1", task_all), process("p2", task_one), process("p3", task_all)] | ||
|
||
sv = supervise(spec; strategy=:one_terminate_all, terminateif=:empty) | ||
|
||
Visor.dump() | ||
info = procs() | ||
@info "processes: $info" | ||
|
||
@test terminated | ||
finally | ||
shutdown() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Visor | ||
using Test | ||
|
||
function terminate(::Timer) | ||
return shutdown() | ||
end | ||
|
||
function mytask(pd) | ||
for msg in pd.inbox | ||
if isshutdown(msg) | ||
phase = getphase(pd) | ||
@info "[test_phase] phase=$phase" | ||
break | ||
end | ||
end | ||
end | ||
|
||
proc = process(mytask) | ||
spec = [proc] | ||
|
||
Timer(terminate, 2) | ||
sv = supervise(spec; wait=false) | ||
|
||
setphase(proc, :ground) | ||
|
||
wait(sv) | ||
|
||
@test getphase(proc) === :ground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.