tests: use 'do sleep 0' instead of 'do true', also on first line of command

2cd44a791e66 established that '... do true ...' shouldn't be used, but that was
only enforced on continued lines.
This commit is contained in:
Mads Kiilerich 2012-04-23 01:56:48 +02:00
parent ca99a3d167
commit f64bae7ea3
5 changed files with 7 additions and 8 deletions

View File

@ -75,6 +75,7 @@ testpats = [
(r'^alias\b.*=', "don't use alias, use a function"),
(r'if\s*!', "don't use '!' to negate exit status"),
(r'/dev/u?random', "don't use entropy, use /dev/zero"),
(r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
],
# warnings
[]
@ -98,8 +99,6 @@ utestpats = [
(uprefix + r'set -e', "don't use set -e"),
(uprefix + r'\s', "don't indent commands, use > for continued lines"),
(uprefixc + r'( *)\t', "don't use tabs to indent"),
(uprefixc + r'.*do\s*true;\s*done',
"don't use true as loop body, use sleep 0"),
],
# warnings
[]

View File

@ -20,7 +20,7 @@
$ python dumb.py 2> log &
$ P=$!
$ while [ ! -f listening ]; do true; done
$ while [ ! -f listening ]; do sleep 0; done
$ hg clone http://localhost:$HGPORT/foo copy2
abort: HTTP Error 404: * (glob)
[255]

View File

@ -20,7 +20,7 @@ Test raw style of hgweb
$ cat hg.pid >> $DAEMON_PIDS
$ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=a23bf1310f6e;file=sub/some%20%22text%22.txt;style=raw' content-type content-length content-disposition) >getoutput.txt
$ while kill `cat hg.pid` 2>/dev/null; do true; done
$ while kill `cat hg.pid` 2>/dev/null; do sleep 0; done
$ cat getoutput.txt
200 Script output follows
@ -41,7 +41,7 @@ Test raw style of hgweb
$ cat hg.pid >> $DAEMON_PIDS
$ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=a23bf1310f6e;file=sub/some%20%22text%22.txt;style=raw' content-type content-length content-disposition) >getoutput.txt
$ while kill `cat hg.pid` 2>/dev/null; do true; done
$ while kill `cat hg.pid` 2>/dev/null; do sleep 0; done
$ cat getoutput.txt
200 Script output follows

View File

@ -9,7 +9,7 @@
$ cat hg.pid >> $DAEMON_PIDS
$ cd ..
$ "$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 </dev/null &
$ while [ ! -f proxy.pid ]; do true; done
$ while [ ! -f proxy.pid ]; do sleep 0; done
$ cat proxy.pid >> $DAEMON_PIDS
url for proxy, stream

View File

@ -233,12 +233,12 @@ Fingerprints
$ hg -R copy-pull id https://127.0.0.1:$HGPORT/
5fed3813f7f5
$ while kill `cat hg1.pid` 2>/dev/null; do true; done
$ while kill `cat hg1.pid` 2>/dev/null; do sleep 0; done
Prepare for connecting through proxy
$ "$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log </dev/null 2>&1 &
$ while [ ! -f proxy.pid ]; do true; done
$ while [ ! -f proxy.pid ]; do sleep 0; done
$ cat proxy.pid >> $DAEMON_PIDS
$ echo "[http_proxy]" >> copy-pull/.hg/hgrc