summaryrefslogtreecommitdiff
path: root/test/RegressTests.py
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-23 19:31:06 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-23 19:31:06 -0400
commiteda6cbd0146d371653feec70e0eb3ee4e4c56379 (patch)
treeaeb4e1ace0f9b284789f66f3ceb30bed66946b93 /test/RegressTests.py
parent014fde3418783d1ee1ec7fe4ea6c8b04ae7f6cd8 (diff)
parent93807fade69dd4f0ec575eda78fe1a77a85c24e3 (diff)
downloadfork-ledger-eda6cbd0146d371653feec70e0eb3ee4e4c56379.tar.gz
fork-ledger-eda6cbd0146d371653feec70e0eb3ee4e4c56379.tar.bz2
fork-ledger-eda6cbd0146d371653feec70e0eb3ee4e4c56379.zip
Merge branch 'next'
Diffstat (limited to 'test/RegressTests.py')
-rwxr-xr-xtest/RegressTests.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/test/RegressTests.py b/test/RegressTests.py
index 0472ac90..2d8ef8e8 100755
--- a/test/RegressTests.py
+++ b/test/RegressTests.py
@@ -52,7 +52,7 @@ class RegressFile(object):
def read_section(self):
lines = []
line = self.fd.readline()
- while not self.is_directive(line):
+ while line and not self.is_directive(line):
lines.append(self.transform_line(line))
line = self.fd.readline()
return (lines, line)
@@ -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,19 @@ 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')]
+ if pool:
+ harness.failed = sum(pool.map(do_test, tests, 1))
+ else:
+ harness.failed = sum(map(do_test, tests))
else:
entry = RegressFile(tests)
- entry.run_tests(pool)
+ entry.run_tests()
entry.close()
if pool:
pool.close()
pool.join()
+
harness.exit()