Skip to content

Commit

Permalink
Add demos-signal-completion test
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejKafka committed May 25, 2021
1 parent 3fb00a1 commit c7b23db
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions test/0100-api.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
. testlib
plan_tests 5
plan_tests 7

api-test
is $? 1 "Running outside of demos-sched fails"
Expand All @@ -17,7 +17,7 @@ is "${lines[1]}" "second" "second iteration"

# Check that demos doesn't hang when process exits during initialization
# 3 seconds should be long enough, but fundamentally, it's a race condition
timeout 3s demos-sched -C '
out=$(timeout 3s demos-sched -C '
windows:
- length: 1
slices:
Expand All @@ -32,7 +32,7 @@ partitions:
init: yes
- cmd: exit
budget: 100
'
')
ok $? "Does not hang on process exit during initialization"


Expand All @@ -58,4 +58,18 @@ is "$out" \
init start
init done
init done
<test>"
<test>"


out=$(timeout 3s demos-sched -m "<win>" -C '
windows:
- length: 100
slices:
- {cpu: 0, sc_processes: {init: yes,
cmd: "echo init && demos-signal-completion && echo done"}}
')
ok $? "Calling 'demos-signal-completion' ends initialization"
is "$out" \
"init
<win>
done" "Calling 'demos-signal-completion' ends initialization"

0 comments on commit c7b23db

Please sign in to comment.