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
|
|
|
|
|
|
|
# Ran 0 tests, 0 skipped, 0 warned, 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
|
|
|
|
|
|
|
|
# Ran 0 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
$ 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
|
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
$ 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 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
|
|
|
|
> $ echo "bar-baz"; echo "bar-bad"
|
|
|
|
> bar*bad (glob)
|
|
|
|
> bar*baz (glob)
|
|
|
|
> EOF
|
|
|
|
$ rt test-failure.t
|
|
|
|
|
|
|
|
--- $TESTTMP/test-failure.t
|
|
|
|
+++ $TESTTMP/test-failure.t.err
|
|
|
|
@@ -1,3 +1,3 @@
|
|
|
|
$ echo "bar-baz"; echo "bar-bad"
|
|
|
|
+ bar*baz (glob)
|
|
|
|
bar*bad (glob)
|
|
|
|
- bar*baz (glob)
|
|
|
|
|
|
|
|
ERROR: test-failure.t output changed
|
|
|
|
!
|
|
|
|
Failed test-failure.t: output changed
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
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
|
|
|
|
# Ran 3 tests, 0 skipped, 0 warned, 2 failed.
|
2014-05-30 23:10:56 +04:00
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
2015-03-29 20:41:23 +03:00
|
|
|
|
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
|
|
|
|
# Ran 3 tests, 0 skipped, 0 warned, 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)
|
|
|
|
<![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)
|
|
|
|
]]> </testcase>
|
2014-08-06 05:17:11 +04:00
|
|
|
<testcase name="test-failure.t" time="*"> (glob)
|
|
|
|
<![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............................................................
|
2014-08-06 05:17:11 +04:00
|
|
|
]]> </testcase>
|
|
|
|
</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)
|
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.
|
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
|
2014-07-29 03:48:59 +04:00
|
|
|
# Ran 2 tests, 1 skipped, 0 warned, 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
|
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
|
|
|
.
|
|
|
|
# Ran 2 tests, 1 skipped, 0 warned, 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
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
2014-08-12 09:33:48 +04:00
|
|
|
# Ran 2 tests, 1 skipped, 0 warned, 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)
|
2015-12-28 19:01:31 +03:00
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 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
|
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
$ 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
|
|
|
.
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 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)
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 2 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
2014-10-09 23:10:40 +04:00
|
|
|
failures in parallel with --first should only print one failure
|
|
|
|
>>> f = open('test-nothing.t', 'w')
|
2015-04-13 23:37:53 +03:00
|
|
|
>>> f.write('foo\n' * 1024) and None
|
|
|
|
>>> f.write(' $ sleep 1') and None
|
2015-12-07 00:14:01 +03:00
|
|
|
$ rt --jobs 2 --first
|
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)
|
2015-03-29 05:39:03 +03:00
|
|
|
Failed test-nothing.t: output changed
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 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)
|
2014-10-09 23:10:40 +04:00
|
|
|
$ rm test-failure-copy.t test-nothing.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
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
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] ..
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
|
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
|
|
|
|
|
|
|
(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
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
|
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
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-slow-timeout.t: missing feature: allow slow tests
|
2015-11-25 03:39:05 +03:00
|
|
|
Failed test-timeout.t: timed out
|
|
|
|
# Ran 1 tests, 1 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
|
|
|
# Ran 2 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
# 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
# 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
|
|
|
|
# Ran 2 tests, 1 skipped, 0 warned, 1 failed.
|
|
|
|
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
|
2014-08-12 09:33:48 +04:00
|
|
|
# Ran 2 tests, 2 skipped, 0 warned, 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
|
2014-08-12 09:33:48 +04:00
|
|
|
# Ran 2 tests, 2 skipped, 0 warned, 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)
|
|
|
|
</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
|
|
|
|
# Ran 0 tests, 2 skipped, 0 warned, 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
|
|
|
|
# Ran 1 tests, 1 skipped, 0 warned, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|
|
|
|
|
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
|
|
|
|
# Ran 2 tests, 1 skipped, 0 warned, 1 failed.
|
|
|
|
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)
|
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
|
2015-05-09 05:32:11 +03:00
|
|
|
# Ran 2 tests, 1 skipped, 0 warned, 0 failed.
|
|
|
|
|
|
|
|
$ 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
|
|
|
|
$ 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 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"
|
|
|
|
> $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
|
|
|
|
> #!/usr/bin/env python
|
|
|
|
> #
|
|
|
|
> # 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
|
|
|
|
|
|
|
#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
|
2015-12-22 11:00:03 +03:00
|
|
|
Skipped test-very-slow-test.t: missing feature: allow slow tests
|
2015-08-25 05:23:45 +03:00
|
|
|
# Ran 0 tests, 1 skipped, 0 warned, 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
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 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
|
|
|
|
.
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 0 failed.
|
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)
|
|
|
|
# Ran 1 tests, 0 skipped, 0 warned, 1 failed.
|
|
|
|
python hash seed: * (glob)
|
|
|
|
[1]
|