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:
parent
5abf78059f
commit
df44dc54a2
11 changed files with 68 additions and 3 deletions
5
jwack.py
5
jwack.py
|
|
@ -235,6 +235,9 @@ def setup(maxjobs):
|
||||||
if a <= 0 or b <= 0:
|
if a <= 0 or b <= 0:
|
||||||
raise ValueError('invalid REDO_CHEATFDS: %r' % cheats)
|
raise ValueError('invalid REDO_CHEATFDS: %r' % cheats)
|
||||||
_cheatfds = (a, b)
|
_cheatfds = (a, b)
|
||||||
|
else:
|
||||||
|
_cheatfds = _make_pipe(102)
|
||||||
|
os.putenv('REDO_CHEATFDS', '%d,%d' % (_cheatfds[0], _cheatfds[1]))
|
||||||
|
|
||||||
if not _tokenfds:
|
if not _tokenfds:
|
||||||
# need to start a new server
|
# need to start a new server
|
||||||
|
|
@ -247,8 +250,6 @@ def setup(maxjobs):
|
||||||
(os.getenv('MAKEFLAGS', ''),
|
(os.getenv('MAKEFLAGS', ''),
|
||||||
_tokenfds[0], _tokenfds[1],
|
_tokenfds[0], _tokenfds[1],
|
||||||
_tokenfds[0], _tokenfds[1]))
|
_tokenfds[0], _tokenfds[1]))
|
||||||
_cheatfds = _make_pipe(102)
|
|
||||||
os.putenv('REDO_CHEATFDS', '%d,%d' % (_cheatfds[0], _cheatfds[1]))
|
|
||||||
|
|
||||||
|
|
||||||
def _wait(want_token, max_delay):
|
def _wait(want_token, max_delay):
|
||||||
|
|
|
||||||
|
|
@ -54,12 +54,13 @@ if [ -z "$DO_BUILT" ]; then
|
||||||
export _do_opt_verbose=
|
export _do_opt_verbose=
|
||||||
export _do_opt_clean=
|
export _do_opt_clean=
|
||||||
fi
|
fi
|
||||||
while getopts 'dxvch?' _opt; do
|
while getopts 'dxvcj:h?' _opt; do
|
||||||
case $_opt in
|
case $_opt in
|
||||||
d) _do_opt_debug=1 ;;
|
d) _do_opt_debug=1 ;;
|
||||||
x) _do_opt_exec=x ;;
|
x) _do_opt_exec=x ;;
|
||||||
v) _do_opt_verbose=v ;;
|
v) _do_opt_verbose=v ;;
|
||||||
c) _do_opt_clean=1 ;;
|
c) _do_opt_clean=1 ;;
|
||||||
|
j) ;; # silently ignore, for compat with real redo
|
||||||
\?|h|*) printf "%s" "$USAGE" >&2
|
\?|h|*) printf "%s" "$USAGE" >&2
|
||||||
exit 99
|
exit 99
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
2
t/203-make/.gitignore
vendored
Normal file
2
t/203-make/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
*.out
|
||||||
|
whichmake
|
||||||
8
t/203-make/Makefile
Normal file
8
t/203-make/Makefile
Normal 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
20
t/203-make/all.do
Normal 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
1
t/203-make/clean.do
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
rm -f *~ .*~ *.out whichmake
|
||||||
1
t/203-make/default.out.do
Normal file
1
t/203-make/default.out.do
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
echo $1 >$3
|
||||||
16
t/203-make/whichmake.do
Normal file
16
t/203-make/whichmake.do
Normal 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
13
t/203-make/wipe-redo.sh
Normal 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
1
t/203-make/x.do
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
./whichmake x >&2
|
||||||
1
t/203-make/y.do
Normal file
1
t/203-make/y.do
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
./whichmake y >&2
|
||||||
Loading…
Add table
Add a link
Reference in a new issue