t/010-jobserver: add serial/parallel override tests.

This new test validates that you can pass -j1 and -j2 in a sub-redo to
create a sub-jobserver with exactly the number of jobs you specified.
Now that we have that feature, we can also test for the bug fixed two
commits ago where, with -j1, targets would be built in an unexpected
order.
This commit is contained in:
Avery Pennarun 2018-12-31 17:43:03 -05:00
commit 87bac287b6
14 changed files with 87 additions and 2 deletions

24
t/010-jobserver/first.do Normal file
View file

@ -0,0 +1,24 @@
# in case we're (erroneously) running in parallel, give second.do some
# time to start but not finish.
echo 'first sleep' >&2
sleep 1
# Because of --shuffle, we can't be sure if first or second ran first, but
# because all.do uses -j1, we *should* expect that if second ran first, it
# at least ran to completion before we ran at all.
if [ -e second.start ]; then
echo 'first: second already started before we did...' >&2
[ -e second.end ] || exit 21
echo 'first: ...and it finished as it should.' >&2
# no sense continuing the test; can't test anything if second already
# ran.
exit 0
fi
echo 'first: second has not started yet, good.' >&2
echo 'first spin' >&2
redo 1.a.spin
[ -e 1.a.spin ] || exit 11
echo 'first spin complete' >&2
! [ -e second.start ] || exit 22