Commit Graph

927 Commits

Author SHA1 Message Date
Martin von Zweigbergk
63ec7f9083 run-tests: warn if --color=always and no pygments installed
Differential Revision: https://phab.mercurial-scm.org/D117
2017-07-17 16:27:13 -07:00
Martin von Zweigbergk
41812f06d0 run-tests: drop unnecessary check for pygmentspresent
47985606a0ae (run-tests: check if stream is a tty before using color,
2017-07-18) made the check redundant but forgot to remove it.

Differential Revision: https://phab.mercurial-scm.org/D116
2017-07-17 16:28:42 -07:00
Martin von Zweigbergk
b32f922e53 run-tests: pass color option via test case object , not global var
At first I updated the color field of the 'options' object (from the
CLI parser), but then I decided to put it directly on the test case
object itself to avoid mutating the shared object (even though all
tests would have the same value).

Differential Revision: https://phab.mercurial-scm.org/D114
2017-07-17 16:15:15 -07:00
Matthieu Laneuville
ab721e92b9 run-tests: check if stream is a tty before using color
Previous implementation (ccf66c9bf5af) checked only if sys.stderr was a tty
which was less general. Also makes sure that colors is never used if pygments is
not available, irrespective of --color flag value.
2017-07-18 07:19:26 +09:00
Pulkit Goyal
2ceeb040ad run-tests: make sure to check if pygments is installed before using it
e80041832e introduced support to color the output of tests but used pygments
without checking whether it's installed or not. That breaks test-run-tests.t for
machines which don't have pygments installed. This patch conditionalize the
color test in test-run-tests.t and also add a check to make sure pygments is
installed before using that.
2017-07-15 02:17:05 +05:30
Matt Harbison
bf865ea34e run-tests: disable color on Windows
More Windows sadness.  Maybe someone can figure out how to make win32 color
work, but I think we avoid importing stuff from the mercurial package in this
module.  On the plus side, this conditionalizes away a test failure.
2017-07-15 00:52:36 -04:00
Matthieu Laneuville
91e78ef185 run-tests: add color to output if pygments is available
The output of run-tests has no formatting by default, which hampers readability.
This patch colors the diff output when pygments is available. To avoid coloring
even when pygments is available, use --color never.
2017-06-29 20:45:12 +09:00
Yuya Nishihara
8f9aa59cf3 tests: actually restore the original environment before running syshg
Since os.environ may be overridden in run-tests.py, several important
variables such as PATH weren't restored.

I don't like the idea of using the system hg *by default* because the
executable and the configs are out of our control. But I don't mind as
long as the tests pass.
2017-06-30 21:49:29 +09:00
Adam Simpkins
7b7dd183b0 tests: fix variable name regular expression in _genrestoreenv()
Update the code to correctly anchor the expression on the end of the name, to
require that the entire name match this expression.  It was already anchored at
the start by using re.match(), but this does not anchor it at the end.
2017-06-29 11:29:19 -07:00
Adam Simpkins
738cc44d4e tests: more completely restore the environment in syshgenv
Update the syshgenv function to attempt to completely restore the original
environment, rather than only updating a few specific variables.  run_tests.py
now generates a shell script that can be used to restore the original
environment, and syshgenv sources it.

This is a bit more complicated than the previous code, but should do a better
job of running the system hg in the correct environment.

I've tested it on Linux using python 2.x, but let me know if it causes issues
in other environments.  I'm not terribly familiar with how the tests get run on
Windows, for instance, and how the environment needs to be updated there.
2017-06-28 12:23:22 -07:00
Adam Simpkins
b5772c6bc4 tests: save the original PATH and PYTHONPATH variables
When running the tests, define ORIG_PATH and ORIG_PYTHONPATH environment
variables that contain the original contents of PATH and PYTHONPATH, before
they were modified by run-tests.py

This will make it possible for tests to refer to the original contents of these
variables if necessary.  In particular, this is necessary for invoking the
correct version of hg for examining the local repository (the mercurial
repository itself, not the temporary test repositories).  Various tests examine
the local repository to check the file lists and contents of commit messages.
2017-06-27 17:24:31 -07:00
Jun Wu
f17b667b60 run-tests: fix -i when "#testcases" is used in .t test
The "#testcases" feature introduced by 250afd791085 has issues with "-i"
because "-i" uses "test.name.endswith('.t')" to test if a test is .t or not.

test.name could now be something like "test-foo.t (caseA)" so the above
endswith test is no longer valid.

This patch changes the test to use "self.path" which won't have the issue.
2017-06-21 01:12:31 -07:00
Jun Wu
ca342cbec6 run-tests: update .t reference output after reading the test
The .t file is both test input and reference output. They should always
match. However we have different code paths to read reference output
(Test.__init__ -> Test.readrefout) and test input (TTest._run) so they might
be inconsistent if somethings change the file between those two functions.

This patch assigns "lines" read by "_run" back to "_refout" if "_refout" is
not None (with --debug, see Test.readrefout) so reference output and test
input will always match.
2017-06-21 01:12:31 -07:00
Jun Wu
df1862bacf run-tests: do not prompt changes (-i) if a race condition is detected
The race condition is like:

  1. run-tests.py reads test-a.t as reference output, content A
  2. run-tests.py runs the test (which could be content B, another race
     condition fixed by the next patch, but assume it's content A here)
  3. something changes test-a.t to content C
  4. run-tests.py compares test output (content D) with content A
  5. with "-i", run-tests.py prompts diff(A, D), while the file has content
     C instead of A at this time

This patch detects the above case and tell the user to rerun the test if
they want to apply test changes.
2017-06-21 01:05:20 -07:00
Gregory Szorc
fc4c9d6ad7 tests: removed ReportedTest exception
The only call site called addFailure before raising, which is
exactly what the failure exception handler does. So this
complexity is not needed.

We have test coverage of this "server failed to start" scenario
and nothing appeared to change.
2017-06-03 17:32:52 -07:00
Gregory Szorc
896a966845 tests: remove support for warned tests
The previous changeset removed the last caller of addWarn(). So,
we rip out that method and all the code related to tracking warned
tests in the results system.

There was even a comment saying we may want to fold warned tests into
the "failed" state, which is what the previous changeset did.
2017-06-03 17:22:45 -07:00
Gregory Szorc
ef424bd1cf tests: remove WarnTest
We would raise this if a test didn't return a result code. AFAICT
this can only occur if there is a logic error in the test harness
itself.

I don't think it is worth the code complexity to distinguish this
failure scenario from a regular test failure.
2017-06-03 17:13:35 -07:00
Gregory Szorc
52ea71bafe tests: remove unused IgnoreTest exception
AFAICT its last use was removed in dac81132c652.
2017-06-03 17:09:13 -07:00
Gregory Szorc
e7d240ea93 tests: use unittest.SkipTest
unittest.SkipTest was introduced in Python 2.7. We previously defined
it with our own class so we could run on Python 2.6.
2017-06-03 17:04:42 -07:00
Matt Harbison
2ca7e36798 run-tests: explicitly flush test runner output for Windows stability
When hghave testing goes awry, the output order was changing on Windows.

  diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
  --- a/tests/test-run-tests.t
  +++ b/tests/test-run-tests.t
  @@ -920,10 +920,10 @@
      > EOF
      > done
      $ rt -j 2
  -  ....
  +  ....skipped: unknown feature: notarealhghavefeature\r (esc)
  +
  +
      # Ran 5 tests, 0 skipped, 0 warned, 0 failed.
  -  skipped: unknown feature: notarealhghavefeature
  -
      $ cd ..
      $ rm -rf broken

Since 'skipped: unknown feature: notarealhghavefeature\n\n' is printed to stdout
and the rest to stderr, it seems like maybe stdio isn't line buffered on
Windows.  When a program exits, stdout is flushed before stderr[1].

[1] https://blogs.msdn.microsoft.com/oldnewthing/20060519-09/?p=31133
2017-06-18 22:19:54 -04:00
Augie Fackler
b3e56018f0 tests: try and fail more gracefully with broken unicode escapes 2017-06-15 13:13:36 -04:00
Siddharth Agarwal
1a9dd59bc4 run-tests: make --restart work with output dir 2017-06-07 21:17:24 -07:00
Siddharth Agarwal
dc354fabde run-tests: output coverage to output dir
There do not appear to be any tests for this, and I've never used either of
these options before, but this works.
2017-06-07 21:17:06 -07:00
Siddharth Agarwal
7a8b4a7007 run-tests: write JSON reports to output dir 2017-06-07 20:46:43 -07:00
Siddharth Agarwal
8cbca49faa run-tests: write test times to output dir 2017-06-07 20:32:11 -07:00
Siddharth Agarwal
3c77851e4b run-tests: allow specifying an output dir to write .errs to
I'm trying to use run-tests.py on a read-only file system. This series allows
that to happen.
2017-06-07 20:30:08 -07:00
Siddharth Agarwal
7eab0d3988 run-tests: add information about skipped tests to XUnit output
The XUnit spec supports skipped tests.
2017-06-07 15:47:06 -07:00
Siddharth Agarwal
1c6373299a run-tests: wrap failures in an XUnit 'failure' element
This is closer to what most XUnit consumers can understand.
2017-06-07 15:47:06 -07:00
Augie Fackler
19a29b2751 tests: remove sys.executable from "required tools"
In practice this doesn't appear to have been true for some time - we
reference Python using the $PYTHON variable in all the tests now
(which we have to for PyPy and Python 3), and I've been using
~/.../python.exe to test with tip of the cpython 3.6 release branch
while working on manifest tests in Python 3 and everything seems to be
just fine. The only real observable difference from this change is
that I stop getting a warning about python.exe not being a thing on
$PATH, which seems like an improvement.
2017-05-28 21:33:33 -04:00
Siddharth Agarwal
d9e3c09954 run-tests: add a way to list tests, with JSON and XUnit support
Some test runners are interested in listing tests, so they can do their own
filtering on top (usually based on attributes like historically observed
runtime). Add support for that.
2017-06-06 14:38:59 -07:00
Siddharth Agarwal
edb24a5486 run-tests: install hg after computing tests to run
We're going to add a way to list tests, and we don't need to install hg for
that.
2017-06-06 13:56:53 -07:00
Siddharth Agarwal
6f1897a3a9 run-tests: make time field optional for xunit report
We're going to use XUnit to list tests, and we don't have a time field in that
case.
2017-06-06 13:52:25 -07:00
Siddharth Agarwal
7e8e3a62b8 run-tests: factor out json write code into another method
We're going to use this code to output a JSON-formatted listing of tests.
2017-06-06 13:10:55 -07:00
Siddharth Agarwal
24946b1477 run-tests: factor out xunit write code into another method
We're going to use this code to output an XUnit-formatted listing of tests.
2017-06-06 13:10:55 -07:00
Augie Fackler
2a698100ca tests: fix run-tests when there's a bad #if in a test
That has (and still does) caused the test to be skipped, but without
this fix it was possible to exit this block of code without clearing
the output channel, which poisoned the channel list for later test
method runs. Fix this by always clearing the channel in a finally.

The test for this is somewhat unfortunate. Sadly, I couldn't get a way
to reproduce this with less than 2n+1 test cases, nor could I get it
to reproduce reliably without the sleep statements. It's also crucial
that the test with the broken #if be smaller (in terms of byte count)
than the sleeping tests, so that it runs first and would poison the
channel list prior to another test needing that entry from the list.
2017-05-30 20:48:43 -04:00
Augie Fackler
abf4e54b20 tests: make run-tests fail early if no channel is found
I hit a weird corner case in run-tests where a test that caused an
exception to be raised was breaking everything with an unbound
variable error a few lines down because channel was never getting set
in this for loop. By adding an `else` clause to this for loop, we can
explode right away if we can't find a channel and give the developer a
better chance at figuring out what's going on.
2017-05-30 20:47:00 -04:00
Boris Feld
59e3c73ea0 test: remove aliases forcing date, use default-date
Now that we have the default-date by default and all code have been updated,
remove the old commands alias that forced the date as they are not longer
useful.

Writing tests now should be easier for everyone now that all dates should be
stable.
2017-05-22 19:29:21 +02:00
Pierre-Yves David
bb04bb0f0e devel: activate default-date in tests
It will make writing future tests more easier for everyone as we won't need to
glob dates anymore in tests.
2017-05-22 16:59:57 +02:00
Gregory Szorc
87d24f1e62 run-tests: remove references to Python 2.6
These are the obvious ones. There is tons of code in this file
implementing features from unittest that weren't present in
Python 2.6. But that's for other patches.
2017-05-19 19:46:45 -07:00
Kostia Balytskyi
3d3055016f run-tests: allow hg executable to be hg.exe
When running tests on Windows (via msys), user sometimes does not want to run
them against source hg, but against compiled hg.exe. For that purpose,
--with-hg option can be used, but currently run-tests.py prints a warning if
the value of this argument is not a file with basename 'hg'. This patch allows
such file to be 'hg.exe'.
2017-05-17 12:51:40 -07:00
Jun Wu
70f3088190 run-tests: support multiple cases in .t test
Sometimes we want to run similar tests with slightly different
configurations. Previously we duplicate the test files. This patch
introduces special "#testcases" syntax that allows a single .t file to
contain multiple test cases.

Defined cases could be tested using "#if".

For example, if a test should behave the same with or without an
experimental flag, we can add the following to the .t header:

    #testcases default experimental-a
    #if experimental-a
      $ cat >> $HGRCPATH << EOF
      > [experimental]
      > feature=a
      > EOF
    #endif

The "experimental-a" block won't be executed when running the "default" test
case.
2017-05-16 23:10:31 -07:00
Jun Wu
519380fba4 run-tests: rename test description dict to testdesc
Previously the word "test" was used for both a Test instance and a path or
test dict. This patch renames them so it's clear that "testdesc" is the
dict, and "test" is the instance.
2017-05-16 21:17:40 -07:00
Jun Wu
21b8080c29 run-tests: change test identity from a path to a dict
Previously, we use path to identify a test. A later patch adds more
information so a path is not enough to identify a test. So we change it to a
dictionary.
2017-04-29 11:40:47 -07:00
Martin von Zweigbergk
5b1f074ab7 run-tests: drop fallback for proc.terminate() for pre-py2.6 2017-05-16 14:42:13 -07:00
Martin von Zweigbergk
35f361b3bc run-tests: drop fallback for sysconfig for pre-py2.7 2017-05-16 14:40:22 -07:00
Pierre-Yves David
a185960897 util: add a way to issue deprecation warning without a UI object
Our current deprecation warning mechanism relies on ui object. They are case
where we cannot have access to the UI object. On a general basis we avoid using
the python mechanism for deprecation warning because up to Python 2.6 it is
exposing warning to unsuspecting user who cannot do anything to deal with them.

So we build a "safe" strategy to hide this warnings behind a flag in an
environment variable. The test runner set this flag so that tests show these
warning.  This will help us marker API as deprecated for extensions to update
their code.
2017-04-04 11:03:29 +02:00
Matt Harbison
bcb0f3fe5c 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-05 23:17:27 -04:00
Matt Harbison
5ccbc1ad30 run-tests: prevent a (glob) declaration from reordering (?) lines
Previously, if a series of optional output lines marked with '(?)' had a (glob)
in one of the first lines, the output would be reordered such that it came last
if none of the lines were output.  The (re) declaration wasn't affected, which
was helpful in figuring this out.  There were no tests for '(re) (?)' so add
that to make sure everything plays nice.
2017-04-05 22:00:33 -04:00
Pierre-Yves David
7a17c488e7 run-tests: auto-replace 'TXNID' output
Hooks related to the transaction are aware of the transaction id. By definition
this txn-id is unique and different for each transaction. As a result it can
never be predicted in test and always needs matching. As a result, touching any
like with this data is annoying. We solve the problem once and for all by
installing an automatic replacement. In test, this will now show as:

  TXNID=TXN:$ID$
2017-03-30 17:29:03 +02:00
Jun Wu
35b00f22fa runtests: change local IP glob pattern from "127.0.0.1" to "$LOCALIP"
This is similar to what 9704c8e70d2d does. Since 1363aaf74791 has changed
"127.0.0.1" to "$LOCALIP". The glob pattern needs update accordingly. It is
expected to fix tests running in some BSD jails.
2017-03-26 19:57:17 -07:00
Jun Wu
0c169b3296 runtests: unset editor and pager related environment variables
Those environment variables could affect some configuration and future
tests. Drop them to avoid issues.
2017-03-26 20:58:54 -07:00
Yuya Nishihara
bde72b6ed6 tests: make run-tests.py run on Python 3 again 2017-03-08 22:12:49 +09:00
Dr Rainer Woitok
d0ce8b6088 tests: make test suite more immune to environment variables
Plenty of tests break when "make tests" is run while environment
variables "HGPLAIN" or "HGPLAINEXCEPT" are set (test "test-obsolete-
checkheads.t" is just a single example).

This patch causes script "run-tests.py" to also remove these two
variables from the environment the tests are executed in.
2017-02-20 18:27:29 +01:00
Jun Wu
49b1ca3043 runtests: add an IPv6 command line flag
Now we have all IPv6 related issues fixed, add a command line flag so people
could actually run tests with IPv6.
2017-02-17 01:21:15 -08:00
Jun Wu
d25b765433 runtests: always set web.ipv6
Previously, we only set web.ipv6 if IPv6 is used, but not on the IPv4 case.

Since we already have set web.address, it makes sense to move "web.ipv6" out
from "extra config options".
2017-02-16 08:43:59 -08:00
Jun Wu
ff1c9b7606 runtests: set web.address to localhost
Previously, "hg serve" will listen on "", which is not clear which interface
it will actually listen on - it could listen on all interfaces (ex. 0.0.0.0
on IPv4).

The run-tests.py script only checks "localhost" for available ports. So
let's make it the same for "hg serve" by explicitly setting "web.address" to
"localhost".

This resolves some IPv6 EADDRINUSE errors.
2017-02-16 00:13:29 -08:00
Jun Wu
7bdcbacb01 tests: use LOCALIP
This patch replaces hardcoded 127.0.0.1 with $LOCALIP in all tests.

Till now, the IPv6 series should make tests pass on common IPv6 systems
where the local device has the address "::1" and the hostname "localhost"
resolves to "::1".
2017-02-16 09:38:52 -08:00
Jun Wu
3279213400 runtests: export LOCALIP
Previously, tests hard-code local IP address as "127.0.0.1". That won't work
for IPv6.

This patch exports the $LOCALIP environment variable, which is set to "::1"
if we decide to use IPv6.
2017-02-16 08:01:19 -08:00
Jun Wu
596eb64899 runtests: export HGIPV6 to hint test scripts whether to use IPv6
Previously, run-tests.py only exports HGPORT, and scripts in tests do not
know if IPv6 should be used. And that breaks scripts like dumbhttp.py which
always uses IPv4.

This patch makes run-tests.py export HGIPV6, which can help test scripts
like dumbhttp.py and tinyproxy.py to decide whether to use IPv6 or not.
2017-02-15 21:03:42 -08:00
Jun Wu
c67bb1c41f runtests: prefer IPv4 to IPv6
To make IPv6 work, there are multiple areas that need to fix. Before they
all get fixed, use IPv4 by default.

This should fix tests caused on IPv6 systems.
2017-02-17 00:59:09 -08:00
Jun Wu
d91b33ad21 runtests: unindent an "if True" block
The block was left to make review easier. This patch unindents it.
2017-02-15 16:29:58 -08:00
Jun Wu
1719b329c6 runtests: set web.ipv6 if we use IPv6
As explained by the previous patch, we need to set "web.ipv6=True" if we
decide to use IPv6. Otherwise "hg serve" will still try to listen on IPv4.

This patch makes it so by appending web.ipv6 to "extra configs".

This patch was tested in a Linux system with IPv6, by the following steps:

  1. Change hgweb/server.py temporarily to write a file if
     IPv6HTTPServer.__init__ is called.
  2. run-tests.py -l --keep-tmpdir test-serve.t
  3. Check the generated .hgrc, make sure it sets web.ipv6=1.
  4. Check the log file to make sure IPv6HTTPServer.__init__ is called.
2017-02-15 16:43:27 -08:00
Jun Wu
98d255f62f runtests: checkportisavailable should only check one family
As explained by the previous patch, checkportisavailable() should only check
the preferred family - either IPv4 or IPv6, not both.

This patch makes it so.
2017-02-15 16:22:22 -08:00
Jun Wu
f724f29b99 runtests: add a function to test if IPv6 is available
Previously, checkportisavailable returns True if the port is free either on
IPv4 or IPv6, but the hg server only uses IPv4 by default. That leads to
issues when IPv4 port is not free but the IPv6 one is.

To address that, run-tests should stick with either IPv4 or IPv6. This patch
adds a function similar to checkportisavailable to test if IPv6 is
available, and assigns the result to a variable.

The new function was tested in a Linux system script with the following
steps:

  1. Run "ip addr del ::1/128 dev lo" to delete lo's IPv6 address,
     Confirm checkipv6available() returns False.
  2. Run "ip addr add ::1/128 dev lo" to add back lo's IPv6 address.
     Confirm checkipv6available() returns True.
  3. Start a web server taking the 8000 port.
     Confirm checkipv6available(8000) is still True.
2017-02-15 16:18:31 -08:00
Jun Wu
d8f3d38637 runtests: catch EPROTONOSUPPORT in checkportisavailable
This is a follow-up of "runtests: check ports on IPv6 address". On some
platforms, "socket.AF_INET6" exists while that does not necessarily mean the
platform support IPv6 - when initializing a socket using "socket.socket", it
could fail with EPROTONOSUPPORT. So treat that as "Port unavailable".
2017-02-10 04:09:06 -08:00
Jun Wu
1deb78100c runtests: check ports on IPv6 address
Previously, checkportisavailable only checks ports on the IPv4 address. This
patch makes it check IPv6 as well. It'll be useful if "localhost" does not
have an IPv4 address, or its IPv4 address does not exist somehow.
2017-02-09 05:57:54 -08:00
Jun Wu
3ca85be38e run-tests: unset CHGDEBUG
With CHGDEBUG, chg outputs much more stuff and the test could fail running
with --chg. So unset the environment variable.
2017-01-06 16:19:41 +00:00
Augie Fackler
edf8ac03be run-tests: forward Python USER_BASE from site (issue5425)
We do this so that any linters installed via pip install --user don't
break. See https://docs.python.org/2/library/site.html#site.USER_BASE
for a description of what this nonsense is all about.

An alternative would be to not set HOME, but that'll cause other
problems (see issue2707), or to forward every single path entry from
sys.path in PYTHONPATH (which seems sketchy in its own way).
2016-11-10 16:07:24 -05:00
Jun Wu
646ab80437 run-tests: make --local set --with-chg if --chg is used
--local should work with chg as well.
2016-07-18 08:55:30 +01:00
Jun Wu
5135dc6d30 run-tests: allow --local to set multiple attributes
This is to make the next patch easier to review. It does not change logic.
2016-07-18 08:45:46 +01:00
Augie Fackler
2356a5286e run-tests: add support for using 127.0.0.1 as a glob
Some systems don't have a 127/8 address for localhost (I noticed this
on a FreeBSD jail). In order to work around this, use 127.0.0.1 as a
glob pattern. A future commit will update needed output lines and add
a requirement to check-code.py.
2016-07-09 23:01:02 -04:00
Pulkit Goyal
aef2bdd39a py3: make files use absolute_import and print_function
This patch includes addition of absolute_import and print_function to the
 files where they are missing. The modern importing conventions are also followed.
2016-07-03 22:28:24 +05:30
timeless
5729cecafc run-tests: add support for RTUNICODEPEDANTRY environment variable
based on d0a46e6f1fd7
2016-04-05 01:35:58 +00:00
timeless
02e1db6099 run-tests: use json.dumps(separators=)
Followup to eb3e07c0bd4b per Martijn Pieters
2016-05-26 02:35:44 +00:00
timeless
64b3f40be2 run-tests: handle json.dumps divergence
In py2, json.dumps includes a trailing space after a comma at the
end of lines. The py3 behavior which omits the trailing space is
preferable, so we're going to strip it.
2016-05-05 23:17:19 +00:00
timeless
13f6bf6c8e run-tests: set HGMODULEPOLICY for --pure
Without this, my python 2.6 virtualenv test run with --pure and
--local fails with:

+  ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.8, but Mercurial is currently using Python with sys.hexversion=33950192: Python 2.6.9 (unknown, Apr 13 2016, 12:40:12)
+  [GCC 4.9.2 20141101 (Red Hat 4.9.2-1)]
+   at: ~/hg/py26/bin/python
2016-04-13 13:51:39 +00:00
Yuya Nishihara
87bcd87c28 hghave: add "chg" flag to skip tests that can't be compatible with chg
Several tests fail with chg for several reasons such as loaded chgserver
extension, running uisetup() per server instead of per runcommand, etc.
Since these tests can't/shouldn't be changed to be chg friendly, we need
a flag to skip them.

This patch explicitly drops CHGHG environment if chg isn't involved. This
way, hghave can just check if CHGHG exists.
2016-03-20 14:55:56 -07:00
timeless
78312b6131 run-tests: move install.err into test area
Without this, sometimes installerrs generated errors
about no such file. It also did not work well when you
had multiple tests runners running around.

It also did not make sense to pollute the repository test
directory with the log file.
2016-04-07 11:11:55 +00:00
Augie Fackler
e02a696ec8 run-tests: fix broken regular expression
The regular expression in use passed tests because the test repo only
has single-digit changesets present. When I tried to use this for real
today, it broke, because the regular expression would only match a
single digit.

https://xkcd.com/1171/, or something like that.
2016-04-06 22:26:47 -04:00
timeless
2493adae19 run-tests: handle empty tests 2016-04-05 04:26:20 +00:00
timeless
ac72d955ec run-tests: make _processoutput picky about optional globs
72b40f92c680 enabled lines that were not matched to be found later in cases of jitter.

Unfortunately, in this model an optional line would always jitter to the end when
it is not present. That is not ideal.

It would be possible to do better, by queuing all writes until the end in case
an optional line jitters, but for now, it is simpler to assume optional lines
have a fixed place in the stream.
2016-03-30 09:13:47 +00:00
timeless
8e8201d525 py3: convert hghave output to text
Before this, Python3 generated:
b'skipped: unknown feature: not-py3k\n'
2016-03-30 08:02:34 +00:00
timeless
efbcb6a1c1 py3: convert prereq bytes to string in run-tests
Without this, run-tests would generate:
WARNING: Did not find prerequisite tool: b'python3.5'
2016-03-30 05:26:51 +00:00
timeless
d3e5492366 run-tests: use canonpath for with-python3 2016-03-28 04:02:07 +00:00
timeless
1a1c265a54 run-tests: add canonpath function
consistently use realpath+expanduser
2016-03-28 04:01:21 +00:00
Jun Wu
d252746940 run-tests: use different chg socket directories for different tests
Before this patch, if --chg or --with-chg is specified, all tests are using
the same chgserver socket. Since the chg client holds a lock when it starts a
new server, and every test needs at least a new chg server due to different
HGRCPATH affecting the confighash, the result is a lot of tests will be
timed out if -j is large (for example, 50 or 100).

This patch solves the issue by using different chg socket directories for
different tests.
2016-03-20 17:18:06 -07:00
Augie Fackler
b15267eb94 run-tests: add support for automatically bisecting test failures 2016-03-19 14:26:10 -04:00
Gregory Szorc
464bf4c7e9 run-tests: add --with-python3 to define a Python 3 interpreter
Currently, very few parts of Mercurial run under Python 3, notably the
test harness.

We want to write tests that run Python 3. For example, we want to
extend test-check-py3-compat.t to parse and load Python files.
However, we have a problem: finding appropriate files requires
running `hg files` and this requires Python 2 until `hg` works
with Python 3.

As a temporary workaround, we add --with-python3 to the test harness
to allow us to define the path to a Python 3 interpreter. This
interpreter is made available to the test environment via $PYTHON3 so
tests can run things with Python 3 while the test harness and `hg`
invocations continue to run from Python 2. To round out the feature,
a "py3exe" hghave check has been added.
2016-03-18 16:17:56 -07:00
timeless
6c36b542b4 run-tests: teach _processoutput to handle multiple lines of churn
Instead of treating expected output as happening in a precise order,
and assuming that if a line is missing it will never happen,
assume that expected output is a prioritized list of likely matching
lines.

This means that if:

 foo/bar (glob)
 baz/bad (glob)

changes to:

 baz/bad
 foo/bar

instead of generating:

 baz/bad
 foo/bar

For which we've lost both (glob) markers,
we will match both lines and generate:

 baz/bad (glob)
 foo/bar (glob)

This retains any special annotations we have for lines.
2016-03-17 20:52:06 +00:00
timeless
7d5e3a8dc0 run-tests: indent _processoutput to aid readability for next patch
The next commit will loop over the expected[pos] list, this change
makes that change easier to review.
2016-03-17 20:54:36 +00:00
Jun Wu
10d32ae3a0 chg: do not write pidfile
Current pidfile logic will only keep the pid of the newest server, which is
not very useful if we want to kill all servers, and will become outdated if
the server auto exits after being idle for too long.

Besides, the server-side pidfile writing logic runs before chgserver gets
confighash so it's not trivial to append confighash to pidfile basename like
we did for socket file.

This patch removes --pidfile from the command starting chgserver and switches
to an alternative way (unlink socket file) to stop the server.
2016-03-10 00:19:55 +00:00
Gregory Szorc
426b834415 run-tests: remove 2to3 support
Our goal is to have 1 code base that works on 2.6, 2.7, and 3.5+.
2to3 won't be used. Stop passing it to setup.py.
2016-02-27 21:08:37 -08:00
Matt Harbison
f0863290ab run-tests: defer leftover (?) cleanup until after all output is exhausted
Previously, after matching a single line, any contiguous subsequent lines ending
with (?) would be added to the output and removed from the expected output.
This is a problem if the subsequent test output would have matched the consumed
(?) line, because it kept the optional line and then added a duplicate without
the (?) [1].  Instead, wait until there is nothing more to match before handling
the leftovers.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-February/080197.html
2016-02-28 23:21:28 -05:00
Gregory Szorc
9068a821f3 run-tests: fix Python 3 incompatibilities
At one point run-tests.py and test-run-tests.t worked and passed
under Python 3.5. Various changes to run-tests.py over the past
several months appear to have broken Python 3.5 compatibility.

This patch implements various fixes (all related to str/bytes type
coercion) to make run-tests.py and test-run-tests.t mostly work
again. There are still a few failures in test-run-tests.t due to
issues importing mercurial.* modules. But at least run-tests.py
seems to work under 3.5 again.
2016-02-27 21:29:42 -08:00
David R. MacIver
3ebd7298a9 run-tests: allow run-tests.py to run tests outside current directory
When reloading tests, run-tests.py was assuming that it could look
up the test by the basename, which only works if you are running
tests which are in the current directory.

This patch changes that lookup to use the full path. This is all
that was needed, and does not appear to cause any problems for
any of the existing testing work flows based on running the
suggested commands at the top of run-tests.py.

Motivation: In order to test Mercurial with Hypothesis (according
to https://www.mercurial-scm.org/wiki/HypothesisPlan) it is
useful to be able to generate temporary test files and execute
them. Generating temporary files in the tests/ directory leads to
a lot of suboptimal clutter.
2016-02-18 08:52:15 +00:00
timeless
8a0d103caa run-tests: stop allocating HGPORT3+HGPORT4
The only consumer was test-treemanifest.t, which has been fixed.

In general, you should be able to use killdaemons.py to recycle
ports instead of going over 3 ports (HGPORT, HGPORT1, HGPORT2).

In the future, if you want to add a port, be sure to change
portneeded in _getport.
2016-02-17 19:38:44 +00:00
timeless
7b4d0e1e16 run-tests: refactor port allocation into functions
Adding a port reservation was too hard and someone did it wrong.
By refactoring, such reservations can be managed more safely.

This also adds documentation so that the next person who tries
is more likely to update all the places correctly.

Note that in this commit the reservation and consumers do not
match, that will be fixed in the next commit.
2016-02-17 19:36:32 +00:00
Yuya Nishihara
dd5e0b4899 run-tests: add --chg option to install and run tests using chg
Because the temporary installation directory is shared between hg and chg,
--chg is not allowed if --with-hg option is specified. Also, --chg option
does not work on FreeBSD because "make" command is hard-coded. These
limitations can be improved later.

Almost all tests will fail with chg right now.
2016-02-07 18:08:59 +09:00
Yuya Nishihara
83ccd75532 run-tests: add --with-chg option to run tests using chg
Unlike --with-hg=/path/to/chg, this option allows us to start and clean up
command servers in isolated environment. And we can specify the hg command
as well as the chg command.
2016-02-07 16:34:12 +09:00
Yuya Nishihara
cf3e9474ef run-tests: remove useless "failed" flag from addOutputMismatch()
It never be set to True.
2016-01-09 13:22:26 +09:00
Yuya Nishihara
ad2de493a5 tests: load json with no fallback
The json module should be available in Python 2.6 or newer.
2016-01-09 13:20:15 +09:00
Yuya Nishihara
cd561eb91a run-tests: allow to specify executable of any name by --with-hg
If the executable is not named as "hg", TTest runner inserts alias. This
way, we can run tests with chg. But it is still warned because the alias
does not always work. We do "$BINDIR"/hg in a few places.
2016-02-07 15:21:39 +09:00
Yuya Nishihara
3ba5dbc55e run-tests: drop redundant assignment to BINDIR
We do it a few lines after.
2016-02-07 16:02:41 +09:00
Yuya Nishihara
0d8272a88a run-tests: cast --with-hg option to bytes consistently at parseargs()
parseargs() sets bytes to options.with_hg if --local is specified, so do
the same for --with-hg.
2016-02-07 16:00:05 +09:00
Yuya Nishihara
fd68b16ac6 run-tests: do not compare bytes with str while ordering tests
It failed on Python 3.
2016-02-07 15:53:02 +09:00
timeless
64b5aa82c1 run-tests: factor out _escapepath 2016-01-29 14:35:34 +00:00
timeless
e09049f8f5 run-tests: warn about symlinks to non hg scripts
If you symlink /usr/bin/true to /something/hg and try to run
--with-hg=/something/hg, run-tests will end up running /usr/bin/hg,
not /usr/bin/true.
2016-02-08 22:50:19 +00:00
Martin von Zweigbergk
e50c296659 treemanifests: fix streaming clone
Similar to the previous patch, the .hg/store/meta/ directory does not
get copied when when using "hg clone --uncompressed". Fix by including
"meta/" in store.datafiles(). This seems safe to do, as there are only
a few users of this method. "hg manifest" already filters the paths by
"data/" prefix. The calls from largefiles also seem safe. The use in
verify needs updating to prevent it from mistaking dirlogs for
orphaned filelogs. That change is included in this patch.

Since the dirlogs will now be in the fncache when using fncachestore,
let's also update debugrebuildfncache(). That will also allow any
existing treemanifest repos to get their dirlogs into the fncache.

Also update test-treemanifest.t to use an a directory name that
requires dot-encoding and uppercase-encoding so we test that the path
encoding works.
2016-02-04 08:34:07 -08:00
Bryan O'Sullivan
95a960a422 run-tests: "fix" race condition in race condition fix
Laurent's commit 56cdfddbd2ed still suffers from a race: by the
time the "job" function tries to assign to channels[channel], that
list has been truncated to empty.  The result is that every job
thread raises an IndexError.

Earlier, I tried an approach of correctly locking channels, but
that caused run-tests to hang on KeyboardInterrupt sometimes.

This approach is strictly hackier, but seems to actually work
reliably.
2016-01-22 11:00:13 -08:00
Laurent Charignon
bdac46ce5b run-tests: fix crash when --json and --blacklist are both used (issue5050)
This patch fixes a crash when both --json and --blacklist were given as
arguments of run-tests.py. Now, instead of crashing, we add an entry for
blacklisted tests in the json output to show that the tests were skipped.
2016-01-19 08:22:27 -08:00
Laurent Charignon
fb718d23a0 run-tests: fix race condition
Before this patch, it was possible for run-tests to crash on a race condition.
The race condition happens in the following case:
- the last test finishes and calls: done.put(None)
- the context switches to the main thread that clears the channels list
- the context switches to the last test mentioned above, it tries to access
channels[channel] and crashes
This happened to me while running run-tests.

This patch fixes the issue by clearing the channel before considering that the
test is done.
2016-01-21 12:37:12 -08:00
timeless
fafbbff385 run-tests: skip threading for a single test (issue5040)
This version backs out 69d5cadd84a0 and implements it in
a more consistent manner.
2016-01-14 04:14:50 +00:00
Bryan O'Sullivan
c54f58f09c run-tests: use a context manager for file I/O in TextTestRunner 2016-01-12 14:49:10 -08:00
Bryan O'Sullivan
100ad2a9c4 run-tests: use a context manager for file I/O 2016-01-12 14:29:57 -08:00
timeless
25686051e3 run-tests: skip threading for a single test
Threading is incompatible with most Python debuggers,
which makes debugging run-tests.py a real pain.

If there is only one test to run, skip using a thread for it.

Note that --debug is not compatible with debugging tests,
since it bypasses the output handling, which is where
much of the excitement is.
2015-12-28 17:48:40 +00:00
Laurent Charignon
693c12d5a7 run-tests: add 'diff' entry in json report
This patch adds to the json report the "diff" between expected and observed
result. This diff can be useful for automatically filing bug report on failing
tests.
2016-01-05 13:33:09 -08:00
timeless
ebb1d48658 cleanup: remove superfluous space after space after equals (python) 2015-12-31 08:16:59 +00:00
Bryan O'Sullivan
08b463513d tests: make a stab at approximating wall-clock times
Vaguely empirical observations:

* ".py" tests are about an order of magnitude faster than ".t" tests

* dividing size by 1000 gives an approximation to wall-clock
  run time (in seconds) that is not completely ridiculous.
2016-01-04 21:54:46 -08:00
Bryan O'Sullivan
1dfeb4f0f7 tests: only stat a test file if we don't already know its "cost" 2016-01-04 21:54:46 -08:00
Bryan O'Sullivan
5819807652 tests: write recent run times to a file named tests/.testtimes
This is an effortless way to track how long each test takes without
having to pass any extra command line options.
2016-01-04 21:54:44 -08:00
timeless
c93f79b92f run-tests: fix get port to try differing ports
The code was moving its offset each time through the loop,
but because it failed to update port, the port was not
going to be available...
2015-12-29 04:30:38 +00:00
timeless
2a6d0ff53a run-tests: avoid double counting server fails 2015-12-28 16:01:31 +00:00
timeless
da9e1e1cb0 run-tests: report missing feature for skipped tests 2015-12-22 08:00:03 +00:00
Matt Mackall
1a6d366c07 run-tests: show scheduling with --showchannels
This gives one line of output per second with one column per -j level
that allows analyzing test scheduling problems. First 24 seconds of
output at -j 30 looks like this:

  0                                                                .
  1  = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   s.
  2  c c o c r l g r s s = c p = c h c a h c g c h c b c c l l c   ss
  3  h o b o e a e u u u c o a h o e o c g o l h g h u o = a o =   s
  4  e n s n b r n n b b   m t g n l n l w n o e w e n n e r g i   .
  5  c t o = a g d - r r = m c w v p v . e v g c e c d v x g . m
  6  k r l r s e o t e e b a h e e . e . b e . k b k l e t e . p
  7  - i e e e f c e p p u n b b r . r . - r . - - - e r e f . o   .
  8  p b t v - i . s o o n d o d t . t . c t . c s = 2 t n i . r
  9  y - e s c l . t - . d - m i - . - . o - . o y r - - s l . t
 10  3 p - e h e . s s . l t b r s . s . m s . d m e f s i e . .
 11  - e c t e s . . v . e e . . v . v . m v . e r n o v o s . .
 12  c r h . c - . . n . 2 m . . n . n . a n . . e a r n n . . .
 13  o f e . k u . . . . - p . . - . - . n - . . v m m - . . . .
 14  m . c . - p . . . . e l . . s . m . d s . . . e a e . . . .
 15  p . k . r d . . . . x a . . i . o . s o . . . - t n . . . .
 16  a . h . e a . . . . c t . . n . v . . u . . . m . c . . . .
 17  t . e . s t . . . . h e . . k . e . . r . . . e . o . . . .
 18  . . a . t e . . . . a . . . . . . . . c . . . r . d . . . .
 19  . . d . o . . . . . n . . . . . . . . e . . . g . i . . . .
 20  . . s . r . . . . . g . . . . . . . . . . . . e . n . . . .
 21  . . . . e . . . . . e . . . . . . . . . . . . 2 . g . . . .
 22  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 23  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   .
 24  . . . . . . . . . . . . . . . . . . . . . . . . . = . . . .   ^C

Test names read off vertically, beginning with '='. Idle time (not
shown) appears as blank space.
2015-12-07 16:16:06 -06:00
Matt Mackall
c4ab4cefae run-tests: add more scheduling weight hints
The scheduler would like to order test execution by expected run-time,
but doesn't know much about how long a test will run. It thus uses
test size as a proxy for run-time. By tweaking these weights we can
keep CPUs more evenly busy and thus finish sooner.

In particular, this change pushes the three currently longest-running
tests closer to the beginning:

test-largefiles-update.t
test-run-tests.t
test-gendoc.t

As the largefiles test is currently the long pole of the test suite
with higher -j factors, the sooner it's started, the sooner the tests
can end.

We also up the weight on some shorter but long-running tests that
could have previously delayed completion with low -j factors by
running very close to the end.
2015-12-04 17:05:20 -06:00
Matt Mackall
8d86df8f01 run-tests: report timeouts in a less alarming fashion
Rather than report timed-out tests like this:

 ERROR: test-convert-svn-sink.t output changed
 !

..simply put a 't' rather than a '.' in the stream.
2015-12-04 14:55:10 -06:00
timeless
7337637dd1 run-tests: add --slowtimeout and use it for slow tests 2015-11-25 00:39:05 +00:00
timeless
dd810884fd test-contrib-perf: add smoke tests for perf.py 2015-11-24 21:41:12 +00:00
Augie Fackler
f010f2acf9 run-tests: add b-prefix on two strings to fix python3 support 2015-10-12 14:15:04 -04:00
timeless@mozdev.org
dba46baf88 run-tests: report paths saved by --keep-tmpdir 2015-09-30 16:01:19 -04:00
timeless@mozdev.org
20963e1f94 run-tests: use $HGTEST_RUN_TESTS_PURE
test-run-tests and test-hghave call run-tests;
if you don't have a working build environment, and you are trying
to use --pure, then if they don't use --pure or --with-hg,
they'll break.
2015-09-02 15:19:05 -04:00
Augie Fackler
cd6222a983 run-tests: add support for marking tests as very slow
I want to add tests for our packaging rules, but those necessarily run
a whole build, or possibly two if both native packaging and docker are
available. This lets us flag such tests with a `#require slow` so that
they don't unnecessarily slow down normal test runs.
2015-08-24 22:23:45 -04:00
Augie Fackler
7a593002d6 run-tests: ignore failed removal of nonexistent installerrs
When running tests with -j100 or so on a large machine, I see this
os.remove call failing semi-regularly. Since it's not really a problem
when the file is already gone, just suppress the error in that case.
2015-08-25 00:40:42 -04:00
FUJIWARA Katsunori
4a75be9bfa run-tests.py: add TESTDIR to PATH if it differs from RUNTESTDIR
Before this patch, `RUNTESTDIR` is added to `PATH`, but `TESTDIR`
isn't.

This doesn't cause any problems, if `run-tests.py` runs in `tests`
directory of Mercurial source tree. In this case, `RUNTESTDIR` should
be equal to `TESTDIR`.

On the other hand, if `run-tests.py` runs in `tests` of third party
tools, commands in that directory should be executed with explicit
`$TESTDIR/` prefix in `*.t` test scripts. This isn't suitable for the
policy "drop explicit $TESTDIR from executables" of Mercurial itself
(see fcb1c7d8c36e).

BTW, fcb1c7d8c36e describes that "$TESTDIR is added to the path" even
though `TESTDIR` isn't added to `PATH` exactly speaking, because
`TESTDIR` and `RUNTESTDIR` weren't yet distinguished from each other
at that time.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
FUJIWARA Katsunori
70980837e8 run-tests.py: add RUNTESTDIR to refer tests of Mercurial
Before this patch, there is no way to refer files under `tests` or so
of Mercurial source tree, when `run-tests.py` runs in `tests` of third
party tools. In this case, `TESTDIR` refers the latter `tests`.

This prevents third party tools from using useful tools in Mercurial
source tree (e.g. `contrib/check-code.py`).

This patch adds `RUNTESTDIR` environment variable to refer `tests` of
Mercurial source tree, in which `run-tests.py` now running is
placed. For example, tests of third party tools can refer
`contrib/check-code.py` in Mercurial source tree as
`$RUNTESTDIR/../contrib/check-code.py`.

BTW, for similarity with `TESTDIR` referring `test*s*` directory,
newly added environment variable isn't named as `RUNTEST*S*DIR`. In
addition to it, the corresponded local variable is also named as
`runtestdir`.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
FUJIWARA Katsunori
c5c4f4ba0d run-tests.py: execute hghave by the path relative to run-tests.py
Before this patch, `run-tests.py` executes `hghave` by the path
relative to `TESTDIR` (= cwd of `run-tests.py` running).

This prevents third party tools for Mercurial from running
`run-tests.py`, which is placed in `tests` of Mercurial source tree,
in `tests` of own source tree. In such cases, `TESTDIR` refers the
latter `tests`, and `hghave` doesn't exist in it.

This is a one of preparations for issue4677.
2015-07-03 06:56:03 +09:00
Matt Mackall
b597cb9caa tests: add (?) flag for optional lines
When the test engine fails to match output on a line marked with (?),
it will simply continue to the next expected line and try again. This
allows simplifying tests that have either version-specific or
non-fixed behavior, for instance:

  $ coin-flip
  heads (?)
  tails (?)

(There's no form of back-tracking attempted, so optional matches
should be specific.)
2015-05-31 16:59:34 -05:00
Pierre-Yves David
b1a2babd78 devel: rename 'all' to 'all-warnings' (BC)
We have started to isolate extra usecases for developer-only output
that is not a warning. As the section has the fairly generic name
'devel' it makes sense to tuck them there. As a result, 'all' becomes
a bit misleading so we rename it to 'all-warnings'. This will break
some developer setups but the tests are still fine and developers will
likely spot this change.
2015-05-26 14:14:36 -07:00
Augie Fackler
10487ffdd9 run-tests: python3.5 now supports mkdtemp using bytes for paths
Now that http://bugs.python.org/issue24230 is fixed (thanks to Gregory
Smith for that quick response!) we can drop one more ugly hack around
path handling. Tests still pass in 3.5 with this cleaner version, as
well as in 2.6.
2015-05-22 21:19:08 -04:00
Augie Fackler
ab57fc9f4c run-tests: use items() instead of iteritems()
This fixes the python3.5 build. We'll presumably want to build our own
helper function or use 2to3 for this on the main source tree, but for
run-tests we want a single-source version that works in 2.6 and 3.5.
2015-05-22 21:15:52 -04:00
Matt Harbison
ff93ed30c4 run-tests: resurrect the wifexited polyfill (backout afc1c96d7d8c)
Python 2.7.3 on Windows doesn't have os.WIFEXITED, and the test output looked
like this before I interrupted it.

    $ ./run-tests.py --local -j2 -t700
    EEEEEEEEEEEEEEEEEEEEEE
2015-05-18 15:34:42 -04:00
Augie Fackler
5c9b102436 run-tests: replace open-coded .decode()s on paths with a helper (issue4667)
This also cleans up the mkdtemp code mentioned in the previous patch.

At this point, the remaining callsites of .{en,de)code() are in the
following categories:

Handling escaped lines in .t files
-----------------------------------

It seems eminently reasonable to me for us to declare that .t files
are valid utf-8, and that any escape sequences we see in .t files
should be valid unicode_escape sequences.


Making error text safe for cdata blocks for xml error reports
-------------------------------------------------------------

This is a point where we're already basically screwed, and we're
simply trying to do something "good enough" that the xml output will
be vaguely useful to the user. Punting here seems fine, and we should
probably stick to the same encoding here that we used in the previous
section.
2015-05-17 21:47:18 -04:00
Augie Fackler
ae9dde628a run-tests: move unicode-to-bytes operations on paths to a helper (issue4667)
This doesn't fix the probably-wrong utf-8 encoding choice, it just
starts the process of encapsulating all the path handling in run-tests
in a single place.

One known-path use of .encode() remains: it's related to use of
mkdtemp, and it will be fixed in a followup patch once we have a
companion _strpath() helper function to go from bytes to a str, as we
need to file a bug about mkdtemp upstream.
2015-05-17 21:40:12 -04:00
Augie Fackler
62a6d278f5 run-tests: insist that if people use Python 3, they use 3.5.x
We depend on both stdlib functionality (difflib.diff_bytes) and
language behavior (bytes formatting) introduced in 3.5, so let's try
and prevent some useless bug reports before they happen.
2015-05-17 21:26:04 -04:00
Augie Fackler
1e68f5c6ca run-tests: move all open-coded sys.version_info checks to PYTHON3 (issue4668)
This consolidates all version checking in a single place and helps the
code read more obviously.
2015-05-17 21:18:56 -04:00
Augie Fackler
e51d6f1899 run-tests: prefer PYTHON3 constant to many version_info checks (issue4668)
We only support Python 2.6, 2.7, and 3.5 here, so we can simplify the
code and improve the warning.
2015-05-17 21:17:13 -04:00
Augie Fackler
b4a58c425e run-tests: introduce PYTHON3 boolean constant (issue4668)
This will avoid open-coding lots of version_info checks later in the
file.
2015-05-17 21:12:33 -04:00
Augie Fackler
f4891c885e run-tests: drop subprocess _cleanup monkeypatch
This was working around a defect in subprocess in Python 2.5, which we
no longer need to worry about.
2015-05-17 21:15:45 -04:00
Augie Fackler
3493223980 run-tests: drop wifexited polyfill
os.WIFEXITED exists as of python 2.6 for me, so we no longer need this
polyfill.
2015-05-17 21:15:04 -04:00
Augie Fackler
03a9938c4e run-tests: add a --profile-runner option
While in the throes of a recent run-tests adventure, I found it useful
to have profiler output for the testrunner itself. Adding it was
simple enough and seems worth keeping around.
2015-05-13 11:22:06 -07:00