[PATCH] tests: avoid test-hup hanging on AIX
Jim Hague
jim.hague at acm.org
Thu Apr 5 06:34:19 CDT 2012
# HG changeset patch
# User Jim Hague <jim.hague at acm.org>
# Date 1333625481 -3600
# Branch stable
# Node ID 979e6564015bddf5b4c35edb94c79517f95b0b85
# Parent 4d875bb546dc03db33630f5388d7e04939c386a0
tests: avoid test-hup hanging on AIX
test-hup hangs on AIX. Under ksh89 on AIX (the default shell),
echo Hello; while [ ! -s not-there ]; do true; done
produces no output while the loop executes. Replacing 'true' with 'sleep 0'
fixes, as does using a less broken shell. ksh93 is fine.
Update check-code.py to look for this, and make same change in test-serve.t.
In fact test-serve works fine, probably because of additional commands between
echo and the loop, but that's a subtlety not easy to test for.
diff -r 4d875bb546dc -r 979e6564015b contrib/check-code.py
--- a/contrib/check-code.py Tue Apr 03 22:01:28 2012 +0200
+++ b/contrib/check-code.py Thu Apr 05 12:31:21 2012 +0100
@@ -94,6 +94,8 @@
"explicit exit code checks unnecessary"),
(uprefix + r'set -e', "don't use set -e"),
(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
[]
diff -r 4d875bb546dc -r 979e6564015b tests/test-hup.t
--- a/tests/test-hup.t Tue Apr 03 22:01:28 2012 +0200
+++ b/tests/test-hup.t Thu Apr 05 12:31:21 2012 +0100
@@ -11,7 +11,7 @@
$ (
> echo lock
> echo addchangegroup
- > while [ ! -s .hg/store/journal ]; do true; done
+ > while [ ! -s .hg/store/journal ]; do sleep 0; done
> kill -HUP $P
> ) > p
diff -r 4d875bb546dc -r 979e6564015b tests/test-serve.t
--- a/tests/test-serve.t Tue Apr 03 22:01:28 2012 +0200
+++ b/tests/test-serve.t Thu Apr 05 12:31:21 2012 +0100
@@ -14,7 +14,7 @@
> else
> kill `cat hg.pid`
> fi
- > while kill -0 `cat hg.pid` 2>/dev/null; do true; done
+ > while kill -0 `cat hg.pid` 2>/dev/null; do sleep 0; done
> }
$ hg init test
More information about the Mercurial-devel
mailing list