jwack: _cheatfds error when run from toplevel make -j.

Also added a new unit test to confirm that 'make' behaviour works as
expected, with and without parallelism.
This commit is contained in:
Avery Pennarun 2018-12-04 00:07:23 -05:00
commit df44dc54a2
11 changed files with 68 additions and 3 deletions

2
t/203-make/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.out
whichmake

8
t/203-make/Makefile Normal file
View file

@ -0,0 +1,8 @@
default:
x:
+redo x1.out x2.out
y:
+redo x
+redo y1.out y2.out

20
t/203-make/all.do Normal file
View file

@ -0,0 +1,20 @@
exec >&2
redo-ifchange whichmake
run() {
rm -f *.out
./whichmake y
rm -f *.out
./whichmake -j10 y
rm -f *.out
redo y
rm -f *.out
redo -j10 y
}
run
. ./wipe-redo.sh
run

1
t/203-make/clean.do Normal file
View file

@ -0,0 +1 @@
rm -f *~ .*~ *.out whichmake

View file

@ -0,0 +1 @@
echo $1 >$3

16
t/203-make/whichmake.do Normal file
View file

@ -0,0 +1,16 @@
if type gmake >/dev/null 2>/dev/null; then
make=gmake
elif type make >/dev/null 2>/dev/null; then
make=make
else
# No make installed? That's okay, this test
# isn't *that* important.
make=:
fi
cat >$3 <<-EOF
#!/bin/sh
$make "\$@"
EOF
chmod a+x $3

13
t/203-make/wipe-redo.sh Normal file
View file

@ -0,0 +1,13 @@
vars=$(
env | {
IFS="="
while read key value; do
if [ "$key" != "${key#REDO}" ] ||
[ "$key" != "${key#MAKE}" ]; then
echo "$key"
fi
done
}
)
echo "Wiping vars:" $vars >&2
unset $vars

1
t/203-make/x.do Normal file
View file

@ -0,0 +1 @@
./whichmake x >&2

1
t/203-make/y.do Normal file
View file

@ -0,0 +1 @@
./whichmake y >&2