summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-05 10:23:57 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-05 10:23:57 -0800
commit4db1f75834602aa1215b58cbad737593c99ccdc2 (patch)
tree5580d5e161dcb37e11f6939b85b41312dd72429f
parentcb27409921300ad5ea6ccc5e29d3c78d2ed048b3 (diff)
Add timeout to pathological_tests.py.
Tests must complete in 8 seconds or are errors.
-rw-r--r--test/pathological_tests.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/pathological_tests.py b/test/pathological_tests.py
index dd80092..40552de 100644
--- a/test/pathological_tests.py
+++ b/test/pathological_tests.py
@@ -5,6 +5,8 @@ import re
import argparse
import sys
import platform
+import multiprocessing
+import time
from cmark import CMark
if __name__ == "__main__":
@@ -92,7 +94,17 @@ def run_pathological_test(description, results):
print("Testing pathological cases:")
for description in pathological:
- run_pathological_test(description, results)
+ p = multiprocessing.Process(target=run_pathological_test,
+ args=(description, results,))
+ p.start()
+ # wait 8 seconds or until it finishes
+ p.join(8)
+ # kill it if still active
+ if p.is_alive():
+ print(description, '[TIMEOUT]')
+ p.terminate()
+ results['errored'] += 1
+ p.join()
print("%d passed, %d failed, %d errored" %
(results['passed'], results['failed'], results['errored']))