summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/GenerateTests.py5
-rwxr-xr-xtest/RegressTests.py25
2 files changed, 18 insertions, 12 deletions
diff --git a/test/GenerateTests.py b/test/GenerateTests.py
index 70baee28..61c31f5d 100755
--- a/test/GenerateTests.py
+++ b/test/GenerateTests.py
@@ -130,6 +130,7 @@ def run_gen_test(i):
harness.success()
else:
harness.failure()
+ return harness.failed
if multiproc:
pool = Pool(jobs*2)
@@ -137,7 +138,8 @@ else:
pool = None
if pool:
- pool.map(run_gen_test, range(beg_range, end_range))
+ harness.failed = sum(pool.map(run_gen_test,
+ range(beg_range, end_range)))
else:
for i in range(beg_range, end_range):
run_gen_test(i)
@@ -145,4 +147,5 @@ else:
if pool:
pool.close()
pool.join()
+
harness.exit()
diff --git a/test/RegressTests.py b/test/RegressTests.py
index 73a05d52..f693bf5b 100755
--- a/test/RegressTests.py
+++ b/test/RegressTests.py
@@ -154,18 +154,22 @@ class RegressFile(object):
if not use_stdin:
os.remove(tempdata[1])
- def run_tests(self, pool):
+ def run_tests(self):
test = self.read_test()
while test:
- if pool:
- pool.apply_async(RegressFile.run_test, (self, test,))
- else:
- self.run_test(test)
+ self.run_test(test)
test = self.read_test(test)
+ return harness.failed
def close(self):
self.fd.close()
+def do_test(path):
+ entry = RegressFile(path)
+ failed = entry.run_tests()
+ entry.close()
+ return failed
+
if __name__ == '__main__':
if multiproc:
pool = Pool(jobs*2)
@@ -173,17 +177,16 @@ if __name__ == '__main__':
pool = None
if os.path.isdir(tests):
- for test_file in os.listdir(tests):
- if re.search('\.test$', test_file):
- entry = RegressFile(os.path.join(tests, test_file))
- entry.run_tests(pool)
- entry.close()
+ tests = [os.path.join(tests, x)
+ for x in os.listdir(tests) if x.endswith('.test')]
+ harness.failed = sum(pool.map(do_test, tests, 1))
else:
entry = RegressFile(tests)
- entry.run_tests(pool)
+ entry.run_tests()
entry.close()
if pool:
pool.close()
pool.join()
+
harness.exit()