[PATCH STABLE] treediscovery: rename stop() in tests to fix failures on AIX

Jim Hague jim.hague at acm.org
Tue Jul 5 05:56:39 CDT 2011


# HG changeset patch
# User Jim Hague <jim.hague at acm.org>
# Date 1309863212 -3600
# Branch stable
# Node ID 6be9b0a22acf6a1c7c305ccd55fc82d343fc62a5
# Parent  24ecdbe7c5c80fe24786a71c33e3706ed747ee88
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.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -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
   []
diff --git a/tests/test-treediscovery-legacy.t b/tests/test-treediscovery-legacy.t
--- a/tests/test-treediscovery-legacy.t
+++ b/tests/test-treediscovery-legacy.t
@@ -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
 
diff --git a/tests/test-treediscovery.t b/tests/test-treediscovery.t
--- a/tests/test-treediscovery.t
+++ b/tests/test-treediscovery.t
@@ -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
 


More information about the Mercurial-devel mailing list