Mercurial > hg-stable
changeset 12365:22f3353bcc36
tests: cleanup exit code handling in unified tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 21 Sep 2010 16:00:02 -0500 |
parents | e128fa4615f2 |
children | c01dc9087d9a |
files | tests/test-add.t tests/test-bad-pull.t tests/test-bheads.t tests/test-bisect.t tests/test-bundle-vs-outgoing.t tests/test-git-import.t tests/test-glog.t tests/test-locate.t tests/test-merge-prompt.t tests/test-mq.t tests/test-parse-date.t tests/test-permissions.t tests/test-push-warn.t tests/test-remove.t tests/test-simple-update.t tests/test-status-color.t tests/test-status.t tests/test-subrepo-recursion.t tests/test-subrepo-svn.t tests/test-tag.t tests/test-up-local-change.t |
diffstat | 21 files changed, 107 insertions(+), 171 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-add.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-add.t Tue Sep 21 16:00:02 2010 -0500 @@ -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
--- a/tests/test-bad-pull.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-bad-pull.t Tue Sep 21 16:00:02 2010 -0500 @@ -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 @@ abort: HTTP Error 404: .* [255] - $ echo $? - 0 - $ kill $!
--- a/tests/test-bheads.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-bheads.t Tue Sep 21 16:00:02 2010 -0500 @@ -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 =======
--- a/tests/test-bisect.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-bisect.t Tue Sep 21 16:00:02 2010 -0500 @@ -1,4 +1,3 @@ - $ set -e $ hg init @@ -270,12 +269,14 @@ 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 @@ test no action $ hg bisect -r - $ hg bisect || echo failure + $ hg bisect abort: cannot bisect (no known good revisions) - failure reproduce AssertionError, issue1445
--- a/tests/test-bundle-vs-outgoing.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-bundle-vs-outgoing.t Tue Sep 21 16:00:02 2010 -0500 @@ -27,8 +27,6 @@ > hg -q ci -m"rev $revno" > } - $ set -e - setup test repo1 $ hg init repo1
--- a/tests/test-git-import.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-git-import.t Tue Sep 21 16:00:02 2010 -0500 @@ -43,7 +43,7 @@ $ hg tip -q 2:3a34410f282e - $ test -x new || echo failed + $ test -x new Copy: @@ -65,10 +65,10 @@ 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 @@ new rename - $ test -f copyx && echo failed || true + $ test -f copyx + [1] Regular diff:
--- a/tests/test-glog.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-glog.t Tue Sep 21 16:00:02 2010 -0500 @@ -71,8 +71,6 @@ $ "$TESTDIR/hghave" no-outer-repo || exit 80 - $ set -e - $ commit() > { > rev=$1 @@ -681,12 +679,12 @@ 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
--- a/tests/test-locate.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-locate.t Tue Sep 21 16:00:02 2010 -0500 @@ -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
--- a/tests/test-merge-prompt.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-merge-prompt.t Tue Sep 21 16:00:02 2010 -0500 @@ -6,7 +6,6 @@ (issue556) $ status() { - > [ $? -ne 0 ] && echo "failed." > echo "--- status ---" > hg st -A file1 file2 > for file in file1 file2; do @@ -42,7 +41,7 @@ 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 @@ $ hg co -C 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg merge --config ui.interactive=true <<EOF || echo "failed" + $ hg merge --config ui.interactive=true <<EOF > c > d > EOF @@ -91,7 +90,7 @@ $ hg co -C 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg merge --config ui.interactive=true <<EOF || echo "failed" + $ hg merge --config ui.interactive=true <<EOF > foo > bar > d @@ -124,13 +123,13 @@ $ hg co -C 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg merge --config ui.interactive=true <<EOF || echo "failed" + $ hg merge --config ui.interactive=true <<EOF > 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 ---
--- a/tests/test-mq.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-mq.t Tue Sep 21 16:00:02 2010 -0500 @@ -204,8 +204,7 @@ $ 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 @@ 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 @@ % 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 @@ $ 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
--- a/tests/test-parse-date.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-parse-date.t Tue Sep 21 16:00:02 2010 -0500 @@ -91,7 +91,7 @@ $ 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
--- a/tests/test-permissions.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-permissions.t Tue Sep 21 16:00:02 2010 -0500 @@ -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 .
--- a/tests/test-push-warn.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-push-warn.t Tue Sep 21 16:00:02 2010 -0500 @@ -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 @@ $ 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 @@ $ 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 @@ $ 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 @@ $ 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 @@ $ 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 @@ $ 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 @@ $ 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
--- a/tests/test-remove.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-remove.t Tue Sep 21 16:00:02 2010 -0500 @@ -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
--- a/tests/test-simple-update.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-simple-update.t Tue Sep 21 16:00:02 2010 -0500 @@ -1,5 +1,3 @@ - $ set -e - $ mkdir test $ cd test $ echo foo>foo
--- a/tests/test-status-color.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-status-color.t Tue Sep 21 16:00:02 2010 -0500 @@ -214,11 +214,10 @@ $ 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"
--- a/tests/test-status.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-status.t Tue Sep 21 16:00:02 2010 -0500 @@ -196,13 +196,12 @@ 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"
--- a/tests/test-subrepo-recursion.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-subrepo-recursion.t Tue Sep 21 16:00:02 2010 -0500 @@ -274,8 +274,6 @@ searching for changes no changes found [1] - $ echo $? - 0 Make nested change:
--- a/tests/test-subrepo-svn.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-subrepo-svn.t Tue Sep 21 16:00:02 2010 -0500 @@ -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 /'
--- a/tests/test-tag.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-tag.t Tue Sep 21 16:00:02 2010 -0500 @@ -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"
--- a/tests/test-up-local-change.t Tue Sep 21 12:41:24 2010 -0500 +++ b/tests/test-up-local-change.t Tue Sep 21 16:00:02 2010 -0500 @@ -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 @@ 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