Commit Graph

7217 Commits

Author SHA1 Message Date
Gregory Szorc
860d201bb5 run-tests: teach unittest about warned results 2014-04-20 11:55:02 -07:00
Gregory Szorc
fb96114811 run-tests: document how success code is handled 2014-04-20 11:52:41 -07:00
Gregory Szorc
c9f14940a6 run-tests: teach unittest about ignored tests 2014-04-20 11:51:11 -07:00
Gregory Szorc
6de0802f27 run-tests: teach unittest about skipped tests 2014-04-20 11:48:19 -07:00
Gregory Szorc
103002df37 run-tests: define custom result and runner classes for unittest
We need to teach unittest about some custom result types. This will
require some custom classes. This patch creates a skeleton for them.
2014-04-20 11:47:40 -07:00
Gregory Szorc
a8a9760698 run-tests: start to report test results against TestResult
Previously, our unittest wrapper didn't report results properly. We now
properly report failures.

We had to rename the local variable to prevent "t" from being
overwritten in the local scope.
2014-04-20 11:29:39 -07:00
Gregory Szorc
95998c9339 run-tests: give unittest wrapper a short description
This will make the output contain something useful rather than the
default repr() for the class.
2014-04-20 11:24:37 -07:00
Gregory Szorc
4c1aec1cac run-tests: initial support for running tests with unittest
The unittest package in Python's standard library provides an almost
universal mechanism for defining and running tests. This patch starts
the process of making run-tests.py talk to it.

The main benefit of speaking unittest is that this will enable
Mercurial's tests to be more easily consumed by other testing tools,
like nose. This is useful for 3rd party extensions having their own
test infrastructure, for example.

Running tests in unittest mode will not result in completely sane
behavior until the unittest mode is made the default execution mode.
Expect things like double printing of output until support stabilizes.
2014-04-20 11:22:08 -07:00
Pierre-Yves David
c84e682681 test: split test-largefile.t in multiple file
The `test-largefiles.t` unified test is significantly longer (about 30%) than
any other tests in the mercurial test suite. As a result, its is alway the last
test my test runner is waiting for at the end of a run.

In practice, this means that `test-largefile.t` is wasting half a minute of my
life every times I'm running the mercurial test suites. This probably mean more
a few cumulated day by now.

I've finally decided to split it up in multiple smaller tests to bring it back in
reasonable length.

This changeset extracts independent test cases in two files. One dedicated to
wire protocole testing, and another one dedicated to all other tests that could
be independently extracted.

No test case were haltered in the making of this changeset.

Various timing available below. All timing have been done on a with 90 jobs on a
64 cores machine. Similar result are shown on firefly (20 jobs on 12 core).

General timing of the whole run
--------------------------------

We see a 25% real time improvement for no significant cpu time impact.

Before split:

    real   2m1.149s
    user  58m4.662s
    sys   11m28.563s

After split:

    real   1m31.977s
    user  57m45.993s
    sys   11m33.634s


Last test to finish (using run-test.py --time)
----------------------------------------------

test-largefile.t is now finishing at the same time than other slow tests.

Before split:

    Time      Test
    119.280   test-largefiles.t
     93.995   test-mq.t
     89.897   test-subrepo.t
     86.920   test-glog.t
     85.508   test-rename-merge2.t
     83.594   test-revset.t
     79.824   test-keyword.t
     78.077   test-mq-header-date.t

After split:

    Time      Test
    90.414   test-mq.t
    88.594   test-largefiles.t
    85.363   test-subrepo.t
    81.059   test-glog.t
    78.927   test-rename-merge2.t
    78.021   test-revset.t
    77.777   test-command-template.t



Timing of largefile test themself
-----------------------------------

Running only tests prefixed with "test-largefiles".
No significant change in cumulated time.

Before:

    Time     Test
    58.673   test-largefiles.t
     2.931   test-largefiles-cache.t
     0.583   test-largefiles-small-disk.t

After:

    Time     Test
    31.754   test-largefiles.t
    17.460   test-largefiles-misc.t
     8.888   test-largefiles-wireproto.t
     2.864   test-largefiles-cache.t
     0.580   test-largefiles-small-disk.t
2014-05-16 13:18:57 -07:00
FUJIWARA Katsunori
9af54bf260 mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:

  - it allows to hook commit message determination easily, even in the
    case without "--edit"

  - it avoids regression (or additional care) around saving
    "last-message.txt", even if MQ's "newcommit()" changes its
    implementation logic from "localrepository.commit" to
    "localrepository.commitctx" with "memctx" in the future

    to save commit message into "last-messge.txt" with "memctx",
    "editor" should be valid function.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
55e621635c mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qnew)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:

  - the latter allows to hook commit message determination easily,
    even in the case without "--edit"

  - the latter can avoid regression (or additional care) around saving
    "last-message.txt", even if MQ's "newcommit()" changes its
    implementation logic from "localrepository.commit" to
    "localrepository.commitctx" with "memctx" in the future

    to save commit message into "last-messge.txt" with "memctx",
    "editor" should be valid function.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
4b34ba6872 tag: use the editor gotten by "getcommiteditor()" instead of "ui.edit()"
This patch also enhances "test-tag.t", because "hg tag" hasn't been
explicitly tested around editor invocation and "--edit" option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
308518c1e9 import: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-import-bypass.t" and "test-import.t",
because "hg import" hasn't been explicitly tested around editor
invocation and "--edit" option.

This patch explicitly tests below:

    - with "--bypass" (regardless of "--edit"):
        - not invoked, if the patch contains the commit message
        - not invoked, if the commit message is explicitly specified
        - invoked, otherwise (just adding comment)

    - without "--bypass":
        - with "--edit":
            - not invoked, if "--no-commit" is not specified
            - invoked, otherwise
        - without "--edit":
            - not invoked, if the patch contains the commit message
            - not invoked, if "--message" or "--logfile" is specified
              (just adding comment)
            - invoked, otherwise
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
67f9c7382a graft: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-graft.t", because "hg graft" hasn't
been explicitly tested around editor invocation and "--edit" option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
0aeb4a2423 backout: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-backout.t", because "hg backout" hasn't
been explicitly tested around editor invocation and '--edit' option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
71a4736498 transplant: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-transplant.t", because "hg transplant"
hasn't been explicitly tested around editor invocation and "--edit"
option.
2014-05-11 00:49:35 +09:00
FUJIWARA Katsunori
d59fc43c65 rebase: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-rebase-scenario-global.t", because "hg
rebase" hasn't been explicitly tested around editor invocation and
"--edit" option.

In the other hand, this patch doesn't enhance tests in "hg rebase
--collapse" case, because it is already tested in
"test-rebase-collapse.t".
2014-05-11 00:49:35 +09:00
FUJIWARA Katsunori
876753dee7 histedit: use "getcommiteditor()" instead of explicit editor choice for "--continue"
This omits (redundant) adding "\n' to "message", because:

  - empty line is inserted by "commitforceeditor", if editor is invoked
  - tail white-spaces are stripped at storing into chaneglog, otherwise

This patch also enhances "test-histedit-edit.t", because "hg histedit"
hasn't been explicitly tested around editor invocation and
"--continue" option.
2014-05-11 00:49:35 +09:00
FUJIWARA Katsunori
1d4d1b5665 histedit: use the editor gotten by "getcommiteditor()" for "message"
Before this patch, "hg histedit" for "message" uses "ui.edit()" for
commit message editing.

It shows original commit message, but not detail about the target
revision: status of each modified/added/removed files, for example.

This patch uses the editor gotten by "getcommiteditor()" instead of
"ui.edit()" for "message"

In "test-histedit-edit.t", this patch omits "fixbundle" invocation,
because it prevents from confirming the "HG: added f" line in commit
message by filtering " added " lines.

Omiting "fixbundle" invocation causes that the exit code of "hg
histedit" appears as one of command line: in this case, "hg histedit"
is aborted by (expected) exception raising.
2014-05-11 00:49:35 +09:00
FUJIWARA Katsunori
f416ee248c fetch: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-fetch.t", because "hg fetch" hasn't
been explicitly tested around editor invocation and '--edit' option.
2014-05-11 00:49:35 +09:00
Siddharth Agarwal
1dfb639cc9 update: when deactivating a bookmark, print a message
This helps prevent user confusion when innocent-seeming commands like
'hg update -C .' are run.
2014-05-14 12:49:55 -07:00
Angel Ezquerra
b4d4cc2829 subrepo: use subrepo shortid method to generate subrepo diverged promptchoice
We were always using only the first 12 characters of the subrepo revision id
when generating the "subrepo diverged" promptchoice. This is not necessarily
correct for non mercurial subrepos.
2014-05-07 00:13:22 +02:00
Mads Kiilerich
473137c772 merge: change debug logging - test output changes but no real changes
Preparing for action list split-up, making sure the final change don't have any
test changes.

The patch moves debug statements around without really changing anything.
Arguably, it temporarily makes the code worse. The only justification is that
it makes it easier to review the test changes ... and in the end the big change
will not change test output at all.

The changes to test output are due to changes in the ordering of debug output.
That is mainly because we now do the debug logging for files when we actually
process them. Files are also processed in a slightly different but still
correct order. It is now primarily ordered by action type, secondarily by
filename.

The patch introduces some redundancy. Some of it will be removed again, some of
it will in the end help code readability and efficiency. It is possible that we
later on could introduce a "process this action list and do some logging and
progress reporting and apply this function".

The "preserving X for resolve" debug statements will only have single space
indentation. It will no longer have a leading single space indented "f: msg ->
m" message. Having this message double indented would thus no longer make
sense.

The bid actions will temporarily be sorted using a custom sort key that happens
to match the sort order the simplified code will have in the end.
2014-04-22 02:10:25 +02:00
Mads Kiilerich
43db2a4aa5 merge: change priority / ordering of merge actions
The ordering of actions matters. Normal file system semantics is that files
have to be removed before a directory with the same name can be created.

Before the first ordering key was to have 'r' and 'f' actions come first,
secondary key was the filename.

Because of future refactorings we want to consistently have all action types
(with a sensible priority) as separate first keys. Grouped by action type, we
sort by filename.

Not processing in strict filename order could give worse performance,
especially on spinning disks. That is however primarily an issue in the cases
where "all" actions are of the same kind and will be grouped together anyway.
2014-05-02 01:09:14 +02:00
Pierre-Yves David
b262d9a640 run-tests: fix --interactive option
``TTest._testpath`` never existed. This must be the remain of some contributors
side refactoring.
2014-05-17 00:47:42 -07:00
Pierre-Yves David
d2c3815194 run-test: fix AttributeError in the --interactive prompt
One must choose between ``"y yes".split()`` and ``('y', 'yes')``. I choose the
later.

The feature still crash when you answer "yes" to use it. But at least, the
prompt itself works.
2014-05-17 00:38:48 -07:00
Pierre-Yves David
8b89a74c6f run-test: restore the -i prompt by write .err before checking if it exists
The `--interactive` flag workis by overwriting the original test file by its
`.err` version. So we need to write it before calling `self.fail`. Otherwise the
`.err` file does not exists and `--interactive` is ignored.

We can move that block code around because it is dedicated to write changed
output and we moves it in the try-except dedicated to handling changed output.

Note that the flog is still badly broken after this change. But at least it crash
instead of being ignored.
2014-05-17 00:37:06 -07:00
Gregory Szorc
1a9a4f69c5 run-tests: move _gethgpath() into TestRunner 2014-04-20 11:04:25 -07:00
Gregory Szorc
5d72ba5d0e run-tests: move string escaping to TTest
With this patch, TTest is almost fully self-contained and extractable.
Only logging functions remain outside of its class.
2014-04-20 10:34:52 -07:00
Gregory Szorc
29c42e357d run-tests: add some docstrings 2014-04-20 10:28:35 -07:00
Gregory Szorc
5be656d402 run-tests: move createhgrc into Test 2014-04-20 10:24:00 -07:00
Gregory Szorc
f91c5a5105 run-tests: move SKIPPED_PREFIX and FAILED_PREFIX into TTest 2014-04-20 10:19:58 -07:00
Gregory Szorc
a67c76a563 run-tests: move SKIPPED_STATUS into Test class 2014-04-20 10:16:36 -07:00
Gregory Szorc
3cae671831 run-tests: move parsehghaveoutput() into TTest
This patch starts a sequence of patches that will try to isolate
everything related to t tests into the TTest class.
2014-04-20 10:14:25 -07:00
Gregory Szorc
8d7902d08f run-tests: make some methods of TestRunner internal 2014-04-20 10:11:46 -07:00
Gregory Szorc
77377eb9f9 run-tests: eliminate main() 2014-04-20 10:09:23 -07:00
Gregory Szorc
f77a2632fd run-tests: move option parser logic to TestRunner.run() 2014-04-20 10:08:33 -07:00
Gregory Szorc
e8679e7082 run-tests: move umask into TestRunner.run()
We now properly restore the umask as well, since run() tries to clean up
after itself.
2014-04-20 10:06:19 -07:00
Gregory Szorc
1a7b678d41 run-tests: move checktools into TestRunner.run() 2014-04-20 10:05:00 -07:00
Gregory Szorc
9b509906ec run-tests: move test discovery into TestRunner.run() 2014-04-20 10:04:15 -07:00
Gregory Szorc
015f85c261 run-tests: move test shuffling and sorting into TestRunner 2014-04-20 10:03:08 -07:00
Gregory Szorc
6b2b768e30 run-tests: assign testdir in TestRunner 2014-04-20 10:00:59 -07:00
Gregory Szorc
f10ceaaa22 run-tests: move hash seed logic to TestRunner 2014-04-20 09:59:01 -07:00
Gregory Szorc
c5b81eb209 run-tests: move tmpdir calculations into TestRunner 2014-04-20 09:58:26 -07:00
Gregory Szorc
3a9dcd2480 run-tests: move more path calculations into TestRunner 2014-04-20 09:57:02 -07:00
Gregory Szorc
c63c3fe0f7 run-tests: move pypath manipulation into TestRunner 2014-04-20 09:54:28 -07:00
Gregory Szorc
d8efe9acf0 run-tests: establish TestRunner.run()
(amended by mpm to remove environ cleanup - unrelated change that
breaks on Solaris)
2014-04-20 09:49:33 -07:00
Gregory Szorc
e9f87a494b run-tests: move program searching into TestRunner 2014-04-20 09:44:39 -07:00
Gregory Szorc
85852466ca run-tests: allow TestRunner to be passed into main()
This allows 3rd parties to specify a custom TestRunner. This is useful
for providing your own test discovery mechanism, for example.
2014-04-20 09:40:27 -07:00
Gregory Szorc
8b959d83f2 run-tests: move test discovery logic into a function
The new function is easily monkeypatchable. This facilitates more
advanced test discovery by 3rd parties such as extensions.
2014-04-20 00:23:06 -07:00
Gregory Szorc
27d037f441 run-tests: move scheduletests() into TestRunner 2014-04-20 00:12:26 -07:00
Gregory Szorc
eec6cde13e run-tests: move abort global to TestRunner 2014-04-20 00:10:06 -07:00
Gregory Szorc
25b7330a18 run-tests: move runtests() into TestRunner 2014-04-20 00:06:30 -07:00
Gregory Szorc
e57adc8c20 run-tests: move results global into TestRunner 2014-04-20 00:03:32 -07:00
Gregory Szorc
ff5048b39c run-tests: move times global into TestRunner 2014-04-19 23:59:06 -07:00
Gregory Szorc
1b4a48f3dc run-tests: move gettest() into TestRunner 2014-04-19 23:53:23 -07:00
Gregory Szorc
2703caf446 run-tests: move outputcoverage() into TestRunner 2014-04-19 23:49:23 -07:00
Gregory Szorc
49cdc11656 run-tests: move outputtimes() into TestRunner 2014-04-19 23:47:59 -07:00
Gregory Szorc
f60ca60f88 run-tests: move checkhglib into TestRunner 2014-04-19 23:44:56 -07:00
Gregory Szorc
105c9c2fc1 run-tests: move installhg() into TestRunner 2014-04-19 23:43:00 -07:00
Gregory Szorc
023fa479ff run-tests: move createdfiles out of a global and into TestRunner 2014-04-19 23:39:38 -07:00
Gregory Szorc
a24163eef4 run-tests: move usecorrectpython() into TestRunner 2014-04-19 23:38:10 -07:00
Gregory Szorc
88e6be733b run-tests: move cleanup() into TestRunner 2014-04-19 23:35:27 -07:00
Gregory Szorc
e74d6a9170 run-tests: add options to runner 2014-04-19 23:33:44 -07:00
Gregory Szorc
691c3d4a63 run-tests: add options to runner 2014-04-19 23:28:59 -07:00
Gregory Szorc
fbb4e07860 run-tests: move COVERAGE_FILE out of a global 2014-04-19 23:27:11 -07:00
Gregory Szorc
cb55575cbf run-tests: move PYTHONDIR out of a global 2014-04-19 23:26:15 -07:00
Gregory Szorc
cd540cf8ab run-tests: move TMPBINDIR out of a global 2014-04-19 23:24:39 -07:00
Gregory Szorc
0b30c04fca run-tests: move BINDIR out of a global 2014-04-19 23:22:47 -07:00
Gregory Szorc
e4684a44f0 run-tests: move INST out of a global 2014-04-19 23:20:42 -07:00
Gregory Szorc
985af7905a run-tests: move HGTMP out of a global 2014-04-19 23:19:23 -07:00
Gregory Szorc
43a68f701f run-tests: move TESTDIR out of a global
This patch starts the process of removing global variables from
run-tests.py. The goal of this is to make it easier to run tests
differently without having to concern yourself with global state.
2014-04-19 23:15:24 -07:00
Gregory Szorc
6ac2fa2ac5 run-tests: establish a class to hold testing state 2014-04-19 23:07:17 -07:00
Gregory Szorc
a557fd6847 run-tests: refactor runone() into gettest() and scheduletests()
runone() has been removed. Replacing it are gettest() (which returns a
Test instance) and a small amount of boilerplate in scheduletests().
2014-04-19 22:02:55 -07:00
Gregory Szorc
cf638dcc58 run-tests: move computation of test paths into Test.__init__ 2014-04-19 21:53:15 -07:00
Gregory Szorc
2c78c23435 run-tests: move logging of test start into Test.run() 2014-04-19 21:50:23 -07:00
Gregory Szorc
0e7ab8a4df run-tests: remove remaining uses of TestResult 2014-04-19 21:21:57 -07:00
Gregory Szorc
a9a228cd32 run-tests: move output writing to Test.run() 2014-04-19 21:17:39 -07:00
Gregory Szorc
23754a084d run-tests: move err file saving to Test.run() 2014-04-19 21:14:31 -07:00
Gregory Szorc
d8e59715bf run-tests: emit exception failure result from Test.run() 2014-04-19 21:10:22 -07:00
Gregory Szorc
ac40d2296a run-tests: move test name filter to Test.run() 2014-04-19 21:08:03 -07:00
Gregory Szorc
266111b2d1 run-tests: move keyword processing into Test.run() 2014-04-19 21:05:50 -07:00
Gregory Szorc
d1cef4a6a1 run-tests: move retesting result to Test.run() 2014-04-19 21:04:08 -07:00
Gregory Szorc
e8004cbf37 run-tests: move blacklist skipping to Test.run() 2014-04-19 21:02:51 -07:00
Gregory Szorc
29ec1e08f4 run-tests: check for test file existence in Test.run()
We delay this a little bit. But it shouldn't really matter when the
check is performed.
2014-04-19 21:00:24 -07:00
Gregory Szorc
54e9611a41 run-tests: move remaining result processing to Test.run() 2014-04-19 20:53:45 -07:00
Gregory Szorc
49fbb46418 run-tests: move output difference processing to Test.run() 2014-04-19 20:52:58 -07:00
Gregory Szorc
fe13f7598d run-tests: generate timeout result in Test.run() 2014-04-19 20:48:16 -07:00
Gregory Szorc
3573cbd388 run-tests: add skip processing to Test 2014-04-19 20:47:14 -07:00
Gregory Szorc
d792278ce6 run-tests: move fail() into Test
The code was changed slightly as part of the migration to make use of
appropriate variables and modern Python conventions.
2014-04-19 20:41:08 -07:00
Gregory Szorc
42a72930a7 run-tests: move success() into Test 2014-04-19 20:35:54 -07:00
Gregory Szorc
8fab6ea01c run-tests: move err path handling to Test 2014-04-19 20:32:38 -07:00
Gregory Szorc
0dcb1a6ed2 run-tests: handle interrupted in Test.run() 2014-04-19 20:27:18 -07:00
Gregory Szorc
ddc2d7190f run-tests: kill daemons during Test.cleanup()
As a safety precaution, we kill daemons in Test.cleanup(). This is
necessary for a subsequent patch that will reraise KeyboardInterrupt
before killdaemons() runs as part of run().
2014-04-19 20:22:32 -07:00
Gregory Szorc
aa0568676a run-tests: capture reference output in Test.__init__
Reference output should be constant and doesn't need to be computed at
test execution time. We calculate it earlier.

This patch is the first in a mini series that will change how the
TestResult object works.
2014-04-19 18:50:40 -07:00
Gregory Szorc
c3bcf32fc2 run-tests: make globmatch a static method of TTest 2014-04-19 16:14:30 -07:00
Gregory Szorc
1b34005cfc run-tests: make rematch a static method of TTest 2014-04-19 16:13:02 -07:00
Gregory Szorc
19099dc4f1 run-tests: make linematch a static method of TTest
linematch only applies to t tests. It makes sense to move everything t
test related to the TTest class.
2014-04-19 16:11:49 -07:00
Gregory Szorc
df67209088 run-tests: finish moving tsttest() into TTest 2014-04-19 15:37:50 -07:00
Gregory Szorc
044e5b3e56 run-tests: move t test execution from tsttest() to TTest.run()
After this patch, tsttest() only contains output/result processing.
2014-04-19 15:28:31 -07:00