Commit Graph

249 Commits

Author SHA1 Message Date
Mads Kiilerich
9bb6f6608a run-tests: expand user in --with-hg
This makes it possible to run:
  $ ./run-tests.py --with-hg=~/hg-bin/hg
2012-01-14 01:56:27 +01:00
Mads Kiilerich
41bb79518b tests: let run-tests.py default to use 'sh' in $PATH instead of '/bin/sh'
This makes it easier to run tests on systems that have a usable sh in the
search path but not in the standard location.
2012-01-20 01:24:16 +01:00
Mads Kiilerich
efadf4b249 tests: add 'set -x' to the .t sh scripts in run-tests.py debug mode
This makes -d output much more readable when debugging the test framework or
very strange test failures.
2012-01-14 01:55:50 +01:00
Markus Zapke-Gründemann
46ae5d8243 tests: add htmlcov option 2012-01-11 15:38:31 +01:00
Matt Mackall
f2d5e5c061 run-tests: use a list comprehension instead of map 2012-01-12 14:39:02 -06:00
Markus Zapke-Gründemann
9311522001 tests: fix omit path list
All directories need a trailing asterisk. Otherwise the files are not excluded
from coverage.
2012-01-11 15:37:25 +01:00
Mads Kiilerich
210dda88ee tests: use an alias to make msys 'pwd' return paths with forward slashes 2011-11-21 01:49:20 +01:00
Mads Kiilerich
e0ce7904f7 tests: use the specified shell for running old fashioned sh tests 2011-11-16 03:45:14 +01:00
Mads Kiilerich
725ccda893 run-tests: make $TESTTMP matching case-insensitive on windows 2011-11-07 03:25:10 +01:00
Mads Kiilerich
b38bca46c2 run-tests: don't quote command names - that do apparently not work with msys 2011-11-07 03:25:10 +01:00
Mads Kiilerich
460890c579 tests: ignore \r on windows 2011-11-07 03:25:10 +01:00
Mads Kiilerich
d71aaf4c6b run-tests: convert windows paths to unix 2011-11-07 03:25:10 +01:00
Mads Kiilerich
8c22a0ec28 tests: make (glob) on windows accept \ instead of /
Globbing is usually used for filenames, so on windows it is reasonable and very
convenient that glob patterns accepts '\' or '/' when the pattern specifies
'/'.
2011-11-07 03:25:10 +01:00
Mads Kiilerich
d9065e4fb9 tests: make '(esc)' matching in run-tests.py work as intended
The code for match on (esc) lines didn't work, and it would thus always end up
emitting another suggestion ... which however would match the old one.
2011-11-07 02:44:04 +01:00
Matt Mackall
17d82e7fd5 run-tests: replace inline python handling with more native scheme
Normally changes in tests are reported like this in diffs:

   $ cat foo
-  a
+  b

Using -i mode lets us update tests when the new results are correct
and/or populate tests with their output.

But with the standard doctest framework, inline Python sections in
tests changes instead result in a big failure report that's unhelpful.
So here, we replace the doctest calls with a simple compile/eval loop.
2011-11-07 13:46:41 -06:00
Matt Mackall
88220425c1 run-tests: minor cleanups 2011-11-03 15:18:10 -05:00
Matt Mackall
4f749024f0 run-tests: pull out line matching function 2011-11-03 15:08:45 -05:00
Matt Mackall
e770714829 run-tests: pull out unified matching funcs 2011-11-03 14:51:04 -05:00
Matt Mackall
5f6366d991 tests: add some comments to the unified test code 2011-11-03 14:48:56 -05:00
Matt Mackall
65859d124f tests: rewrite inline Python support
Tests with inline Python could turn '>>>' into their underlying python
invocation if the test got updated with -i.
2011-11-03 14:30:00 -05:00
Thomas Arendsen Hein
e30c56ef39 run-tests: make sure no_proxy/NO_PROXY are empty to fix test-http-proxy.t
If no_proxy (or NO_PROXY) includes localhost, the test for detecting an
unreachable proxy fails, because the proxy setting is ignored.
2011-10-22 23:21:38 +02:00
Idan Kamara
3cb661bac7 run-tests: end doctest block when seeing a non-command 2011-10-13 17:54:37 +02:00
Idan Kamara
cb06843ca5 tests: add support for inline doctests in test files
This adds doctest like syntax to .t files, that can be interleaved with regular
shell code:

  $ echo -n a > file
  >>> print open('file').read()
  a
  >>> open('file', 'a').write('b')
  $ cat file
  ab

The syntax is exactly the same as regular doctests, so multiline statements
look like this:

  >>> for i in range(3):
  ...     print i
  0
  1
  2

Each block has its own context, i.e.:

  >>> x = 0
  >>> print x
  0
  $ echo 'foo'
  foo
  >>> print x

will result in a NameError.

Errors are displayed in standard doctest format:

  >>> print 'foo'
  bar

  --- /home/idan/dev/hg/default/tests/test-test.t
  +++ /home/idan/dev/hg/default/tests/test-test.t.err
  @@ -2,3 +2,16 @@
     > >>> print 'foo'
     > bar
     > EOF
  +  **********************************************************************
  +  File "/tmp/tmps8X_0ohg-tst", line 1, in tmps8X_0ohg-tst
  +  Failed example:
  +      print 'foo'
  +  Expected:
  +      bar
  +  Got:
  +      foo
  +  **********************************************************************
  +  1 items had failures:
  +     1 of   1 in tmps8X_0ohg-tst
  +  ***Test Failed*** 1 failures.
  +  [1]

As for the implementation, it's quite simple: when the test runner sees a line
starting with '>>>' it converts it, and all subsequent lines until the next
line that begins with '$' to a 'python -m heredoctest <<EOF' call with the
proper heredoc to follow. So if we have this test file:

  >>> for c in 'abcd':
  ...     print c
  a
  b
  c
  d
  $ echo foo
  foo

It gets converted to:

  $ python -m heredoctest <<EOF
  > >>> for c in 'abcd':
  > ...     print c
  > a
  > b
  > c
  > d
  > EOF
  $ echo foo
  foo

And then processed like every other test file by converting it to a sh script.
2011-10-12 22:01:14 +02:00
Augie Fackler
dfe2a9638f tests: use getattr instead of hasattr 2011-07-25 16:37:18 -05:00
Patrick Mezard
f7c5a41400 run-tests: fix summary when accepting changes interactively
Accepted changes were not counted as success.
2011-07-13 19:23:08 +02:00
Thomas Arendsen Hein
0b341ae9aa run-test: revert most of 723925f3994b, timeout uses fallback for terminate() 2011-06-30 16:36:38 +02:00
Thomas Arendsen Hein
3453fd49fa run-tests: fallback to SIGTERM if subprocess.Popen does not have terminate() 2011-06-30 16:25:05 +02:00
Idan Kamara
cf84c46249 run-tests: verbose log ignored test 2011-06-12 17:26:20 +03:00
Augie Fackler
6f67427a80 run-tests: allow whitelisting tests that should always run
It's desirable to run some tests all the time, for example
test-check-pyflakes.t and test-check-code-hg.py. This allows passing
--whitelist as a path to a file (flag can be specified more than once)
which contains a list of files to whitelist. Whitelisted tests are run
even if they're blacklisted or wouldn't match a --keyword test
run. For example, to do a quick test of usehttp2, one can now do

  $ cat > test-whitelist <<EOF
  > test-check-pyflakes.t
  > test-check-code-hg.py
  > EOF
  $ (cd tests && ./run-tests.py --extra-config-opt 'ui.usehttp2=true'
  >                             -k http -j 8  --whitelist test-whitelist)

and have all http-specific tests run as well as the two code linters.
2011-05-31 20:39:04 -05:00
Patrick Mezard
51439bc0e1 run-tests: fix --blacklist (broken by 098f69771978) 2011-05-28 11:44:27 +02:00
Idan Kamara
f4c2cac599 run-tests: fix --blacklist with jobs > 1
filter blacklisted tests before partitioning them
to the children.

maintains the 'Skipped...' output but not the 's'.
2011-05-27 17:46:48 +03:00
Idan Kamara
13676f41c0 run-tests: slightly simplify blacklist check 2011-05-27 17:46:47 +03:00
Thomas Arendsen Hein
843bd0fb63 run-tests: print a newline after all warnings 2011-05-18 15:45:57 +02:00
Patrick Mezard
f88224316a run-tests: replace chdir() with Popen cwd option 2011-05-16 21:56:26 +02:00
Patrick Mezard
7f9abee9a9 run-tests: make --debug run in the temporary test directory 2011-05-16 21:54:43 +02:00
Patrick Mezard
7151b3e567 run-tests: use the common test path on Windows and Java
The alternate one did not run in the test directory and controlling
the jobs execution with threads instead of process made it harder
to fix.
2011-05-16 21:52:28 +02:00
Patrick Mezard
ee13516475 run-tests: ignore timeout when Popen.terminate is unavailable
Popen.terminate was introduced in python 2.6
2011-05-16 21:41:46 +02:00
Patrick Mezard
c7b66c8493 run-tests: fix hg.bat python reference
hg.bat expects to live in pythonxx/scripts and the python interpreter
to be in pythonxx. run-tests.py file layout is a little different and
python location must be fixed.
2011-05-16 21:26:50 +02:00
Patrick Mezard
954f0d5383 run-tests: fix python executable detection and copy on Windows 2011-05-16 21:24:14 +02:00
Martin Geisler
d899298b13 run-tests: remove check on --shell argument
No shell is needed when executing Python tests and finding a good
shell might be difficult/impossible on some platforms (e.g., Windows).
2011-05-09 17:20:15 +02:00
Idan Kamara
cc5617ae4e run-tests: take the basepath when constructing the test temp dir
so it's possible to run tests that are outside the test/ dir
2011-05-07 21:01:15 +03:00
Idan Kamara
382db50197 run-tests: compare absolute paths in _checkhglib 2011-05-07 20:56:43 +03:00
Martin Geisler
4a2bc65e8a run-tests: add --shell command line flag
This makes it easy to test with, say, both /bin/bash and /bin/dash
instead of changing the system-wide /bin/sh.
2011-05-05 20:04:49 +02:00
Martin Geisler
027d8985b0 run-tests: use type of default to convert environment variable
Before, defaults could only be integers, they can now also be strings,
floats and what have you.
2011-05-05 20:03:43 +02:00
Augie Fackler
c62bb34caf run-tests.py: correctly handle list options with parallel tasks 2011-05-04 10:39:10 -05:00
Augie Fackler
3d09b5a236 run-tests: add flag to provide extra hgrc options for test runs 2011-05-01 08:00:25 -05:00
Idan Kamara
b6a9ab1966 run-tests: print a new line before writing the diff 2011-04-30 15:20:27 +03:00
Idan Kamara
56c14a6116 run-tests: don't count test as succeeded if it failed
regressed around 96f44260c0a0
2011-04-29 20:29:22 +03:00
Matt Mackall
390ca3b942 run-tests: do chdir for tests under a lock for thread safety 2011-04-25 17:01:34 -05:00
Matt Mackall
8e4d999508 run-tests: add iolock to vlog 2011-04-25 16:17:08 -05:00