trap - INT TERM QUIT EXIT
rm -rf "$testdir/.whenjobs"
+# Sort the output by job serial number, so that jobs that happened to
+# fire off in parallel are still recorded in order.
+sort -n -o "$testdir/test_output" "$testdir/test_output"
+
# Check the test output matches the expected output.
if ! cmp -s "$testdir/test_output" "$1.expected"; then
echo "$0: $1: test output did not match expected output"