Mercurial > hg-stable
changeset 27395:0622d6e134fb
tests: avoid duplicate install steps in test-run-tests
At several seconds each, this is significantly slowing down the test.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 06 Dec 2015 15:14:01 -0600 |
parents | b4d7743e174a |
children | 64c584070fc7 |
files | tests/test-run-tests.t |
diffstat | 1 files changed, 45 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-run-tests.t Fri Dec 04 17:05:20 2015 -0600 +++ b/tests/test-run-tests.t Sun Dec 06 15:14:01 2015 -0600 @@ -7,13 +7,20 @@ $ unset HGTEST_PORT $ unset HGTEST_SHELL -Smoke test +Smoke test with install ============ - $ run-tests.py $HGTEST_RUN_TESTS_PURE + $ run-tests.py $HGTEST_RUN_TESTS_PURE -l # Ran 0 tests, 0 skipped, 0 warned, 0 failed. +Define a helper to avoid the install step +============= + $ rt() + > { + > run-tests.py --with-hg=`which hg` "$@" + > } + a succesful test ======================= @@ -26,7 +33,7 @@ > nor this (?) > EOF - $ run-tests.py --with-hg=`which hg` + $ rt . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. @@ -44,7 +51,7 @@ >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None - $ run-tests.py --with-hg=`which hg` + $ rt --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -73,7 +80,7 @@ [1] test --xunit support - $ run-tests.py --with-hg=`which hg` --xunit=xunit.xml + $ rt --xunit=xunit.xml --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -129,7 +136,7 @@ test for --retest ==================== - $ run-tests.py --with-hg=`which hg` --retest + $ rt --retest --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -152,18 +159,18 @@ successful - $ run-tests.py --with-hg=`which hg` test-success.t + $ rt test-success.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. success w/ keyword - $ run-tests.py --with-hg=`which hg` -k xyzzy + $ rt -k xyzzy . # Ran 2 tests, 1 skipped, 0 warned, 0 failed. failed - $ run-tests.py --with-hg=`which hg` test-failure.t + $ rt test-failure.t --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -182,7 +189,7 @@ [1] failure w/ keyword - $ run-tests.py --with-hg=`which hg` -k rataxes + $ rt -k rataxes --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -208,7 +215,7 @@ $ cat > test-serve-fail.t <<EOF > $ echo 'abort: child process failed to start blah' > EOF - $ run-tests.py --with-hg=`which hg` test-serve-fail.t + $ rt test-serve-fail.t ERROR: test-serve-fail.t output changed ! @@ -224,7 +231,7 @@ Running In Debug Mode ====================== - $ run-tests.py --with-hg=`which hg` --debug 2>&1 | grep -v pwd + $ rt --debug 2>&1 | grep -v pwd + echo *SALT* 0 0 (glob) *SALT* 0 0 (glob) + echo babar @@ -250,7 +257,7 @@ (duplicate the failing test to get predictable output) $ cp test-failure.t test-failure-copy.t - $ run-tests.py --with-hg=`which hg` --jobs 2 test-failure*.t -n + $ rt --jobs 2 test-failure*.t -n !! Failed test-failure*.t: output changed (glob) Failed test-failure*.t: output changed (glob) @@ -262,7 +269,7 @@ >>> f = open('test-nothing.t', 'w') >>> f.write('foo\n' * 1024) and None >>> f.write(' $ sleep 1') and None - $ run-tests.py --with-hg=`which hg` --jobs 2 --first + $ rt --jobs 2 --first --- $TESTTMP/test-failure*.t (glob) +++ $TESTTMP/test-failure*.t.err (glob) @@ -292,7 +299,7 @@ Refuse the fix - $ echo 'n' | run-tests.py --with-hg=`which hg` -i + $ echo 'n' | rt -i --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -318,7 +325,7 @@ Interactive with custom view - $ echo 'n' | run-tests.py --with-hg=`which hg` -i --view echo + $ echo 'n' | rt -i --view echo $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob) Accept this change? [n]* (glob) ERROR: test-failure.t output changed @@ -330,7 +337,7 @@ View the fix - $ echo 'y' | run-tests.py --with-hg=`which hg` --view echo + $ echo 'y' | rt --view echo $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob) ERROR: test-failure.t output changed @@ -348,8 +355,7 @@ $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t - $ echo 'y' | run-tests.py --with-hg=`which hg` -i 2>&1 | \ - > sed -e 's,(glob)$,&<,g' + $ echo 'y' | rt -i 2>&1 --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -361,9 +367,9 @@ this test is still more bytes than success. $ echo 'saved backup bundle to $TESTTMP/foo.hg' - saved backup bundle to $TESTTMP/foo.hg - + saved backup bundle to $TESTTMP/foo.hg (glob)< + + saved backup bundle to $TESTTMP/foo.hg* (glob) $ echo 'saved backup bundle to $TESTTMP/foo.hg' - saved backup bundle to $TESTTMP/foo.hg (glob)< + saved backup bundle to $TESTTMP/foo.hg* (glob) $ echo 'saved backup bundle to $TESTTMP/foo.hg' Accept this change? [n] .. # Ran 2 tests, 0 skipped, 0 warned, 0 failed. @@ -386,7 +392,7 @@ No Diff =============== - $ run-tests.py --with-hg=`which hg` --nodiff + $ rt --nodiff !. Failed test-failure.t: output changed # Ran 2 tests, 0 skipped, 0 warned, 1 failed. @@ -394,7 +400,7 @@ [1] test --tmpdir support - $ run-tests.py --with-hg=`which hg` --tmpdir=$TESTTMP/keep test-success.t + $ rt --tmpdir=$TESTTMP/keep test-success.t Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob) Keeping threadtmp dir: $TESTTMP/keep/child1 (glob) @@ -410,15 +416,14 @@ > EOF > echo '#require slow' > test-slow-timeout.t > cat test-timeout.t >> test-slow-timeout.t - $ run-tests.py --with-hg=`which hg` --timeout=1 --slowtimeout=3 \ - > test-timeout.t test-slow-timeout.t + $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t st Skipped test-slow-timeout.t: skipped Failed test-timeout.t: timed out # Ran 1 tests, 1 skipped, 0 warned, 1 failed. python hash seed: * (glob) [1] - $ run-tests.py --with-hg=`which hg` --timeout=1 --slowtimeout=3 \ + $ rt --timeout=1 --slowtimeout=3 \ > test-timeout.t test-slow-timeout.t --allow-slow-tests .t Failed test-timeout.t: timed out @@ -430,7 +435,7 @@ test for --time ================== - $ run-tests.py --with-hg=`which hg` test-success.t --time + $ rt test-success.t --time . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. # Producing time report @@ -440,7 +445,7 @@ test for --time with --job enabled ==================================== - $ run-tests.py --with-hg=`which hg` test-success.t --time --jobs 2 + $ rt test-success.t --time --jobs 2 . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. # Producing time report @@ -453,7 +458,7 @@ > $ echo xyzzy > #require false > EOF - $ run-tests.py --with-hg=`which hg` --nodiff + $ rt --nodiff !.s Skipped test-skip.t: skipped Failed test-failure.t: output changed @@ -461,13 +466,13 @@ python hash seed: * (glob) [1] - $ run-tests.py --with-hg=`which hg` --keyword xyzzy + $ rt --keyword xyzzy .s Skipped test-skip.t: skipped # Ran 2 tests, 2 skipped, 0 warned, 0 failed. Skips with xml - $ run-tests.py --with-hg=`which hg` --keyword xyzzy \ + $ rt --keyword xyzzy \ > --xunit=xunit.xml .s Skipped test-skip.t: skipped @@ -480,7 +485,7 @@ Missing skips or blacklisted skips don't count as executed: $ echo test-failure.t > blacklist - $ run-tests.py --with-hg=`which hg` --blacklist=blacklist \ + $ rt --blacklist=blacklist \ > test-failure.t test-bogus.t ss Skipped test-bogus.t: Doesn't exist @@ -492,7 +497,7 @@ test for --json ================== - $ run-tests.py --with-hg=`which hg` --json + $ rt --json --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -542,7 +547,7 @@ Test that failed test accepted through interactive are properly reported: $ cp test-failure.t backup - $ echo y | run-tests.py --with-hg=`which hg` --json -i + $ echo y | rt --json -i --- $TESTTMP/test-failure.t +++ $TESTTMP/test-failure.t.err @@ -594,7 +599,7 @@ > foo * \ (glob) > EOF - $ run-tests.py --with-hg=`which hg` test-glob-backslash.t + $ rt test-glob-backslash.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. @@ -614,7 +619,7 @@ > $ echo foo > foo > EOF - $ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghave.t + $ rt $HGTEST_RUN_TESTS_PURE test-hghave.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. @@ -637,7 +642,7 @@ > # > # check-code - a style and portability checker for Mercurial > EOF - $ run-tests.py $HGTEST_RUN_TESTS_PURE test-runtestdir.t + $ rt $HGTEST_RUN_TESTS_PURE test-runtestdir.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. @@ -654,7 +659,7 @@ > $ custom-command.sh > hello world > EOF - $ run-tests.py $HGTEST_RUN_TESTS_PURE test-testdir-path.t + $ rt $HGTEST_RUN_TESTS_PURE test-testdir-path.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. @@ -666,10 +671,10 @@ > $ echo pass > pass > EOF - $ run-tests.py $HGTEST_RUN_TESTS_PURE test-very-slow-test.t + $ rt $HGTEST_RUN_TESTS_PURE test-very-slow-test.t s Skipped test-very-slow-test.t: skipped # Ran 0 tests, 1 skipped, 0 warned, 0 failed. - $ run-tests.py $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t + $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t . # Ran 1 tests, 0 skipped, 0 warned, 0 failed.