run xpcshell self-tests in parallel
Categories
(Testing :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: froydnj, Assigned: glandium)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
This requires moving each test to a separate file so mach python-test
will actually run everything in parallel. I have a hacky proof-of-concept patch.
Reporter | ||
Comment 1•4 years ago
|
||
There is waaaaaay too much duplication in this patch for this to be an
actual, landable patch, but it can be a useful starting point for
discussion -- or for somebody to tell me I'm a n00b at Python unit
testing and there is a better way to do this.
All of these files were almost entirely machine created; the process goes like:
- Put the "header" of selftest.py -- everything before the first test
function into a file, call ittemplate
. - Put the
__main__
invocation in a file, call itmain
. - Run:
for name in $(grep 'def test' selftest.py |perl -p -e 's/\(self\)://' | f 2 |perl -p -e 's/test//')
do
cat template > selftest-${name}.py; echo "[selftest-${name}.py]
skip-if = python == 3" >> python.ini
done
to create the initial files.
4) Run:
for name in $(grep 'def test' selftest.py |perl -p -e 's/\(self\)://' | f 2 |perl -p -e 's/test//')
do
sed -n -e "/def test${name}(self):/,/^ [d@]/p" selftest.py|sed '$d' >> selftest-${name}.py
done
to pull out the individual functions for the tests and append them to
the correct file.
5) Massage any @unittest
decorators into place.
6) Append main
onto every new test file, which is left as an exercise
for the reader.
7) Remove all tests from selftest.py
.
This change cuts time for overall mach python-test -j12 --subsuite default
in about half on my machine, mostly because whatever test framework is
running has terrible overhead. But that's about 20s faster, so seems
mostly worth it.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
Work in progress. Works on Linux and Mac, times out on Windows.
Description
•