-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
fail fast: update tests
Showing
2 changed files
with
35 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
exit_fail() { | ||
err=$? | ||
echo "Slurm test failed! Output is in $workdir" | ||
exit $err | ||
} | ||
|
||
trap exit_fail ERR | ||
|
||
workdir=$(mktemp -d -p ./ disbatch-test.XXXX) | ||
cp Tasks $workdir | ||
workdir=$(mktemp -d -p $PWD disbatch-test.XXXX) | ||
cp Tasks Tasks_failfast $workdir | ||
cd $workdir | ||
|
||
# Run the test | ||
salloc -n 2 disBatch Tasks | ||
|
||
# Check that all 3 tasks ran, | ||
# which means A.txt, B.txt, and C.txt exist | ||
success=0 | ||
[[ -f A.txt && -f B.txt && -f C.txt ]] || success=$? | ||
[[ -f A.txt && -f B.txt && -f C.txt ]] | ||
|
||
cd - > /dev/null | ||
rm -f A.txt B.txt C.txt | ||
|
||
if [[ $success -eq 0 ]]; then | ||
echo "Slurm test passed." | ||
rm -rf $workdir | ||
else | ||
echo "Slurm test failed! Output is in $workdir" | ||
fi | ||
# disBatch is expected to exit with a non-zero exit code here | ||
salloc -n 2 disbatch --fail-fast Tasks_failfast || true | ||
|
||
# check that we failed fast and didn't run any more tasks | ||
[[ ! -f A.txt ]] | ||
|
||
exit $success | ||
trap - ERR | ||
echo "Slurm test passed." | ||
rm -rf $workdir |
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