mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 13:23:08 +02:00
Tests: Parallelize bash_tap.sh tests
- bash_tap.sh, like the Python test suite, runs tests in a temporary directory and can be parallelized.
This commit is contained in:
parent
129aeb1845
commit
d9dc685feb
1 changed files with 19 additions and 9 deletions
22
test/run_all
22
test/run_all
|
@ -70,17 +70,12 @@ class TestRunner(object):
|
||||||
for test in glob.glob("*.t") + glob.glob("*.t.exe"):
|
for test in glob.glob("*.t") + glob.glob("*.t.exe"):
|
||||||
if os.access(test, os.X_OK):
|
if os.access(test, os.X_OK):
|
||||||
# Executables only
|
# Executables only
|
||||||
if not cmd_args.serial:
|
if self._is_parallelizable(test):
|
||||||
with open(test, 'rb') as fh:
|
|
||||||
if b"/usr/bin/env python" in fh.read(50):
|
|
||||||
log.debug("Treating as parallel: %s", test)
|
log.debug("Treating as parallel: %s", test)
|
||||||
self._parallelq.put(test)
|
self._parallelq.put(test)
|
||||||
else:
|
else:
|
||||||
log.debug("Treating as serial: %s", test)
|
log.debug("Treating as serial: %s", test)
|
||||||
self._serialq.put(test)
|
self._serialq.put(test)
|
||||||
else:
|
|
||||||
log.debug("Treating %s as serial", test)
|
|
||||||
self._serialq.put(test)
|
|
||||||
else:
|
else:
|
||||||
log.debug("Ignored test %s as it is not executable", test)
|
log.debug("Ignored test %s as it is not executable", test)
|
||||||
|
|
||||||
|
@ -116,6 +111,21 @@ class TestRunner(object):
|
||||||
log.debug("Adding timestamp %s to TAP file", timestamp)
|
log.debug("Adding timestamp %s to TAP file", timestamp)
|
||||||
self.tap.write(timestamp)
|
self.tap.write(timestamp)
|
||||||
|
|
||||||
|
def _is_parallelizable(self, test):
|
||||||
|
if cmd_args.serial:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# This is a pretty weird way to do it, and not realiable.
|
||||||
|
# We are dealing with some binary tests though.
|
||||||
|
with open(test, 'rb') as fh:
|
||||||
|
header = fh.read(100).split(b"\n")
|
||||||
|
if len(header) >= 2 and \
|
||||||
|
((b"/usr/bin/env python" in header[0]) or \
|
||||||
|
(header[1][-14:] == b"bash_tap_tw.sh")):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def _get_remaining_tests(self):
|
def _get_remaining_tests(self):
|
||||||
return self._parallelq.qsize() + self._serialq.qsize()
|
return self._parallelq.qsize() + self._serialq.qsize()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue