changeset 14831:0407b7613e99 stable

treediscovery: rename stop() in tests to fix failures on AIX. It seems ksh, the default shell on AIX, does not permit the creation of a function called stop(). test-treediscovery.t and test-treediscovery-legacy.t both fail on AIX with error 'syntax error at line 25 : `(' unexpected'. Fix by renaming stop() in the scripts to tstop(). For completeness rename start() to tstart() to match. Both tests then pass on AIX. Add check for the use of stop() in a shell script to check-code.
author Jim Hague <jim.hague@acm.org>
date Tue, 05 Jul 2011 11:53:32 +0100
parents 35f5cfdd0427
children d60e4f227d75
files contrib/check-code.py tests/test-treediscovery-legacy.t tests/test-treediscovery.t
diffstat 3 files changed, 27 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon Jul 04 14:36:16 2011 +0300
+++ b/contrib/check-code.py	Tue Jul 05 11:53:32 2011 +0100
@@ -68,6 +68,7 @@
     (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
     (r'ls\s+[^|-]+\s+-', "options to 'ls' must come before filenames"),
     (r'[^>]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
+    (r'stop\(\)', "don't use 'stop' as a shell function name"),
   ],
   # warnings
   []
--- a/tests/test-treediscovery-legacy.t	Mon Jul 04 14:36:16 2011 +0300
+++ b/tests/test-treediscovery-legacy.t	Tue Jul 05 11:53:32 2011 +0100
@@ -17,7 +17,7 @@
 
   $ remote=http://localhost:$HGPORT/
   $ export remote
-  $ start() {
+  $ tstart() {
   >   echo '[web]' > $1/.hg/hgrc
   >   echo 'push_ssl = false' >> $1/.hg/hgrc
   >   echo 'allow_push = *' >> $1/.hg/hgrc
@@ -25,7 +25,7 @@
   >   hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
   >   cat hg.pid >> $DAEMON_PIDS
   > }
-  $ stop() {
+  $ tstop() {
   >   "$TESTDIR/killdaemons.py"
   >   cp $HGRCPATH-withcap $HGRCPATH
   > }
@@ -34,7 +34,7 @@
 
   $ hg init empty1
   $ hg init empty2
-  $ start empty2
+  $ tstart empty2
   $ hg incoming -R empty1 $remote
   comparing with http://localhost:$HGPORT/
   no changes found
@@ -49,7 +49,7 @@
   $ hg push -R empty1 $remote
   pushing to http://localhost:$HGPORT/
   no changes found
-  $ stop
+  $ tstop
 
 Base repo:
 
@@ -82,7 +82,7 @@
   o  0 d57206cc072a: r0
   
   $ cd ..
-  $ start main
+  $ tstart main
 
 Full clone:
 
@@ -199,7 +199,7 @@
 
 Remote is empty:
 
-  $ stop ; start empty2
+  $ tstop ; tstart empty2
   $ cd main
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -241,7 +241,7 @@
 
 Local is superset:
 
-  $ stop
+  $ tstop
   $ hg clone main subset2 --rev name2
   adding changesets
   adding manifests
@@ -249,7 +249,7 @@
   added 6 changesets with 12 changes to 2 files
   updating to branch name2
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ start subset2
+  $ tstart subset2
   $ cd main
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -291,7 +291,7 @@
 
 Partial pull:
 
-  $ stop ; start main
+  $ tstop ; tstart main
   $ hg clone $remote partial --rev name2
   abort: partial pull cannot be done because other repository doesn't support changegroupsubset.
   [255]
@@ -306,5 +306,5 @@
   [255]
   $ cd ..
 
-  $ stop
+  $ tstop
 
--- a/tests/test-treediscovery.t	Mon Jul 04 14:36:16 2011 +0300
+++ b/tests/test-treediscovery.t	Tue Jul 05 11:53:32 2011 +0100
@@ -13,14 +13,14 @@
 
   $ remote=http://localhost:$HGPORT/
   $ export remote
-  $ start() {
+  $ tstart() {
   >   echo '[web]' > $1/.hg/hgrc
   >   echo 'push_ssl = false' >> $1/.hg/hgrc
   >   echo 'allow_push = *' >> $1/.hg/hgrc
   >   hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
   >   cat hg.pid >> $DAEMON_PIDS
   > }
-  $ stop() {
+  $ tstop() {
   >   "$TESTDIR/killdaemons.py"
   > }
 
@@ -28,7 +28,7 @@
 
   $ hg init empty1
   $ hg init empty2
-  $ start empty2
+  $ tstart empty2
   $ hg incoming -R empty1 $remote
   comparing with http://localhost:$HGPORT/
   no changes found
@@ -43,7 +43,7 @@
   $ hg push -R empty1 $remote
   pushing to http://localhost:$HGPORT/
   no changes found
-  $ stop
+  $ tstop
 
 Base repo:
 
@@ -76,7 +76,7 @@
   o  0 d57206cc072a: r0
   
   $ cd ..
-  $ start main
+  $ tstart main
 
 Full clone:
 
@@ -187,7 +187,7 @@
 
 Remote is empty:
 
-  $ stop ; start empty2
+  $ tstop ; tstart empty2
   $ cd main
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -229,7 +229,7 @@
 
 Local is superset:
 
-  $ stop
+  $ tstop
   $ hg clone main subset2 --rev name2
   adding changesets
   adding manifests
@@ -237,7 +237,7 @@
   added 6 changesets with 12 changes to 2 files
   updating to branch name2
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ start subset2
+  $ tstart subset2
   $ cd main
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -279,7 +279,7 @@
 
 Partial pull:
 
-  $ stop ; start main
+  $ tstop ; tstart main
   $ hg clone $remote partial --rev name2
   adding changesets
   adding manifests
@@ -321,12 +321,12 @@
 
 Both have new stuff in new named branches:
 
-  $ stop
+  $ tstop
   $ hg clone main repo1a --rev name1 -q
   $ hg clone repo1a repo1b -q
   $ hg clone main repo2a --rev name2 -q
   $ hg clone repo2a repo2b -q
-  $ start repo1a
+  $ tstart repo1a
 
   $ cd repo2a
   $ hg incoming $remote
@@ -369,7 +369,7 @@
   [1]
   $ cd ..
 
-  $ stop ; start repo1b
+  $ tstop ; tstart repo1b
   $ cd repo2b
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -413,13 +413,13 @@
 
 Both have new stuff in existing named branches:
 
-  $ stop
+  $ tstop
   $ rm -r repo1a repo1b repo2a repo2b
   $ hg clone main repo1a --rev 3 --rev 8 -q
   $ hg clone repo1a repo1b -q
   $ hg clone main repo2a --rev 4 --rev 7 -q
   $ hg clone repo2a repo2b -q
-  $ start repo1a
+  $ tstart repo1a
 
   $ cd repo2a
   $ hg incoming $remote
@@ -457,7 +457,7 @@
   [1]
   $ cd ..
 
-  $ stop ; start repo1b
+  $ tstop ; tstart repo1b
   $ cd repo2b
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -494,5 +494,5 @@
   [1]
   $ cd ..
 
-  $ stop
+  $ tstop