# HG changeset patch # User Matt Mackall # Date 2010-09-21 21:00:02 # Node ID 22f3353bcc3613149da02ca5f12aa5755ba6761e # Parent e128fa4615f2ae7e5674c4e5dcbd2fe5cd3f27ba tests: cleanup exit code handling in unified tests diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -20,7 +20,7 @@ $ hg st A a ? b - $ hg add b || echo "failed to add b" + $ hg add b $ hg st A a A b diff --git a/tests/test-bad-pull.t b/tests/test-bad-pull.t --- a/tests/test-bad-pull.t +++ b/tests/test-bad-pull.t @@ -2,9 +2,6 @@ abort: error: Connection refused [255] - $ echo $? - 0 - $ test -d copy || echo copy: No such file or directory copy: No such file or directory @@ -30,7 +27,4 @@ give the server some time to start runni abort: HTTP Error 404: .* [255] - $ echo $? - 0 - $ kill $! diff --git a/tests/test-bheads.t b/tests/test-bheads.t --- a/tests/test-bheads.t +++ b/tests/test-bheads.t @@ -133,34 +133,22 @@ $ heads -r 3 . no open branch heads found on branches c (started at 3) [1] - $ echo $? - 0 $ heads -r 2 . 7: Adding c branch (c) - $ echo $? - 0 ------- $ hg update -C 4 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ echo $? - 0 ------- $ heads -r 3 . 3: Adding b branch head 1 (b) - $ echo $? - 0 ------- $ heads -r 2 . 6: Merging b branch head 2 and b branch head 3 (b) 3: Adding b branch head 1 (b) - $ echo $? - 0 ------- $ heads -r 7 . no open branch heads found on branches b (started at 7) [1] - $ echo $? - 0 ======= diff --git a/tests/test-bisect.t b/tests/test-bisect.t --- a/tests/test-bisect.t +++ b/tests/test-bisect.t @@ -1,4 +1,3 @@ - $ set -e $ hg init @@ -270,12 +269,14 @@ skip date: Thu Jan 01 00:00:01 1970 +0000 summary: msg 1 + $ false + [1] + $ hg bisect -r $ hg bisect -g tip - $ hg bisect -b tip || echo error + $ hg bisect -b tip abort: starting revisions are not directly related - error $ hg bisect -r $ hg bisect -g null @@ -346,9 +347,8 @@ reproduce non converging bisect, issue11 test no action $ hg bisect -r - $ hg bisect || echo failure + $ hg bisect abort: cannot bisect (no known good revisions) - failure reproduce AssertionError, issue1445 diff --git a/tests/test-bundle-vs-outgoing.t b/tests/test-bundle-vs-outgoing.t --- a/tests/test-bundle-vs-outgoing.t +++ b/tests/test-bundle-vs-outgoing.t @@ -27,8 +27,6 @@ o 0 > hg -q ci -m"rev $revno" > } - $ set -e - setup test repo1 $ hg init repo1 diff --git a/tests/test-git-import.t b/tests/test-git-import.t --- a/tests/test-git-import.t +++ b/tests/test-git-import.t @@ -43,7 +43,7 @@ chmod +x: $ hg tip -q 2:3a34410f282e - $ test -x new || echo failed + $ test -x new Copy: @@ -65,10 +65,10 @@ Copy: 3:37bacb7ca14d $ if "$TESTDIR/hghave" -q execbit; then - > test -f copy -a ! -x copy || echo failed - > test -x copyx || echo failed + > test -f copy -a ! -x copy || echo bad + > test -x copyx || echo bad > else - > test -f copy || echo failed + > test -f copy || echo bad > fi $ cat copy @@ -117,7 +117,8 @@ Delete: new rename - $ test -f copyx && echo failed || true + $ test -f copyx + [1] Regular diff: diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -71,8 +71,6 @@ o (0) root $ "$TESTDIR/hghave" no-outer-repo || exit 80 - $ set -e - $ commit() > { > rev=$1 @@ -681,12 +679,12 @@ File glog: Unused arguments: - $ hg glog -q foo bar || echo failed + $ hg glog -q foo bar hg glog: invalid arguments hg glog [OPTION]... [FILE] show revision history alongside an ASCII revision graph - failed + [255] Empty revision range - display nothing: $ hg glog -r 1..0 diff --git a/tests/test-locate.t b/tests/test-locate.t --- a/tests/test-locate.t +++ b/tests/test-locate.t @@ -22,12 +22,11 @@ $ touch nottracked - $ hg locate a && echo locate succeeded || echo locate failed + $ hg locate a a - locate succeeded - $ hg locate NONEXISTENT && echo locate succeeded || echo locate failed - locate failed + $ hg locate NONEXISTENT + [1] $ hg locate a diff --git a/tests/test-merge-prompt.t b/tests/test-merge-prompt.t --- a/tests/test-merge-prompt.t +++ b/tests/test-merge-prompt.t @@ -6,7 +6,6 @@ 840e2b315c1f: Fix misleading error and p (issue556) $ status() { - > [ $? -ne 0 ] && echo "failed." > echo "--- status ---" > hg st -A file1 file2 > for file in file1 file2; do @@ -42,7 +41,7 @@ 840e2b315c1f: Fix misleading error and p Non-interactive merge: - $ hg merge -y || echo "failed" + $ hg merge -y local changed file1 which remote deleted use (c)hanged version or (d)elete? c remote changed file2 which local deleted @@ -67,7 +66,7 @@ Interactive merge: $ hg co -C 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg merge --config ui.interactive=true < c > d > EOF @@ -91,7 +90,7 @@ Interactive merge with bad input: $ hg co -C 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg merge --config ui.interactive=true < foo > bar > d @@ -124,13 +123,13 @@ Interactive merge with not enough input: $ hg co -C 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg merge --config ui.interactive=true < d > EOF local changed file1 which remote deleted use (c)hanged version or (d)elete? remote changed file2 which local deleted use (c)hanged version or leave (d)eleted? abort: response expected - failed + [255] $ status --- status --- diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -204,8 +204,7 @@ init --mq with repo path $ hg init g $ hg init --mq g - $ test -d g/.hg/patches/.hg && echo "ok" || echo "failed" - ok + $ test -d g/.hg/patches/.hg init --mq with nonexistent directory @@ -633,14 +632,6 @@ push should succeed added 1 changesets with 1 changes to 1 files -qpush/qpop error codes - - $ errorcode() - > { - > hg "$@" && echo " $@ succeeds" || echo " $@ fails" - > } - - we want to start with some patches applied $ hg qpush -a @@ -651,105 +642,92 @@ we want to start with some patches appli % pops all patches and succeeds - $ errorcode qpop -a + $ hg qpop -a popping test2.patch popping test1b.patch popping test.patch patch queue now empty - qpop -a succeeds % does nothing and succeeds - $ errorcode qpop -a + $ hg qpop -a no patches applied - qpop -a succeeds % fails - nothing else to pop - $ errorcode qpop + $ hg qpop no patches applied - qpop fails + [1] % pushes a patch and succeeds - $ errorcode qpush + $ hg qpush applying test.patch now at: test.patch - qpush succeeds % pops a patch and succeeds - $ errorcode qpop + $ hg qpop popping test.patch patch queue now empty - qpop succeeds % pushes up to test1b.patch and succeeds - $ errorcode qpush test1b.patch + $ hg qpush test1b.patch applying test.patch applying test1b.patch now at: test1b.patch - qpush test1b.patch succeeds % does nothing and succeeds - $ errorcode qpush test1b.patch + $ hg qpush test1b.patch qpush: test1b.patch is already at the top - qpush test1b.patch succeeds % does nothing and succeeds - $ errorcode qpop test1b.patch + $ hg qpop test1b.patch qpop: test1b.patch is already at the top - qpop test1b.patch succeeds % fails - can't push to this patch - $ errorcode qpush test.patch + $ hg qpush test.patch abort: cannot push to a previous patch: test.patch - qpush test.patch fails + [255] % fails - can't pop to this patch - $ errorcode qpop test2.patch + $ hg qpop test2.patch abort: patch test2.patch is not applied - qpop test2.patch fails + [255] % pops up to test.patch and succeeds - $ errorcode qpop test.patch + $ hg qpop test.patch popping test1b.patch now at: test.patch - qpop test.patch succeeds % pushes all patches and succeeds - $ errorcode qpush -a + $ hg qpush -a applying test1b.patch applying test2.patch now at: test2.patch - qpush -a succeeds % does nothing and succeeds - $ errorcode qpush -a + $ hg qpush -a all patches are currently applied - qpush -a succeeds % fails - nothing else to push - $ errorcode qpush + $ hg qpush patch series already fully applied - qpush fails + [1] % does nothing and succeeds - $ errorcode qpush test2.patch + $ hg qpush test2.patch qpush: test2.patch is already at the top - qpush test2.patch succeeds - - strip @@ -1087,7 +1065,7 @@ check binary patches can be popped and p $ hg qpush applying addbucephalus now at: addbucephalus - $ test -f bucephalus || echo % bucephalus should be there + $ test -f bucephalus $ python "$TESTDIR/md5sum.py" bucephalus 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus diff --git a/tests/test-parse-date.t b/tests/test-parse-date.t --- a/tests/test-parse-date.t +++ b/tests/test-parse-date.t @@ -91,7 +91,7 @@ Test 12-hours times $ hg debugdate "2006-02-01 1:00:30PM +0000" internal: 1138798830 0 standard: Wed Feb 01 13:00:30 2006 +0000 - $ hg debugdate "1:00:30PM" > /dev/null || echo 'failed' + $ hg debugdate "1:00:30PM" > /dev/null Test date formats with '>' or '<' accompanied by space characters diff --git a/tests/test-permissions.t b/tests/test-permissions.t --- a/tests/test-permissions.t +++ b/tests/test-permissions.t @@ -15,17 +15,17 @@ $ chmod -r .hg/store/data/a.i - $ hg verify || echo %%% verify failed + $ hg verify checking changesets checking manifests crosschecking files in changesets and manifests checking files abort: Permission denied: .* - %%% verify failed + [255] $ chmod +r .hg/store/data/a.i - $ hg verify || echo %%% verify failed + $ hg verify checking changesets checking manifests crosschecking files in changesets and manifests @@ -35,10 +35,10 @@ $ chmod -w .hg/store/data/a.i $ echo barber > a - $ hg commit -m "2" || echo %%% commit failed + $ hg commit -m "2" trouble committing a! abort: Permission denied: .* - %%% commit failed + [255] $ chmod -w . diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t --- a/tests/test-push-warn.t +++ b/tests/test-push-warn.t @@ -92,50 +92,47 @@ $ hg ci -m c-d - $ hg push ../c; echo $? + $ hg push ../c pushing to ../c searching for changes abort: push creates new remote heads on branch 'default'! (did you forget to merge? use push -f to force) - 255 + [255] - $ hg push -r 2 ../c; echo $? + $ hg push -r 2 ../c pushing to ../c searching for changes no changes found - 0 - $ hg push -r 3 ../c; echo $? + $ hg push -r 3 ../c pushing to ../c searching for changes abort: push creates new remote heads on branch 'default'! (did you forget to merge? use push -f to force) - 255 + [255] - $ hg push -r 3 -r 4 ../c; echo $? + $ hg push -r 3 -r 4 ../c pushing to ../c searching for changes abort: push creates new remote heads on branch 'default'! (did you forget to merge? use push -f to force) - 255 + [255] - $ hg push -f -r 3 -r 4 ../c; echo $? + $ hg push -f -r 3 -r 4 ../c pushing to ../c searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files (+2 heads) - 0 - $ hg push -r 5 ../c; echo $? + $ hg push -r 5 ../c pushing to ../c searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (-1 heads) - 0 $ hg in ../c comparing with ../c @@ -147,23 +144,21 @@ Issue 450: $ hg init ../e - $ hg push -r 0 ../e ; echo $? + $ hg push -r 0 ../e pushing to ../e searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 0 - $ hg push -r 1 ../e ; echo $? + $ hg push -r 1 ../e pushing to ../e searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 0 $ cd .. @@ -199,19 +194,19 @@ Push on existing branch and new branch: $ hg -q branch c $ hg -q ci -m 5 - $ hg push ../f; echo $? + $ hg push ../f pushing to ../f searching for changes abort: push creates new remote branches: c! (use 'hg push --new-branch' to create new remote branches) - 255 + [255] - $ hg push -r 4 -r 5 ../f; echo $? + $ hg push -r 4 -r 5 ../f pushing to ../f searching for changes abort: push creates new remote branches: c! (use 'hg push --new-branch' to create new remote branches) - 255 + [255] Multiple new branches: @@ -220,19 +215,19 @@ Multiple new branches: $ echo 6 > foo $ hg -q ci -m 6 - $ hg push ../f; echo $? + $ hg push ../f pushing to ../f searching for changes abort: push creates new remote branches: c, d! (use 'hg push --new-branch' to create new remote branches) - 255 + [255] - $ hg push -r 4 -r 6 ../f; echo $? + $ hg push -r 4 -r 6 ../f pushing to ../f searching for changes abort: push creates new remote branches: c, d! (use 'hg push --new-branch' to create new remote branches) - 255 + [255] $ cd ../g @@ -243,12 +238,12 @@ Fail on multiple head push: $ echo 7 > foo $ hg -q ci -m 7 - $ hg push -r 4 -r 7 ../f; echo $? + $ hg push -r 4 -r 7 ../f pushing to ../f searching for changes abort: push creates new remote heads on branch 'a'! (did you forget to merge? use push -f to force) - 255 + [255] Push replacement head on existing branches: @@ -256,14 +251,13 @@ Push replacement head on existing branch $ echo 8 > foo $ hg -q ci -m 8 - $ hg push -r 7 -r 8 ../f; echo $? + $ hg push -r 7 -r 8 ../f pushing to ../f searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files - 0 Merge of branch a to other branch b followed by unrelated push @@ -276,23 +270,21 @@ on branch a: $ echo 10 > foo $ hg -q ci -m 10 - $ hg push -r 9 ../f; echo $? + $ hg push -r 9 ../f pushing to ../f searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (-1 heads) - 0 - $ hg push -r 10 ../f; echo $? + $ hg push -r 10 ../f pushing to ../f searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 0 Cheating the counting algorithm: @@ -304,14 +296,13 @@ Cheating the counting algorithm: $ echo 12 > foo $ hg -q ci -m 12 - $ hg push -r 11 -r 12 ../f; echo $? + $ hg push -r 11 -r 12 ../f pushing to ../f searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files - 0 Failed push of new named branch: @@ -324,24 +315,23 @@ Failed push of new named branch: $ hg -q branch e $ hg -q ci -m 13d - $ hg push -r 12 -r 13 ../f; echo $? + $ hg push -r 12 -r 13 ../f pushing to ../f searching for changes abort: push creates new remote branches: e! (use 'hg push --new-branch' to create new remote branches) - 255 + [255] Using --new-branch to push new named branch: - $ hg push --new-branch -r 12 -r 13 ../f; echo $? + $ hg push --new-branch -r 12 -r 13 ../f pushing to ../f searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 0 Checking prepush logic does not allow silently pushing diff --git a/tests/test-remove.t b/tests/test-remove.t --- a/tests/test-remove.t +++ b/tests/test-remove.t @@ -1,6 +1,6 @@ $ remove() { > hg rm $@ - > echo "exit code: $?" + > echo "exit code: $?" # no-check-code > hg st > # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5 > find . -name .hg -prune -o -type f -print | sort diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t --- a/tests/test-simple-update.t +++ b/tests/test-simple-update.t @@ -1,5 +1,3 @@ - $ set -e - $ mkdir test $ cd test $ echo foo>foo diff --git a/tests/test-status-color.t b/tests/test-status-color.t --- a/tests/test-status-color.t +++ b/tests/test-status-color.t @@ -214,11 +214,10 @@ If result is not as expected, raise erro $ assert() { > hg status --color=always $1 > ../a > hg status --color=always $2 > ../b - > out=`diff ../a ../b` - > if [ $? -ne 0 ]; then + > if diff ../a ../b > /dev/null; then + > out=0 + > else > out=1 - > else - > out=0 > fi > if [ $3 -eq 0 ]; then > df="same" diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -196,13 +196,12 @@ Check if result is the same or different If result is not as expected, raise error $ assert() { - > hg status $1 > ../a - > hg status $2 > ../b - > out=`diff ../a ../b` - > if [ $? -ne 0 ]; then + > hg status $1 > ../a + > hg status $2 > ../b + > if diff ../a ../b > /dev/null; then + > out=0 + > else > out=1 - > else - > out=0 > fi > if [ $3 -eq 0 ]; then > df="same" diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -274,8 +274,6 @@ Clone and test outgoing: searching for changes no changes found [1] - $ echo $? - 0 Make nested change: diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t --- a/tests/test-subrepo-svn.t +++ b/tests/test-subrepo-svn.t @@ -10,10 +10,7 @@ SVN wants all paths to start with a slash. Unfortunately, Windows ones don't. Handle that. - $ expr "$escapedwd" : "\/" > /dev/null - $ if [ $? -ne 0 ]; then - > escapedwd="/$escapedwd" - > fi + $ expr "$escapedwd" : / > /dev/null || escapedwd="/$escapedwd" $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"` $ filterpath="s|$escapedwd|/root|" $ filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /' diff --git a/tests/test-tag.t b/tests/test-tag.t --- a/tests/test-tag.t +++ b/tests/test-tag.t @@ -32,30 +32,30 @@ $ echo foo >> .hgtags - $ hg tag "bleah2" || echo "failed" + $ hg tag "bleah2" abort: working copy of .hgtags is changed (please commit .hgtags manually) - failed + [255] $ hg revert .hgtags - $ hg tag -r 0 x y z y y z || echo "failed" + $ hg tag -r 0 x y z y y z abort: tag names must be unique - failed - $ hg tag tap nada dot tip null . || echo "failed" + [255] + $ hg tag tap nada dot tip null . abort: the name 'tip' is reserved - failed - $ hg tag "bleah" || echo "failed" + [255] + $ hg tag "bleah" abort: tag 'bleah' already exists (use -f to force) - failed - $ hg tag "blecch" "bleah" || echo "failed" + [255] + $ hg tag "blecch" "bleah" abort: tag 'bleah' already exists (use -f to force) - failed + [255] - $ hg tag --remove "blecch" || echo "failed" + $ hg tag --remove "blecch" abort: tag 'blecch' does not exist - failed - $ hg tag --remove "bleah" "blecch" "blough" || echo "failed" + [255] + $ hg tag --remove "bleah" "blecch" "blough" abort: tag 'blecch' does not exist - failed + [255] $ hg tag -r 0 "bleah0" $ hg tag -l -r 1 "bleah1" diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t --- a/tests/test-up-local-change.t +++ b/tests/test-up-local-change.t @@ -84,9 +84,9 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: 1 - $ hg --debug merge || echo failed + $ hg --debug merge abort: there is nothing to merge - use "hg update" instead - failed + [255] $ hg parents changeset: 0:c19d34741b0a user: test @@ -166,12 +166,12 @@ create a second head date: Thu Jan 01 00:00:00 1970 +0000 summary: 2 - $ hg --debug up || echo failed + $ hg --debug up abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes) - failed - $ hg --debug merge || echo failed + [255] + $ hg --debug merge abort: outstanding uncommitted changes (use 'hg status' to list changes) - failed + [255] $ hg --debug merge -f searching for copies back to rev 1 resolving manifests