X-Git-Url: https://git.saurik.com/apple/dyld.git/blobdiff_plain/d3f1e533acc7f70659b8bde9b6c040974f05e03b..bc3b7c8cda49ed8598284a489c0bb9694c67c6a4:/testing/kernel-cache-tests/testall.py diff --git a/testing/kernel-cache-tests/testall.py b/testing/kernel-cache-tests/testall.py new file mode 100755 index 0000000..fd7cfba --- /dev/null +++ b/testing/kernel-cache-tests/testall.py @@ -0,0 +1,47 @@ +#!/usr/bin/python2.7 + +import string +import os +import json +import sys +import imp +import os.path +import traceback + +sys.dont_write_bytecode = True + +import KernelCollection + + +if __name__ == "__main__": + test_dir = os.path.realpath(os.path.dirname(__file__)) + sys.path.append(test_dir) + all_tests = os.listdir(test_dir) + all_tests.sort() + test_to_run = "" + if len(sys.argv) == 2: + test_to_run = sys.argv[1] + all_tests = [ test_to_run ] + for f in all_tests: + test_case = test_dir + "/" + f + "/test.py" + if os.path.isfile(test_case): + py_mod = imp.load_source(f, test_case) + check_func = getattr(py_mod, "check", 0) + if check_func == 0: + print "FAIL: " + f + ", missing check() function"; + else: + try: + kernelCollection = KernelCollection.KernelCollection(test_to_run != "") + check_func(kernelCollection) + print "PASS: " + f + except AssertionError, e: + _, _, tb = sys.exc_info() + tb_info = traceback.extract_tb(tb) + filename, line, func, text = tb_info[-1] + print "FAIL: " + f + ", " + text + except KeyError, e: + _, _, tb = sys.exc_info() + tb_info = traceback.extract_tb(tb) + filename, line, func, text = tb_info[-1] + print "FAIL: " + f + ", " + text +