changeset 16496:abbabbbe4ec2 stable

tests: use 'do sleep 0' instead of 'do true', also on first line of command f64b25f147d7 established that '... do true ...' shouldn't be used, but that was only enforced on continued lines.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 23 Apr 2012 01:56:48 +0200
parents 5f9835ed3d6d
children c326fe884daa
files contrib/check-code.py tests/test-bad-pull.t tests/test-hgweb-raw.t tests/test-http-proxy.t tests/test-https.t
diffstat 5 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon Apr 23 01:56:48 2012 +0200
+++ b/contrib/check-code.py	Mon Apr 23 01:56:48 2012 +0200
@@ -75,6 +75,7 @@
     (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 @@
     (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
   []
--- a/tests/test-bad-pull.t	Mon Apr 23 01:56:48 2012 +0200
+++ b/tests/test-bad-pull.t	Mon Apr 23 01:56:48 2012 +0200
@@ -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]
--- a/tests/test-hgweb-raw.t	Mon Apr 23 01:56:48 2012 +0200
+++ b/tests/test-hgweb-raw.t	Mon Apr 23 01:56:48 2012 +0200
@@ -20,7 +20,7 @@
   $ 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 @@
 
   $ 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
--- a/tests/test-http-proxy.t	Mon Apr 23 01:56:48 2012 +0200
+++ b/tests/test-http-proxy.t	Mon Apr 23 01:56:48 2012 +0200
@@ -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
--- a/tests/test-https.t	Mon Apr 23 01:56:48 2012 +0200
+++ b/tests/test-https.t	Mon Apr 23 01:56:48 2012 +0200
@@ -233,12 +233,12 @@
   $ 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