forked from flux-framework/flux-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: There are no tests of the flux-exec --jobid option. Add a new sharness test for this option, since it requires that the tests be able to run jobs, as opposed to the basic flux-exec testing, which does not.
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/sh | ||
# | ||
|
||
test_description='Test exec command --jobid option | ||
Test exec --jobid functionality | ||
' | ||
|
||
. `dirname $0`/sharness.sh | ||
SIZE=4 | ||
test_under_flux ${SIZE} job | ||
|
||
TMPDIR=$(cd /tmp && $(which pwd)) | ||
|
||
test_expect_success 'flux exec --jobid fails with invalid job id' ' | ||
test_expect_code 1 flux exec --jobid=f-o-o true 2>badid.err && | ||
test_debug "cat badid.err" && | ||
grep "error parsing jobid" badid.err | ||
' | ||
test_expect_success 'flux exec --jobid fails for nonexistent job id' ' | ||
test_expect_code 1 flux exec --jobid=f1 true 2>noid.err && | ||
test_debug "cat noid.err" && | ||
grep "not found" noid.err | ||
' | ||
test_expect_success 'run two jobs on different ranks' ' | ||
flux submit --wait-event=start --bcc=1-2 -N1 sleep inf && | ||
id1=$(flux job last [-1:]) && | ||
id2=$(flux job last) && | ||
test_debug "flux jobs -no \"{id} {ranks}\"" | ||
' | ||
test_expect_success 'flux exec --jobid works' ' | ||
rank1=$(flux exec --jobid=$id1 flux getattr rank) && | ||
rank2=$(flux exec --jobid=$id2 flux getattr rank) && | ||
test_debug "echo flux exec --jobid=$id1 ran on rank $rank1" && | ||
test_debug "echo flux exec --jobid=$id2 ran on rank $rank2" && | ||
test $rank1 -eq $(flux jobs -no {ranks} $id1) && | ||
test $rank2 -eq $(flux jobs -no {ranks} $id2) | ||
' | ||
test_expect_success 'run one job on two ranks' ' | ||
jobid=$(flux submit --wait-event=start -N2 sleep inf) | ||
' | ||
test_expect_success 'flux exec --jobid on multi-node jobs runs on all ranks' ' | ||
flux exec --jobid=$jobid --label-io flux getattr rank >2node.out && | ||
test_debug "cat 2node.out" && | ||
grep "2: 2" 2node.out && | ||
grep "3: 3" 2node.out | ||
' | ||
test_expect_success 'flux exec --jobid works with --rank option' ' | ||
flux exec --jobid=$jobid -r 0 flux getattr rank && | ||
test $(flux exec --jobid=$jobid -r 0 flux getattr rank) -eq 2 && | ||
flux exec --jobid=$jobid -r 1 flux getattr rank && | ||
test $(flux exec --jobid=$jobid -r 1 flux getattr rank) -eq 3 | ||
' | ||
test_expect_success 'flux exec --jobid fails with invalid --rank option' ' | ||
test_must_fail flux exec --jobid=$jobid -r 3 hostname && | ||
test_must_fail flux exec --jobid=$jobid -r 0-3 hostname | ||
' | ||
test_expect_success 'flux exec --jobid works with --exclude option' ' | ||
flux exec --jobid=$jobid -x 0 flux getattr rank && | ||
test $(flux exec --jobid=$jobid -x 0 flux getattr rank) -eq 3 && | ||
flux exec --jobid=$jobid -x 1 flux getattr rank && | ||
test $(flux exec --jobid=$jobid -x 1 flux getattr rank) -eq 2 | ||
' | ||
test_expect_success 'flux exec --jobid fails with invalid --exclude option' ' | ||
test_must_fail flux exec --jobid=$jobid -x 3 hostname && | ||
test_must_fail flux exec --jobid=$jobid -x 0-3 hostname | ||
' | ||
test_expect_success 'flux exec --jobid fails if there are no ranks to target' ' | ||
test_must_fail flux exec --jobid=$jobid -x 0-1 hostname | ||
' | ||
test_expect_success 'cancel jobs' ' | ||
flux cancel --all && | ||
flux job wait-event $id1 clean | ||
' | ||
test_expect_success 'flux exec --jobid on inactive job fails' ' | ||
test_must_fail flux exec --jobid=$id1 hostname 2>inactive.err && | ||
test_debug "cat inactive.err" && | ||
grep "not currently running" inactive.err | ||
' | ||
|
||
test_done |