2014-05-30 23:09:49 +04:00
|
|
|
This file tests the behavior of run-tests.py itself.
|
|
|
|
|
2015-05-08 21:32:24 +03:00
|
|
|
Avoid interference from actual test env:
|
|
|
|
|
2016-05-11 19:40:16 +03:00
|
|
|
$ . "$TESTDIR/helper-runtests.sh"
|
2015-05-08 21:32:24 +03:00
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
Smoke test with install
|
2014-05-30 23:09:49 +04:00
|
|
|
============
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ run-tests.py $HGTEST_RUN_TESTS_PURE -l
|
2014-05-30 23:09:49 +04:00
|
|
|
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 0 tests, 0 skipped, 0 failed.
|
2014-05-30 23:10:19 +04:00
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
Define a helper to avoid the install step
|
|
|
|
=============
|
|
|
|
$ rt()
|
|
|
|
> {
|
|
|
|
> run-tests.py --with-hg=`which hg` "$@"
|
|
|
|
> }
|
|
|
|
|
2016-02-09 01:50:19 +03:00
|
|
|
error paths
|
|
|
|
|
|
|
|
#if symlink
|
|
|
|
$ ln -s `which true` hg
|
|
|
|
$ run-tests.py --with-hg=./hg
|
|
|
|
warning: --with-hg should specify an hg script
|
|
|
|
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 0 tests, 0 skipped, 0 failed.
|
2016-02-09 01:50:19 +03:00
|
|
|
$ rm hg
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if execbit
|
|
|
|
$ touch hg
|
|
|
|
$ run-tests.py --with-hg=./hg
|
|
|
|
Usage: run-tests.py [options] [tests]
|
|
|
|
|
|
|
|
run-tests.py: error: --with-hg must specify an executable hg script
|
|
|
|
[2]
|
|
|
|
$ rm hg
|
|
|
|
#endif
|
|
|
|
|
run-tests: support per-line conditional output in tests
Duplicating entire tests just because the output is different is both error
prone and can make the tests harder to read. This harnesses the existing '(?)'
infrastructure, both to improve readability, and because it seemed like the path
of least resistance.
The form is:
$ test_cmd
output (hghave-feature !) # required if hghave.has_feature(), else optional
out2 (no-hghave-feature2 !) # req if not hghave.has_feature2(), else optional
I originally extended the '(?)' syntax. For example, this:
2 r4/.hg/cache/checkisexec (execbit ?)
pretty naturally reads as "checkisexec, if execbit". In some ways though, this
inverts the meaning of '?'. For '(?)', the line is purely optional. In the
example, it is mandatory iff execbit. Otherwise, it is carried forward as
optional, to preserve the test output. I tried it the other way, (listing
'no-exec' in the example), but that is too confusing to read. Kostia suggested
using '!', and that seems fine.
2017-04-06 06:17:27 +03:00
|
|
|
Features for testing optional lines
|
|
|
|
===================================
|
|
|
|
|
|
|
|
$ cat > hghaveaddon.py <<EOF
|
|
|
|
> import hghave
|
|
|
|
> @hghave.check("custom", "custom hghave feature")
|
|
|
|
> def has_custom():
|
|
|
|
> return True
|
|
|
|
> @hghave.check("missing", "missing hghave feature")
|
|
|
|
> def has_missing():
|
|
|
|
> return False
|
|
|
|
> EOF
|
|
|
|
|
2016-04-05 07:26:20 +03:00
|
|
|
an empty test
|
|
|
|
=======================
|
|
|
|
|
|
|
|
$ touch test-empty.t
|
|
|
|
$ rt
|
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2016-04-05 07:26:20 +03:00
|
|
|
$ rm test-empty.t
|
|
|
|
|
2014-05-30 23:10:19 +04:00
|
|
|
a succesful test
|
|
|
|
=======================
|
|
|
|
|
|
|
|
$ cat > test-success.t << EOF
|
|
|
|
> $ echo babar
|
|
|
|
> babar
|
2014-07-29 04:54:14 +04:00
|
|
|
> $ echo xyzzy
|
2017-04-06 05:00:33 +03:00
|
|
|
> dont_print (?)
|
|
|
|
> nothing[42]line (re) (?)
|
2016-03-30 12:13:47 +03:00
|
|
|
> never*happens (glob) (?)
|
2017-04-06 05:00:33 +03:00
|
|
|
> more_nothing (?)
|
2014-07-29 04:54:14 +04:00
|
|
|
> xyzzy
|
2015-06-01 00:59:34 +03:00
|
|
|
> nor this (?)
|
2016-02-29 07:21:28 +03:00
|
|
|
> $ printf 'abc\ndef\nxyz\n'
|
|
|
|
> 123 (?)
|
|
|
|
> abc
|
|
|
|
> def (?)
|
|
|
|
> 456 (?)
|
|
|
|
> xyz
|
run-tests: support per-line conditional output in tests
Duplicating entire tests just because the output is different is both error
prone and can make the tests harder to read. This harnesses the existing '(?)'
infrastructure, both to improve readability, and because it seemed like the path
of least resistance.
The form is:
$ test_cmd
output (hghave-feature !) # required if hghave.has_feature(), else optional
out2 (no-hghave-feature2 !) # req if not hghave.has_feature2(), else optional
I originally extended the '(?)' syntax. For example, this:
2 r4/.hg/cache/checkisexec (execbit ?)
pretty naturally reads as "checkisexec, if execbit". In some ways though, this
inverts the meaning of '?'. For '(?)', the line is purely optional. In the
example, it is mandatory iff execbit. Otherwise, it is carried forward as
optional, to preserve the test output. I tried it the other way, (listing
'no-exec' in the example), but that is too confusing to read. Kostia suggested
using '!', and that seems fine.
2017-04-06 06:17:27 +03:00
|
|
|
> $ printf 'zyx\nwvu\ntsr\n'
|
|
|
|
> abc (?)
|
|
|
|
> zyx (custom !)
|
|
|
|
> wvu
|
|
|
|
> no_print (no-custom !)
|
|
|
|
> tsr (no-missing !)
|
|
|
|
> missing (missing !)
|
2014-05-30 23:10:19 +04:00
|
|
|
> EOF
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt
|
2014-05-30 23:10:19 +04:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2014-05-30 23:10:56 +04:00
|
|
|
|
|
|
|
failing test
|
|
|
|
==================
|
|
|
|
|
2016-03-21 23:56:46 +03:00
|
|
|
test churn with globs
|
|
|
|
$ cat > test-failure.t <<EOF
|
2017-11-29 21:34:49 +03:00
|
|
|
> $ echo "bar-baz"; echo "bar-bad"; echo foo
|
2016-03-21 23:56:46 +03:00
|
|
|
> bar*bad (glob)
|
|
|
|
> bar*baz (glob)
|
2017-11-29 21:34:49 +03:00
|
|
|
> | fo (re)
|
2016-03-21 23:56:46 +03:00
|
|
|
> EOF
|
|
|
|
$ rt test-failure.t
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2017-11-29 21:34:49 +03:00
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
$ echo "bar-baz"; echo "bar-bad"; echo foo
|
2016-03-21 23:56:46 +03:00
|
|
|
+ bar*baz (glob)
|
|
|
|
bar*bad (glob)
|
|
|
|
- bar*baz (glob)
|
2017-11-29 21:34:49 +03:00
|
|
|
- | fo (re)
|
|
|
|
+ foo
|
2016-03-21 23:56:46 +03:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
2016-03-21 23:56:46 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2017-06-29 14:45:12 +03:00
|
|
|
test diff colorisation
|
|
|
|
|
2017-07-14 23:47:05 +03:00
|
|
|
#if no-windows pygments
|
2017-06-29 14:45:12 +03:00
|
|
|
$ rt test-failure.t --color always
|
|
|
|
|
|
|
|
\x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
|
|
|
|
\x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
|
2017-11-29 21:34:49 +03:00
|
|
|
\x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
|
|
|
|
$ echo "bar-baz"; echo "bar-bad"; echo foo
|
2017-06-29 14:45:12 +03:00
|
|
|
\x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
|
|
|
|
bar*bad (glob)
|
|
|
|
\x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
|
2017-11-29 21:34:49 +03:00
|
|
|
\x1b[38;5;124m- | fo (re)\x1b[39m (esc)
|
|
|
|
\x1b[38;5;34m+ foo\x1b[39m (esc)
|
2017-10-17 20:33:27 +03:00
|
|
|
|
2017-08-11 15:21:49 +03:00
|
|
|
\x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
|
2017-06-29 14:45:12 +03:00
|
|
|
!
|
2017-08-11 15:21:49 +03:00
|
|
|
\x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
|
2017-06-29 14:45:12 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ rt test-failure.t 2> tmp.log
|
|
|
|
[1]
|
|
|
|
$ cat tmp.log
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2017-11-29 21:34:49 +03:00
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
$ echo "bar-baz"; echo "bar-bad"; echo foo
|
2017-06-29 14:45:12 +03:00
|
|
|
+ bar*baz (glob)
|
|
|
|
bar*bad (glob)
|
|
|
|
- bar*baz (glob)
|
2017-11-29 21:34:49 +03:00
|
|
|
- | fo (re)
|
|
|
|
+ foo
|
2017-06-29 14:45:12 +03:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
2017-07-15 07:52:36 +03:00
|
|
|
#endif
|
2017-06-29 14:45:12 +03:00
|
|
|
|
2017-07-18 07:12:44 +03:00
|
|
|
$ cat > test-failure.t << EOF
|
|
|
|
> $ true
|
|
|
|
> should go away (true !)
|
|
|
|
> $ true
|
|
|
|
> should stay (false !)
|
|
|
|
>
|
|
|
|
> Should remove first line, not second or third
|
|
|
|
> $ echo 'testing'
|
|
|
|
> baz*foo (glob) (true !)
|
|
|
|
> foobar*foo (glob) (false !)
|
|
|
|
> te*ting (glob) (true !)
|
|
|
|
>
|
|
|
|
> Should keep first two lines, remove third and last
|
|
|
|
> $ echo 'testing'
|
|
|
|
> test.ng (re) (true !)
|
|
|
|
> foo.ar (re) (false !)
|
|
|
|
> b.r (re) (true !)
|
|
|
|
> missing (?)
|
|
|
|
> awol (true !)
|
2017-07-18 07:57:11 +03:00
|
|
|
>
|
|
|
|
> The "missing" line should stay, even though awol is dropped
|
|
|
|
> $ echo 'testing'
|
|
|
|
> test.ng (re) (true !)
|
|
|
|
> foo.ar (?)
|
|
|
|
> awol
|
|
|
|
> missing (?)
|
2017-07-18 07:12:44 +03:00
|
|
|
> EOF
|
|
|
|
$ rt test-failure.t
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
|
|
|
@@ -1,11 +1,9 @@
|
|
|
|
$ true
|
|
|
|
- should go away (true !)
|
|
|
|
$ true
|
|
|
|
should stay (false !)
|
|
|
|
|
|
|
|
Should remove first line, not second or third
|
|
|
|
$ echo 'testing'
|
|
|
|
- baz*foo (glob) (true !)
|
|
|
|
foobar*foo (glob) (false !)
|
|
|
|
te*ting (glob) (true !)
|
|
|
|
|
2017-07-18 07:57:11 +03:00
|
|
|
foo.ar (re) (false !)
|
|
|
|
missing (?)
|
|
|
|
@@ -13,13 +11,10 @@
|
2017-07-18 07:12:44 +03:00
|
|
|
$ echo 'testing'
|
|
|
|
test.ng (re) (true !)
|
|
|
|
foo.ar (re) (false !)
|
|
|
|
- b.r (re) (true !)
|
|
|
|
missing (?)
|
|
|
|
- awol (true !)
|
2017-07-18 07:57:11 +03:00
|
|
|
|
|
|
|
The "missing" line should stay, even though awol is dropped
|
|
|
|
$ echo 'testing'
|
|
|
|
test.ng (re) (true !)
|
|
|
|
foo.ar (?)
|
|
|
|
- awol
|
|
|
|
missing (?)
|
2017-07-18 07:12:44 +03:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2016-03-21 23:56:46 +03:00
|
|
|
basic failing test
|
2014-05-30 23:10:56 +04:00
|
|
|
$ cat > test-failure.t << EOF
|
|
|
|
> $ echo babar
|
|
|
|
> rataxes
|
2014-07-29 04:54:14 +04:00
|
|
|
> This is a noop statement so that
|
|
|
|
> this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
> pad pad pad pad............................................................
|
|
|
|
> pad pad pad pad............................................................
|
2017-04-06 05:59:44 +03:00
|
|
|
> pad pad pad pad............................................................
|
|
|
|
> pad pad pad pad............................................................
|
|
|
|
> pad pad pad pad............................................................
|
|
|
|
> pad pad pad pad............................................................
|
2014-05-30 23:10:56 +04:00
|
|
|
> EOF
|
|
|
|
|
2015-03-29 20:41:23 +03:00
|
|
|
>>> fh = open('test-failure-unicode.t', 'wb')
|
2015-04-13 23:37:53 +03:00
|
|
|
>>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
|
|
|
|
>>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
|
2015-03-29 20:41:23 +03:00
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt
|
2014-05-30 23:10:56 +04:00
|
|
|
|
2014-11-17 00:26:15 +03:00
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-05-30 23:10:56 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-05-30 23:10:56 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.
|
2015-03-29 20:41:23 +03:00
|
|
|
--- $TESTTMP/test-failure-unicode.t
|
|
|
|
+++ $TESTTMP/test-failure-unicode.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ echo babar\xce\xb1 (esc)
|
|
|
|
- l\xce\xb5\xce\xb5t (esc)
|
|
|
|
+ babar\xce\xb1 (esc)
|
|
|
|
|
|
|
|
ERROR: test-failure-unicode.t output changed
|
|
|
|
!
|
2014-05-30 23:10:56 +04:00
|
|
|
Failed test-failure.t: output changed
|
2015-03-29 20:41:23 +03:00
|
|
|
Failed test-failure-unicode.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 3 tests, 0 skipped, 2 failed.
|
2014-05-30 23:10:56 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2015-03-29 20:41:23 +03:00
|
|
|
|
2017-06-08 06:30:08 +03:00
|
|
|
test --outputdir
|
|
|
|
$ mkdir output
|
|
|
|
$ rt --outputdir output
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/output/test-failure.t.err
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.
|
|
|
|
--- $TESTTMP/test-failure-unicode.t
|
|
|
|
+++ $TESTTMP/output/test-failure-unicode.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ echo babar\xce\xb1 (esc)
|
|
|
|
- l\xce\xb5\xce\xb5t (esc)
|
|
|
|
+ babar\xce\xb1 (esc)
|
|
|
|
|
|
|
|
ERROR: test-failure-unicode.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
|
|
|
Failed test-failure-unicode.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 3 tests, 0 skipped, 2 failed.
|
2017-06-08 06:30:08 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
$ ls -a output
|
|
|
|
.
|
|
|
|
..
|
2017-06-08 06:32:11 +03:00
|
|
|
.testtimes
|
2017-06-08 06:30:08 +03:00
|
|
|
test-failure-unicode.t.err
|
|
|
|
test-failure.t.err
|
|
|
|
|
2014-08-06 05:17:11 +04:00
|
|
|
test --xunit support
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --xunit=xunit.xml
|
2014-08-06 05:17:11 +04:00
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-08-06 05:17:11 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-08-06 05:17:11 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.
|
2015-03-29 20:41:23 +03:00
|
|
|
--- $TESTTMP/test-failure-unicode.t
|
|
|
|
+++ $TESTTMP/test-failure-unicode.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ echo babar\xce\xb1 (esc)
|
|
|
|
- l\xce\xb5\xce\xb5t (esc)
|
|
|
|
+ babar\xce\xb1 (esc)
|
|
|
|
|
|
|
|
ERROR: test-failure-unicode.t output changed
|
|
|
|
!
|
2014-08-06 05:17:11 +04:00
|
|
|
Failed test-failure.t: output changed
|
2015-03-29 20:41:23 +03:00
|
|
|
Failed test-failure-unicode.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 3 tests, 0 skipped, 2 failed.
|
2014-08-06 05:17:11 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
$ cat xunit.xml
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2015-03-29 20:41:23 +03:00
|
|
|
<testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
|
2014-08-06 05:17:11 +04:00
|
|
|
<testcase name="test-success.t" time="*"/> (glob)
|
2015-03-29 20:41:23 +03:00
|
|
|
<testcase name="test-failure-unicode.t" time="*"> (glob)
|
2017-06-08 01:47:06 +03:00
|
|
|
<failure message="output changed" type="output-mismatch">
|
2015-03-29 20:41:23 +03:00
|
|
|
<![CDATA[--- $TESTTMP/test-failure-unicode.t
|
|
|
|
+++ $TESTTMP/test-failure-unicode.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ echo babar\xce\xb1 (esc)
|
|
|
|
- l\xce\xb5\xce\xb5t (esc)
|
|
|
|
+ babar\xce\xb1 (esc)
|
2017-06-08 01:47:06 +03:00
|
|
|
]]> </failure>
|
|
|
|
</testcase>
|
2014-08-06 05:17:11 +04:00
|
|
|
<testcase name="test-failure.t" time="*"> (glob)
|
2017-06-08 01:47:06 +03:00
|
|
|
<failure message="output changed" type="output-mismatch">
|
2014-08-06 05:17:11 +04:00
|
|
|
<![CDATA[--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-08-06 05:17:11 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2017-06-08 01:47:06 +03:00
|
|
|
]]> </failure>
|
|
|
|
</testcase>
|
2014-08-06 05:17:11 +04:00
|
|
|
</testsuite>
|
2014-05-30 23:11:17 +04:00
|
|
|
|
2016-04-03 23:49:30 +03:00
|
|
|
$ cat .testtimes
|
|
|
|
test-failure-unicode.t * (glob)
|
|
|
|
test-failure.t * (glob)
|
|
|
|
test-success.t * (glob)
|
2017-06-07 00:38:59 +03:00
|
|
|
|
|
|
|
$ rt --list-tests
|
|
|
|
test-failure-unicode.t
|
|
|
|
test-failure.t
|
|
|
|
test-success.t
|
|
|
|
|
|
|
|
$ rt --list-tests --json
|
|
|
|
test-failure-unicode.t
|
|
|
|
test-failure.t
|
|
|
|
test-success.t
|
|
|
|
$ cat report.json
|
|
|
|
testreport ={
|
|
|
|
"test-failure-unicode.t": {
|
|
|
|
"result": "success"
|
|
|
|
},
|
|
|
|
"test-failure.t": {
|
|
|
|
"result": "success"
|
|
|
|
},
|
|
|
|
"test-success.t": {
|
|
|
|
"result": "success"
|
|
|
|
}
|
|
|
|
} (no-eol)
|
|
|
|
|
|
|
|
$ rt --list-tests --xunit=xunit.xml
|
|
|
|
test-failure-unicode.t
|
|
|
|
test-failure.t
|
|
|
|
test-success.t
|
|
|
|
$ cat xunit.xml
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
|
|
|
|
<testcase name="test-failure-unicode.t"/>
|
|
|
|
<testcase name="test-failure.t"/>
|
|
|
|
<testcase name="test-success.t"/>
|
|
|
|
</testsuite>
|
|
|
|
|
2017-06-08 06:46:43 +03:00
|
|
|
$ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
|
2017-06-07 00:38:59 +03:00
|
|
|
test-failure-unicode.t
|
|
|
|
test-failure.t
|
2017-06-08 06:46:43 +03:00
|
|
|
$ cat output/report.json
|
2017-06-07 00:38:59 +03:00
|
|
|
testreport ={
|
|
|
|
"test-failure-unicode.t": {
|
|
|
|
"result": "success"
|
|
|
|
},
|
|
|
|
"test-failure.t": {
|
|
|
|
"result": "success"
|
|
|
|
}
|
|
|
|
} (no-eol)
|
|
|
|
$ cat xunit.xml
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
|
|
|
|
<testcase name="test-failure-unicode.t"/>
|
|
|
|
<testcase name="test-failure.t"/>
|
|
|
|
</testsuite>
|
|
|
|
|
2015-03-29 20:41:23 +03:00
|
|
|
$ rm test-failure-unicode.t
|
|
|
|
|
2014-05-30 23:11:17 +04:00
|
|
|
test for --retest
|
|
|
|
====================
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --retest
|
2014-05-30 23:11:17 +04:00
|
|
|
|
2014-11-17 00:26:15 +03:00
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-05-30 23:11:17 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2017-06-08 06:30:08 +03:00
|
|
|
pad pad pad pad............................................................
|
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 1 failed.
|
2017-06-08 06:30:08 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
--retest works with --outputdir
|
|
|
|
$ rm -r output
|
|
|
|
$ mkdir output
|
|
|
|
$ mv test-failure.t.err output
|
|
|
|
$ rt --retest --outputdir output
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/output/test-failure.t.err
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-05-30 23:11:17 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 1 failed.
|
2014-05-30 23:11:17 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2014-05-30 23:11:39 +04:00
|
|
|
|
|
|
|
Selecting Tests To Run
|
|
|
|
======================
|
|
|
|
|
|
|
|
successful
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt test-success.t
|
2014-05-30 23:11:39 +04:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2014-05-30 23:11:39 +04:00
|
|
|
|
2014-07-29 03:48:59 +04:00
|
|
|
success w/ keyword
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt -k xyzzy
|
2014-08-12 09:33:48 +04:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 0 failed.
|
2014-07-29 03:48:59 +04:00
|
|
|
|
2014-05-30 23:11:39 +04:00
|
|
|
failed
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt test-failure.t
|
2014-05-30 23:11:39 +04:00
|
|
|
|
2014-11-17 00:26:15 +03:00
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-05-30 23:11:39 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-05-30 23:11:39 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
2014-05-30 23:11:39 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2014-05-30 23:11:51 +04:00
|
|
|
|
2014-07-29 03:48:59 +04:00
|
|
|
failure w/ keyword
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt -k rataxes
|
2014-08-12 09:33:48 +04:00
|
|
|
|
2014-07-29 03:48:59 +04:00
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-07-29 03:48:59 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-07-29 03:48:59 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 1 failed.
|
2014-07-29 03:48:59 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2014-10-10 18:34:52 +04:00
|
|
|
Verify that when a process fails to start we show a useful message
|
|
|
|
==================================================================
|
|
|
|
|
|
|
|
$ cat > test-serve-fail.t <<EOF
|
|
|
|
> $ echo 'abort: child process failed to start blah'
|
|
|
|
> EOF
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt test-serve-fail.t
|
2014-10-10 18:34:52 +04:00
|
|
|
|
|
|
|
ERROR: test-serve-fail.t output changed
|
|
|
|
!
|
|
|
|
Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
2014-10-10 18:34:52 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
$ rm test-serve-fail.t
|
|
|
|
|
2015-12-29 07:30:38 +03:00
|
|
|
Verify that we can try other ports
|
|
|
|
===================================
|
|
|
|
$ hg init inuse
|
|
|
|
$ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
|
|
|
|
$ cat blocks.pid >> $DAEMON_PIDS
|
|
|
|
$ cat > test-serve-inuse.t <<EOF
|
|
|
|
> $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
|
|
|
|
> $ cat hg.pid >> \$DAEMON_PIDS
|
|
|
|
> EOF
|
|
|
|
$ rt test-serve-inuse.t
|
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2015-12-29 07:30:38 +03:00
|
|
|
$ rm test-serve-inuse.t
|
2016-05-11 18:20:25 +03:00
|
|
|
$ killdaemons.py $DAEMON_PIDS
|
|
|
|
$ rm $DAEMON_PIDS
|
2015-12-29 07:30:38 +03:00
|
|
|
|
2014-05-30 23:11:51 +04:00
|
|
|
Running In Debug Mode
|
|
|
|
======================
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --debug 2>&1 | grep -v pwd
|
2014-12-29 01:50:08 +03:00
|
|
|
+ echo *SALT* 0 0 (glob)
|
|
|
|
*SALT* 0 0 (glob)
|
2014-05-30 23:11:51 +04:00
|
|
|
+ echo babar
|
|
|
|
babar
|
2017-04-06 05:59:44 +03:00
|
|
|
+ echo *SALT* 10 0 (glob)
|
|
|
|
*SALT* 10 0 (glob)
|
2015-11-23 20:14:01 +03:00
|
|
|
*+ echo *SALT* 0 0 (glob)
|
2014-12-29 01:50:08 +03:00
|
|
|
*SALT* 0 0 (glob)
|
2014-05-30 23:11:51 +04:00
|
|
|
+ echo babar
|
|
|
|
babar
|
2014-12-29 01:50:08 +03:00
|
|
|
+ echo *SALT* 2 0 (glob)
|
|
|
|
*SALT* 2 0 (glob)
|
2014-07-29 04:54:14 +04:00
|
|
|
+ echo xyzzy
|
|
|
|
xyzzy
|
2017-04-06 05:00:33 +03:00
|
|
|
+ echo *SALT* 9 0 (glob)
|
|
|
|
*SALT* 9 0 (glob)
|
2016-02-29 07:21:28 +03:00
|
|
|
+ printf *abc\ndef\nxyz\n* (glob)
|
|
|
|
abc
|
|
|
|
def
|
|
|
|
xyz
|
2017-04-06 05:00:33 +03:00
|
|
|
+ echo *SALT* 15 0 (glob)
|
|
|
|
*SALT* 15 0 (glob)
|
run-tests: support per-line conditional output in tests
Duplicating entire tests just because the output is different is both error
prone and can make the tests harder to read. This harnesses the existing '(?)'
infrastructure, both to improve readability, and because it seemed like the path
of least resistance.
The form is:
$ test_cmd
output (hghave-feature !) # required if hghave.has_feature(), else optional
out2 (no-hghave-feature2 !) # req if not hghave.has_feature2(), else optional
I originally extended the '(?)' syntax. For example, this:
2 r4/.hg/cache/checkisexec (execbit ?)
pretty naturally reads as "checkisexec, if execbit". In some ways though, this
inverts the meaning of '?'. For '(?)', the line is purely optional. In the
example, it is mandatory iff execbit. Otherwise, it is carried forward as
optional, to preserve the test output. I tried it the other way, (listing
'no-exec' in the example), but that is too confusing to read. Kostia suggested
using '!', and that seems fine.
2017-04-06 06:17:27 +03:00
|
|
|
+ printf *zyx\nwvu\ntsr\n* (glob)
|
|
|
|
zyx
|
|
|
|
wvu
|
|
|
|
tsr
|
|
|
|
+ echo *SALT* 22 0 (glob)
|
|
|
|
*SALT* 22 0 (glob)
|
2014-05-30 23:11:51 +04:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 0 failed.
|
2014-05-30 23:12:03 +04:00
|
|
|
|
|
|
|
Parallel runs
|
|
|
|
==============
|
|
|
|
|
|
|
|
(duplicate the failing test to get predictable output)
|
|
|
|
$ cp test-failure.t test-failure-copy.t
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --jobs 2 test-failure*.t -n
|
2014-10-31 01:52:01 +03:00
|
|
|
!!
|
2014-05-30 23:12:03 +04:00
|
|
|
Failed test-failure*.t: output changed (glob)
|
|
|
|
Failed test-failure*.t: output changed (glob)
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 2 failed.
|
2014-05-30 23:12:03 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2014-10-09 23:10:40 +04:00
|
|
|
failures in parallel with --first should only print one failure
|
2017-10-19 02:28:18 +03:00
|
|
|
$ rt --jobs 2 --first test-failure*.t
|
2014-10-09 23:10:40 +04:00
|
|
|
|
|
|
|
--- $TESTTMP/test-failure*.t (glob)
|
|
|
|
+++ $TESTTMP/test-failure*.t.err (glob)
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-10-09 23:10:40 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-10-09 23:10:40 +04:00
|
|
|
|
|
|
|
Failed test-failure*.t: output changed (glob)
|
2017-10-19 02:28:18 +03:00
|
|
|
Failed test-failure*.t: output changed (glob)
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 2 failed.
|
2014-10-09 23:10:40 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
|
2014-05-30 23:12:03 +04:00
|
|
|
(delete the duplicated test file)
|
2017-10-19 02:28:18 +03:00
|
|
|
$ rm test-failure-copy.t
|
2014-05-30 23:12:03 +04:00
|
|
|
|
2014-05-30 23:12:12 +04:00
|
|
|
|
|
|
|
Interactive run
|
|
|
|
===============
|
|
|
|
|
|
|
|
(backup the failing test)
|
|
|
|
$ cp test-failure.t backup
|
|
|
|
|
|
|
|
Refuse the fix
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ echo 'n' | rt -i
|
2014-05-30 23:12:12 +04:00
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-05-30 23:12:12 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-06-19 05:51:49 +04:00
|
|
|
Accept this change? [n]
|
2014-05-30 23:12:12 +04:00
|
|
|
ERROR: test-failure.t output changed
|
2014-06-19 05:51:49 +04:00
|
|
|
!.
|
2014-05-30 23:12:12 +04:00
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2014-05-30 23:12:12 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ cat test-failure.t
|
|
|
|
$ echo babar
|
|
|
|
rataxes
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
2017-04-06 05:59:44 +03:00
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
2014-05-30 23:12:12 +04:00
|
|
|
|
2014-08-31 14:22:44 +04:00
|
|
|
Interactive with custom view
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ echo 'n' | rt -i --view echo
|
2014-11-17 00:26:15 +03:00
|
|
|
$TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
|
2014-08-31 14:22:44 +04:00
|
|
|
Accept this change? [n]* (glob)
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2014-08-31 14:22:44 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2014-08-12 09:40:24 +04:00
|
|
|
View the fix
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ echo 'y' | rt --view echo
|
2014-11-17 00:26:15 +03:00
|
|
|
$TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
|
2014-08-12 09:40:24 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2014-08-12 09:40:24 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2014-05-30 23:12:12 +04:00
|
|
|
Accept the fix
|
|
|
|
|
2014-11-27 04:04:30 +03:00
|
|
|
$ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
|
|
|
|
$ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
|
|
|
|
$ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
|
|
|
|
$ 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
|
2015-12-07 00:14:01 +03:00
|
|
|
$ echo 'y' | rt -i 2>&1
|
2014-05-30 23:12:12 +04:00
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2017-04-06 05:59:44 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-05-30 23:12:12 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2017-04-06 05:59:44 +03:00
|
|
|
@@ -9,7 +9,7 @@
|
|
|
|
pad pad pad pad............................................................
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-11-27 04:04:30 +03:00
|
|
|
$ echo 'saved backup bundle to $TESTTMP/foo.hg'
|
|
|
|
- saved backup bundle to $TESTTMP/foo.hg
|
2015-12-07 00:14:01 +03:00
|
|
|
+ saved backup bundle to $TESTTMP/foo.hg* (glob)
|
2014-11-27 04:04:30 +03:00
|
|
|
$ echo 'saved backup bundle to $TESTTMP/foo.hg'
|
2015-12-07 00:14:01 +03:00
|
|
|
saved backup bundle to $TESTTMP/foo.hg* (glob)
|
2014-11-27 04:04:30 +03:00
|
|
|
$ echo 'saved backup bundle to $TESTTMP/foo.hg'
|
2014-05-30 23:12:12 +04:00
|
|
|
Accept this change? [n] ..
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 0 failed.
|
2014-05-30 23:12:12 +04:00
|
|
|
|
2014-11-27 04:04:30 +03:00
|
|
|
$ sed -e 's,(glob)$,&<,g' test-failure.t
|
2014-05-30 23:12:12 +04:00
|
|
|
$ echo babar
|
|
|
|
babar
|
2014-07-29 04:54:14 +04:00
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2017-04-06 05:59:44 +03:00
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
pad pad pad pad............................................................
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-11-27 04:04:30 +03:00
|
|
|
$ echo 'saved backup bundle to $TESTTMP/foo.hg'
|
|
|
|
saved backup bundle to $TESTTMP/foo.hg (glob)<
|
|
|
|
$ echo 'saved backup bundle to $TESTTMP/foo.hg'
|
|
|
|
saved backup bundle to $TESTTMP/foo.hg (glob)<
|
|
|
|
$ echo 'saved backup bundle to $TESTTMP/foo.hg'
|
|
|
|
saved backup bundle to $TESTTMP/*.hg (glob)<
|
2014-05-30 23:12:12 +04:00
|
|
|
|
2017-06-21 11:05:20 +03:00
|
|
|
Race condition - test file was modified when test is running
|
|
|
|
|
|
|
|
$ TESTRACEDIR=`pwd`
|
|
|
|
$ export TESTRACEDIR
|
|
|
|
$ cat > test-race.t <<EOF
|
|
|
|
> $ echo 1
|
|
|
|
> $ echo "# a new line" >> $TESTRACEDIR/test-race.t
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ rt -i test-race.t
|
|
|
|
|
|
|
|
--- $TESTTMP/test-race.t
|
|
|
|
+++ $TESTTMP/test-race.t.err
|
|
|
|
@@ -1,2 +1,3 @@
|
|
|
|
$ echo 1
|
|
|
|
+ 1
|
|
|
|
$ echo "# a new line" >> $TESTTMP/test-race.t
|
|
|
|
Reference output has changed (run again to prompt changes)
|
|
|
|
ERROR: test-race.t output changed
|
|
|
|
!
|
|
|
|
Failed test-race.t: output changed
|
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ rm test-race.t
|
|
|
|
|
2017-06-21 11:12:31 +03:00
|
|
|
When "#testcases" is used in .t files
|
|
|
|
|
|
|
|
$ cat >> test-cases.t <<EOF
|
|
|
|
> #testcases a b
|
|
|
|
> #if a
|
|
|
|
> $ echo 1
|
|
|
|
> #endif
|
|
|
|
> #if b
|
|
|
|
> $ echo 2
|
|
|
|
> #endif
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat <<EOF | rt -i test-cases.t 2>&1
|
|
|
|
> y
|
|
|
|
> y
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
--- $TESTTMP/test-cases.t
|
|
|
|
+++ $TESTTMP/test-cases.t.a.err
|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
#testcases a b
|
|
|
|
#if a
|
|
|
|
$ echo 1
|
|
|
|
+ 1
|
|
|
|
#endif
|
|
|
|
#if b
|
|
|
|
$ echo 2
|
|
|
|
Accept this change? [n] .
|
|
|
|
--- $TESTTMP/test-cases.t
|
|
|
|
+++ $TESTTMP/test-cases.t.b.err
|
|
|
|
@@ -5,4 +5,5 @@
|
|
|
|
#endif
|
|
|
|
#if b
|
|
|
|
$ echo 2
|
|
|
|
+ 2
|
|
|
|
#endif
|
|
|
|
Accept this change? [n] .
|
|
|
|
# Ran 2 tests, 0 skipped, 0 failed.
|
|
|
|
|
|
|
|
$ cat test-cases.t
|
|
|
|
#testcases a b
|
|
|
|
#if a
|
|
|
|
$ echo 1
|
|
|
|
1
|
|
|
|
#endif
|
|
|
|
#if b
|
|
|
|
$ echo 2
|
|
|
|
2
|
|
|
|
#endif
|
|
|
|
|
2017-08-20 19:46:27 +03:00
|
|
|
$ cat >> test-cases.t <<'EOF'
|
|
|
|
> #if a
|
|
|
|
> $ NAME=A
|
|
|
|
> #else
|
|
|
|
> $ NAME=B
|
|
|
|
> #endif
|
|
|
|
> $ echo $NAME
|
|
|
|
> A (a !)
|
|
|
|
> B (b !)
|
|
|
|
> EOF
|
|
|
|
$ rt test-cases.t
|
|
|
|
..
|
|
|
|
# Ran 2 tests, 0 skipped, 0 failed.
|
|
|
|
|
2017-06-21 11:12:31 +03:00
|
|
|
$ rm test-cases.t
|
|
|
|
|
2014-05-30 23:12:12 +04:00
|
|
|
(reinstall)
|
|
|
|
$ mv backup test-failure.t
|
2014-05-30 23:57:58 +04:00
|
|
|
|
|
|
|
No Diff
|
|
|
|
===============
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --nodiff
|
2014-05-30 23:57:58 +04:00
|
|
|
!.
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2014-05-30 23:57:58 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2014-06-25 23:52:50 +04:00
|
|
|
|
2015-09-30 23:01:19 +03:00
|
|
|
test --tmpdir support
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --tmpdir=$TESTTMP/keep test-success.t
|
2015-09-30 23:01:19 +03:00
|
|
|
|
2015-10-02 05:14:11 +03:00
|
|
|
Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
|
|
|
|
Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
|
2015-09-30 23:01:19 +03:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2015-09-30 23:01:19 +03:00
|
|
|
|
2015-11-25 03:39:05 +03:00
|
|
|
timeouts
|
|
|
|
========
|
|
|
|
$ cat > test-timeout.t <<EOF
|
|
|
|
> $ sleep 2
|
|
|
|
> $ echo pass
|
|
|
|
> pass
|
|
|
|
> EOF
|
|
|
|
> echo '#require slow' > test-slow-timeout.t
|
|
|
|
> cat test-timeout.t >> test-slow-timeout.t
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
|
2015-12-04 23:55:10 +03:00
|
|
|
st
|
2017-05-27 00:52:54 +03:00
|
|
|
Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
|
2015-11-25 03:39:05 +03:00
|
|
|
Failed test-timeout.t: timed out
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 1 skipped, 1 failed.
|
2015-11-25 03:39:05 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --timeout=1 --slowtimeout=3 \
|
2015-11-25 03:39:05 +03:00
|
|
|
> test-timeout.t test-slow-timeout.t --allow-slow-tests
|
2015-12-04 23:55:10 +03:00
|
|
|
.t
|
2015-11-25 03:39:05 +03:00
|
|
|
Failed test-timeout.t: timed out
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2015-11-25 03:39:05 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
$ rm test-timeout.t test-slow-timeout.t
|
|
|
|
|
2014-06-25 23:52:50 +04:00
|
|
|
test for --time
|
|
|
|
==================
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt test-success.t --time
|
2014-06-25 23:52:50 +04:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2014-06-25 23:52:50 +04:00
|
|
|
# Producing time report
|
2015-05-08 09:40:29 +03:00
|
|
|
start end cuser csys real Test
|
|
|
|
\s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
|
2014-06-25 23:52:50 +04:00
|
|
|
|
|
|
|
test for --time with --job enabled
|
|
|
|
====================================
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt test-success.t --time --jobs 2
|
2014-06-25 23:52:50 +04:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2014-06-25 23:52:50 +04:00
|
|
|
# Producing time report
|
2015-05-08 09:40:29 +03:00
|
|
|
start end cuser csys real Test
|
|
|
|
\s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
|
2014-07-30 06:35:59 +04:00
|
|
|
|
|
|
|
Skips
|
|
|
|
================
|
|
|
|
$ cat > test-skip.t <<EOF
|
|
|
|
> $ echo xyzzy
|
2014-08-06 19:34:54 +04:00
|
|
|
> #require false
|
2014-07-30 06:35:59 +04:00
|
|
|
> EOF
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --nodiff
|
2014-07-30 06:35:59 +04:00
|
|
|
!.s
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-skip.t: missing feature: nail clipper
|
2014-07-30 06:35:59 +04:00
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 1 failed.
|
2014-07-30 06:35:59 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --keyword xyzzy
|
2014-08-12 09:33:48 +04:00
|
|
|
.s
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-skip.t: missing feature: nail clipper
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 2 skipped, 0 failed.
|
2014-07-29 03:48:59 +04:00
|
|
|
|
2014-08-06 05:17:11 +04:00
|
|
|
Skips with xml
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --keyword xyzzy \
|
2014-08-06 05:17:11 +04:00
|
|
|
> --xunit=xunit.xml
|
2014-08-12 09:33:48 +04:00
|
|
|
.s
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-skip.t: missing feature: nail clipper
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 2 skipped, 0 failed.
|
2014-08-06 05:17:11 +04:00
|
|
|
$ cat xunit.xml
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2014-08-12 09:33:48 +04:00
|
|
|
<testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
|
2014-08-06 05:17:11 +04:00
|
|
|
<testcase name="test-success.t" time="*"/> (glob)
|
2017-06-08 01:47:06 +03:00
|
|
|
<testcase name="test-skip.t">
|
|
|
|
<skipped>
|
|
|
|
<![CDATA[missing feature: nail clipper]]> </skipped>
|
|
|
|
</testcase>
|
2014-08-06 05:17:11 +04:00
|
|
|
</testsuite>
|
|
|
|
|
2014-07-29 03:48:59 +04:00
|
|
|
Missing skips or blacklisted skips don't count as executed:
|
|
|
|
$ echo test-failure.t > blacklist
|
2016-01-19 19:22:27 +03:00
|
|
|
$ rt --blacklist=blacklist --json\
|
2014-07-29 03:48:59 +04:00
|
|
|
> test-failure.t test-bogus.t
|
|
|
|
ss
|
|
|
|
Skipped test-bogus.t: Doesn't exist
|
|
|
|
Skipped test-failure.t: blacklisted
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 0 tests, 2 skipped, 0 failed.
|
2016-01-19 19:22:27 +03:00
|
|
|
$ cat report.json
|
|
|
|
testreport ={
|
|
|
|
"test-bogus.t": {
|
|
|
|
"result": "skip"
|
2016-05-06 02:17:19 +03:00
|
|
|
},
|
2016-01-19 19:22:27 +03:00
|
|
|
"test-failure.t": {
|
|
|
|
"result": "skip"
|
|
|
|
}
|
|
|
|
} (no-eol)
|
2016-05-06 03:45:31 +03:00
|
|
|
|
|
|
|
Whitelist trumps blacklist
|
|
|
|
$ echo test-failure.t > whitelist
|
|
|
|
$ rt --blacklist=blacklist --whitelist=whitelist --json\
|
|
|
|
> test-failure.t test-bogus.t
|
|
|
|
s
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Skipped test-bogus.t: Doesn't exist
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 1 skipped, 1 failed.
|
2016-05-06 03:45:31 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2017-09-19 00:11:32 +03:00
|
|
|
Ensure that --test-list causes only the tests listed in that file to
|
|
|
|
be executed.
|
|
|
|
$ echo test-success.t >> onlytest
|
|
|
|
$ rt --test-list=onlytest
|
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
|
|
|
$ echo test-bogus.t >> anothertest
|
|
|
|
$ rt --test-list=onlytest --test-list=anothertest
|
|
|
|
s.
|
|
|
|
Skipped test-bogus.t: Doesn't exist
|
|
|
|
# Ran 1 tests, 1 skipped, 0 failed.
|
|
|
|
$ rm onlytest anothertest
|
|
|
|
|
2014-09-08 18:41:00 +04:00
|
|
|
test for --json
|
|
|
|
==================
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --json
|
2014-09-08 18:41:00 +04:00
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2014-09-08 18:41:00 +04:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2014-09-08 18:41:00 +04:00
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.s
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-skip.t: missing feature: nail clipper
|
2014-09-08 18:41:00 +04:00
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 1 failed.
|
2014-09-08 18:41:00 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ cat report.json
|
|
|
|
testreport ={
|
|
|
|
"test-failure.t": [\{] (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
2016-01-06 00:33:09 +03:00
|
|
|
"diff": "---.+\+\+\+.+", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"result": "failure", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}, ? (re)
|
2014-09-08 18:41:00 +04:00
|
|
|
"test-skip.t": {
|
2014-11-06 18:57:13 +03:00
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
2016-01-06 00:33:09 +03:00
|
|
|
"diff": "", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"result": "skip", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}, ? (re)
|
2014-09-08 18:41:00 +04:00
|
|
|
"test-success.t": [\{] (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
2016-01-06 00:33:09 +03:00
|
|
|
"diff": "", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"result": "success", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
2014-11-06 18:57:13 +03:00
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
2014-09-08 18:41:00 +04:00
|
|
|
}
|
|
|
|
} (no-eol)
|
2017-06-08 06:46:43 +03:00
|
|
|
--json with --outputdir
|
|
|
|
|
|
|
|
$ rm report.json
|
|
|
|
$ rm -r output
|
|
|
|
$ mkdir output
|
|
|
|
$ rt --json --outputdir output
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/output/test-failure.t.err
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
|
|
|
pad pad pad pad............................................................
|
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!.s
|
|
|
|
Skipped test-skip.t: missing feature: nail clipper
|
|
|
|
Failed test-failure.t: output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 1 failed.
|
2017-06-08 06:46:43 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
$ f report.json
|
|
|
|
report.json: file not found
|
|
|
|
$ cat output/report.json
|
|
|
|
testreport ={
|
|
|
|
"test-failure.t": [\{] (re)
|
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"diff": "---.+\+\+\+.+", ? (re)
|
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"result": "failure", ? (re)
|
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}, ? (re)
|
|
|
|
"test-skip.t": {
|
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"diff": "", ? (re)
|
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"result": "skip", ? (re)
|
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}, ? (re)
|
|
|
|
"test-success.t": [\{] (re)
|
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"diff": "", ? (re)
|
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"result": "success", ? (re)
|
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}
|
|
|
|
} (no-eol)
|
|
|
|
$ ls -a output
|
|
|
|
.
|
|
|
|
..
|
|
|
|
.testtimes
|
|
|
|
report.json
|
|
|
|
test-failure.t.err
|
2014-09-18 22:43:47 +04:00
|
|
|
|
2015-05-09 05:32:11 +03:00
|
|
|
Test that failed test accepted through interactive are properly reported:
|
|
|
|
|
|
|
|
$ cp test-failure.t backup
|
2015-12-07 00:14:01 +03:00
|
|
|
$ echo y | rt --json -i
|
2015-05-09 05:32:11 +03:00
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
2016-02-29 07:16:30 +03:00
|
|
|
@@ -1,5 +1,5 @@
|
2015-05-09 05:32:11 +03:00
|
|
|
$ echo babar
|
|
|
|
- rataxes
|
|
|
|
+ babar
|
|
|
|
This is a noop statement so that
|
|
|
|
this test is still more bytes than success.
|
2016-02-29 07:16:30 +03:00
|
|
|
pad pad pad pad............................................................
|
2015-05-09 05:32:11 +03:00
|
|
|
Accept this change? [n] ..s
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-skip.t: missing feature: nail clipper
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 0 failed.
|
2015-05-09 05:32:11 +03:00
|
|
|
|
|
|
|
$ cat report.json
|
|
|
|
testreport ={
|
|
|
|
"test-failure.t": [\{] (re)
|
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
2016-01-06 00:33:09 +03:00
|
|
|
"diff": "", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
2015-05-09 05:32:11 +03:00
|
|
|
"result": "success", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
2015-05-09 05:32:11 +03:00
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}, ? (re)
|
|
|
|
"test-skip.t": {
|
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
2016-01-06 00:33:09 +03:00
|
|
|
"diff": "", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
2015-05-09 05:32:11 +03:00
|
|
|
"result": "skip", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
2015-05-09 05:32:11 +03:00
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}, ? (re)
|
|
|
|
"test-success.t": [\{] (re)
|
|
|
|
"csys": "\s*[\d\.]{4,5}", ? (re)
|
|
|
|
"cuser": "\s*[\d\.]{4,5}", ? (re)
|
2016-01-06 00:33:09 +03:00
|
|
|
"diff": "", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"end": "\s*[\d\.]{4,5}", ? (re)
|
2015-05-09 05:32:11 +03:00
|
|
|
"result": "success", ? (re)
|
2015-05-08 09:34:58 +03:00
|
|
|
"start": "\s*[\d\.]{4,5}", ? (re)
|
2015-05-09 05:32:11 +03:00
|
|
|
"time": "\s*[\d\.]{4,5}" (re)
|
|
|
|
}
|
|
|
|
} (no-eol)
|
|
|
|
$ mv backup test-failure.t
|
|
|
|
|
2015-04-18 00:12:01 +03:00
|
|
|
backslash on end of line with glob matching is handled properly
|
|
|
|
|
|
|
|
$ cat > test-glob-backslash.t << EOF
|
|
|
|
> $ echo 'foo bar \\'
|
|
|
|
> foo * \ (glob)
|
|
|
|
> EOF
|
|
|
|
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt test-glob-backslash.t
|
2015-04-18 00:12:01 +03:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2015-04-18 00:12:01 +03:00
|
|
|
|
|
|
|
$ rm -f test-glob-backslash.t
|
|
|
|
|
2017-03-27 05:57:17 +03:00
|
|
|
Test globbing of local IP addresses
|
2016-07-10 06:01:02 +03:00
|
|
|
$ echo 172.16.18.1
|
2017-03-27 05:57:17 +03:00
|
|
|
$LOCALIP (glob)
|
|
|
|
$ echo dead:beef::1
|
|
|
|
$LOCALIP (glob)
|
2016-07-10 06:01:02 +03:00
|
|
|
|
2015-07-03 00:56:03 +03:00
|
|
|
Test reusability for third party tools
|
|
|
|
======================================
|
|
|
|
|
|
|
|
$ mkdir "$TESTTMP"/anothertests
|
|
|
|
$ cd "$TESTTMP"/anothertests
|
|
|
|
|
|
|
|
test that `run-tests.py` can execute hghave, even if it runs not in
|
|
|
|
Mercurial source tree.
|
|
|
|
|
|
|
|
$ cat > test-hghave.t <<EOF
|
|
|
|
> #require true
|
|
|
|
> $ echo foo
|
|
|
|
> foo
|
|
|
|
> EOF
|
2016-03-22 00:06:49 +03:00
|
|
|
$ rt test-hghave.t
|
2015-07-03 00:56:03 +03:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2015-07-03 00:56:03 +03:00
|
|
|
|
|
|
|
test that RUNTESTDIR refers the directory, in which `run-tests.py` now
|
|
|
|
running is placed.
|
|
|
|
|
|
|
|
$ cat > test-runtestdir.t <<EOF
|
|
|
|
> - $TESTDIR, in which test-run-tests.t is placed
|
|
|
|
> - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
|
|
|
|
> - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
|
|
|
|
>
|
2015-11-17 00:56:00 +03:00
|
|
|
> #if windows
|
|
|
|
> $ test "\$TESTDIR" = "$TESTTMP\anothertests"
|
|
|
|
> #else
|
2015-07-03 00:56:03 +03:00
|
|
|
> $ test "\$TESTDIR" = "$TESTTMP"/anothertests
|
2015-11-17 00:56:00 +03:00
|
|
|
> #endif
|
2015-07-03 00:56:03 +03:00
|
|
|
> $ test "\$RUNTESTDIR" = "$TESTDIR"
|
2017-06-20 16:33:19 +03:00
|
|
|
> $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
|
|
|
|
> #!USRBINENVPY
|
2015-07-03 00:56:03 +03:00
|
|
|
> #
|
|
|
|
> # check-code - a style and portability checker for Mercurial
|
|
|
|
> EOF
|
2016-03-22 00:06:49 +03:00
|
|
|
$ rt test-runtestdir.t
|
2015-07-03 00:56:03 +03:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2015-07-03 00:56:03 +03:00
|
|
|
|
|
|
|
#if execbit
|
|
|
|
|
|
|
|
test that TESTDIR is referred in PATH
|
|
|
|
|
|
|
|
$ cat > custom-command.sh <<EOF
|
|
|
|
> #!/bin/sh
|
|
|
|
> echo "hello world"
|
|
|
|
> EOF
|
|
|
|
$ chmod +x custom-command.sh
|
|
|
|
$ cat > test-testdir-path.t <<EOF
|
|
|
|
> $ custom-command.sh
|
|
|
|
> hello world
|
|
|
|
> EOF
|
2016-03-22 00:06:49 +03:00
|
|
|
$ rt test-testdir-path.t
|
2015-07-03 00:56:03 +03:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2015-07-03 00:56:03 +03:00
|
|
|
|
|
|
|
#endif
|
2015-08-25 05:23:45 +03:00
|
|
|
|
|
|
|
test support for --allow-slow-tests
|
|
|
|
$ cat > test-very-slow-test.t <<EOF
|
|
|
|
> #require slow
|
|
|
|
> $ echo pass
|
|
|
|
> pass
|
|
|
|
> EOF
|
2016-03-22 00:06:49 +03:00
|
|
|
$ rt test-very-slow-test.t
|
2015-08-25 05:23:45 +03:00
|
|
|
s
|
2017-05-27 00:52:54 +03:00
|
|
|
Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 0 tests, 1 skipped, 0 failed.
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
|
2015-08-25 05:23:45 +03:00
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2016-02-18 11:52:15 +03:00
|
|
|
|
|
|
|
support for running a test outside the current directory
|
|
|
|
$ mkdir nonlocal
|
|
|
|
$ cat > nonlocal/test-is-not-here.t << EOF
|
|
|
|
> $ echo pass
|
|
|
|
> pass
|
|
|
|
> EOF
|
|
|
|
$ rt nonlocal/test-is-not-here.t
|
|
|
|
.
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 failed.
|
2016-03-19 21:26:10 +03:00
|
|
|
|
2017-10-19 17:13:57 +03:00
|
|
|
support for automatically discovering test if arg is a folder
|
|
|
|
$ mkdir tmp && cd tmp
|
|
|
|
|
|
|
|
$ cat > test-uno.t << EOF
|
|
|
|
> $ echo line
|
|
|
|
> line
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cp test-uno.t test-dos.t
|
|
|
|
$ cd ..
|
|
|
|
$ cp -R tmp tmpp
|
|
|
|
$ cp tmp/test-uno.t test-solo.t
|
|
|
|
|
|
|
|
$ $PYTHON $TESTDIR/run-tests.py tmp/ test-solo.t tmpp
|
|
|
|
.....
|
|
|
|
# Ran 5 tests, 0 skipped, 0 failed.
|
|
|
|
$ rm -rf tmp tmpp
|
|
|
|
|
2017-08-02 07:27:45 +03:00
|
|
|
support for running run-tests.py from another directory
|
|
|
|
$ mkdir tmp && cd tmp
|
2017-11-18 10:12:00 +03:00
|
|
|
|
2017-08-02 07:27:45 +03:00
|
|
|
$ cat > useful-file.sh << EOF
|
|
|
|
> important command
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat > test-folder.t << EOF
|
|
|
|
> $ cat \$TESTDIR/useful-file.sh
|
|
|
|
> important command
|
|
|
|
> EOF
|
|
|
|
|
2017-11-18 10:12:00 +03:00
|
|
|
$ cat > test-folder-fail.t << EOF
|
|
|
|
> $ cat \$TESTDIR/useful-file.sh
|
|
|
|
> important commando
|
|
|
|
> EOF
|
|
|
|
|
2017-08-02 07:27:45 +03:00
|
|
|
$ cd ..
|
2017-11-18 10:12:00 +03:00
|
|
|
$ $PYTHON $TESTDIR/run-tests.py tmp/test-*.t
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/tmp/test-folder-fail.t
|
|
|
|
+++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ cat $TESTDIR/useful-file.sh
|
|
|
|
- important commando
|
|
|
|
+ important command
|
|
|
|
|
|
|
|
ERROR: test-folder-fail.t output changed
|
|
|
|
!.
|
|
|
|
Failed test-folder-fail.t: output changed
|
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2017-08-02 07:27:45 +03:00
|
|
|
|
2016-03-19 21:26:10 +03:00
|
|
|
support for bisecting failed tests automatically
|
|
|
|
$ hg init bisect
|
|
|
|
$ cd bisect
|
|
|
|
$ cat >> test-bisect.t <<EOF
|
|
|
|
> $ echo pass
|
|
|
|
> pass
|
|
|
|
> EOF
|
|
|
|
$ hg add test-bisect.t
|
|
|
|
$ hg ci -m 'good'
|
|
|
|
$ cat >> test-bisect.t <<EOF
|
|
|
|
> $ echo pass
|
|
|
|
> fail
|
|
|
|
> EOF
|
|
|
|
$ hg ci -m 'bad'
|
|
|
|
$ rt --known-good-rev=0 test-bisect.t
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/bisect/test-bisect.t
|
|
|
|
+++ $TESTTMP/anothertests/bisect/test-bisect.t.err
|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
$ echo pass
|
|
|
|
pass
|
|
|
|
$ echo pass
|
|
|
|
- fail
|
|
|
|
+ pass
|
|
|
|
|
|
|
|
ERROR: test-bisect.t output changed
|
|
|
|
!
|
|
|
|
Failed test-bisect.t: output changed
|
|
|
|
test-bisect.t broken by 72cbf122d116 (bad)
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
2016-03-19 21:26:10 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2017-05-17 09:10:31 +03:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2017-08-03 07:24:29 +03:00
|
|
|
support bisecting a separate repo
|
|
|
|
|
|
|
|
$ hg init bisect-dependent
|
|
|
|
$ cd bisect-dependent
|
|
|
|
$ cat > test-bisect-dependent.t <<EOF
|
|
|
|
> $ tail -1 \$TESTDIR/../bisect/test-bisect.t
|
|
|
|
> pass
|
|
|
|
> EOF
|
|
|
|
$ hg commit -Am dependent test-bisect-dependent.t
|
|
|
|
|
|
|
|
$ rt --known-good-rev=0 test-bisect-dependent.t
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
|
|
|
|
+++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ tail -1 $TESTDIR/../bisect/test-bisect.t
|
|
|
|
- pass
|
|
|
|
+ fail
|
|
|
|
|
|
|
|
ERROR: test-bisect-dependent.t output changed
|
|
|
|
!
|
|
|
|
Failed test-bisect-dependent.t: output changed
|
|
|
|
Failed to identify failure point for test-bisect-dependent.t
|
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ rt --bisect-repo=../test-bisect test-bisect-dependent.t
|
|
|
|
Usage: run-tests.py [options] [tests]
|
|
|
|
|
|
|
|
run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
|
|
|
|
[2]
|
|
|
|
|
|
|
|
$ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
|
|
|
|
+++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
$ tail -1 $TESTDIR/../bisect/test-bisect.t
|
|
|
|
- pass
|
|
|
|
+ fail
|
|
|
|
|
|
|
|
ERROR: test-bisect-dependent.t output changed
|
|
|
|
!
|
|
|
|
Failed test-bisect-dependent.t: output changed
|
|
|
|
test-bisect-dependent.t broken by 72cbf122d116 (bad)
|
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2017-05-31 03:48:43 +03:00
|
|
|
Test a broken #if statement doesn't break run-tests threading.
|
|
|
|
==============================================================
|
|
|
|
$ mkdir broken
|
|
|
|
$ cd broken
|
|
|
|
$ cat > test-broken.t <<EOF
|
|
|
|
> true
|
|
|
|
> #if notarealhghavefeature
|
|
|
|
> $ false
|
|
|
|
> #endif
|
|
|
|
> EOF
|
|
|
|
$ for f in 1 2 3 4 ; do
|
|
|
|
> cat > test-works-$f.t <<EOF
|
|
|
|
> This is test case $f
|
|
|
|
> $ sleep 1
|
|
|
|
> EOF
|
|
|
|
> done
|
|
|
|
$ rt -j 2
|
|
|
|
....
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 5 tests, 0 skipped, 0 failed.
|
2017-05-31 03:48:43 +03:00
|
|
|
skipped: unknown feature: notarealhghavefeature
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ rm -rf broken
|
|
|
|
|
2017-05-17 09:10:31 +03:00
|
|
|
Test cases in .t files
|
|
|
|
======================
|
|
|
|
$ mkdir cases
|
|
|
|
$ cd cases
|
|
|
|
$ cat > test-cases-abc.t <<'EOF'
|
|
|
|
> #testcases A B C
|
|
|
|
> $ V=B
|
|
|
|
> #if A
|
|
|
|
> $ V=A
|
|
|
|
> #endif
|
|
|
|
> #if C
|
|
|
|
> $ V=C
|
|
|
|
> #endif
|
|
|
|
> $ echo $V | sed 's/A/C/'
|
|
|
|
> C
|
|
|
|
> #if C
|
|
|
|
> $ [ $V = C ]
|
|
|
|
> #endif
|
|
|
|
> #if A
|
|
|
|
> $ [ $V = C ]
|
|
|
|
> [1]
|
|
|
|
> #endif
|
|
|
|
> #if no-C
|
|
|
|
> $ [ $V = C ]
|
|
|
|
> [1]
|
|
|
|
> #endif
|
|
|
|
> $ [ $V = D ]
|
|
|
|
> [1]
|
|
|
|
> EOF
|
|
|
|
$ rt
|
|
|
|
.
|
|
|
|
--- $TESTTMP/anothertests/cases/test-cases-abc.t
|
|
|
|
+++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
|
|
|
|
@@ -7,7 +7,7 @@
|
|
|
|
$ V=C
|
|
|
|
#endif
|
|
|
|
$ echo $V | sed 's/A/C/'
|
|
|
|
- C
|
|
|
|
+ B
|
|
|
|
#if C
|
|
|
|
$ [ $V = C ]
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ERROR: test-cases-abc.t (case B) output changed
|
|
|
|
!.
|
|
|
|
Failed test-cases-abc.t (case B): output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 3 tests, 0 skipped, 1 failed.
|
2017-05-17 09:10:31 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
--restart works
|
|
|
|
|
|
|
|
$ rt --restart
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/cases/test-cases-abc.t
|
|
|
|
+++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
|
|
|
|
@@ -7,7 +7,7 @@
|
|
|
|
$ V=C
|
|
|
|
#endif
|
|
|
|
$ echo $V | sed 's/A/C/'
|
|
|
|
- C
|
|
|
|
+ B
|
|
|
|
#if C
|
|
|
|
$ [ $V = C ]
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ERROR: test-cases-abc.t (case B) output changed
|
|
|
|
!.
|
|
|
|
Failed test-cases-abc.t (case B): output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2017-05-17 09:10:31 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2017-06-08 07:17:24 +03:00
|
|
|
|
|
|
|
--restart works with outputdir
|
|
|
|
|
|
|
|
$ mkdir output
|
|
|
|
$ mv test-cases-abc.t.B.err output
|
|
|
|
$ rt --restart --outputdir output
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/cases/test-cases-abc.t
|
|
|
|
+++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
|
|
|
|
@@ -7,7 +7,7 @@
|
|
|
|
$ V=C
|
|
|
|
#endif
|
|
|
|
$ echo $V | sed 's/A/C/'
|
|
|
|
- C
|
|
|
|
+ B
|
|
|
|
#if C
|
|
|
|
$ [ $V = C ]
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ERROR: test-cases-abc.t (case B) output changed
|
|
|
|
!.
|
|
|
|
Failed test-cases-abc.t (case B): output changed
|
2017-06-04 03:22:45 +03:00
|
|
|
# Ran 2 tests, 0 skipped, 1 failed.
|
2017-06-08 07:17:24 +03:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2017-11-05 08:34:27 +03:00
|
|
|
|
|
|
|
Test automatic pattern replacement
|
|
|
|
|
|
|
|
$ cat << EOF >> common-pattern.py
|
|
|
|
> substitutions = [
|
|
|
|
> (br'foo-(.*)\\b',
|
|
|
|
> br'\$XXX=\\1\$'),
|
|
|
|
> (br'bar\\n',
|
|
|
|
> br'\$YYY$\\n'),
|
|
|
|
> ]
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat << EOF >> test-substitution.t
|
|
|
|
> $ echo foo-12
|
|
|
|
> \$XXX=12$
|
|
|
|
> $ echo foo-42
|
|
|
|
> \$XXX=42$
|
|
|
|
> $ echo bar prior
|
|
|
|
> bar prior
|
|
|
|
> $ echo lastbar
|
|
|
|
> last\$YYY$
|
|
|
|
> $ echo foo-bar foo-baz
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ rt test-substitution.t
|
|
|
|
|
|
|
|
--- $TESTTMP/anothertests/cases/test-substitution.t
|
|
|
|
+++ $TESTTMP/anothertests/cases/test-substitution.t.err
|
|
|
|
@@ -7,3 +7,4 @@
|
|
|
|
$ echo lastbar
|
|
|
|
last$YYY$
|
|
|
|
$ echo foo-bar foo-baz
|
|
|
|
+ $XXX=bar foo-baz$
|
|
|
|
|
|
|
|
ERROR: test-substitution.t output changed
|
|
|
|
!
|
|
|
|
Failed test-substitution.t: output changed
|
|
|
|
# Ran 1 tests, 0 skipped, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|