def get_test_cases(exclude=[]): if os.path.exists(tests_file): with open(tests_file, 'r') as inp: content = [l.strip() for l in inp.readlines()] if len([l for l in content if "Test Suite" in l]) > 1: raise AssertionError("More than one test suite exists in " + tests_file) curr_test = list() test_cases = list() count = 1 for line in content: if line.startswith("IN:"): test_name = str(count) if test_name not in exclude: test_cases.append( utils.TestCase(test_name, tests_file, curr_test)) curr_test = list() count += 1 if line.startswith("strto"): test_value = line.split("=")[1] curr_test.append(test_value) test_name = str(count) if curr_test and test_name not in exclude: test_cases.append(utils.TestCase(test_name, tests_file, curr_test)) return test_cases else: return []
def get_test_cases(exclude=[], directory=utils.tmp): all_tests = [t for t in glob.glob(directory + '/vector[0-9]*.test')] tcs = list() for t in [t for t in all_tests if utils.get_file_name(t) not in exclude]: with open(t, 'r') as inp: content = inp.read() tcs.append(utils.TestCase(utils.get_file_name(t), t, content)) return tcs
def get_test_cases(exclude=[], directory=tests_dir): all_tests = [t for t in glob.glob(directory + '/*.ktest')] tcs = list() for t in [t for t in all_tests if utils.get_file_name(t) not in exclude]: print(t) file_name = utils.get_file_name(t) with open(t, mode='rb') as inp: content = inp.read() tcs.append(utils.TestCase(file_name, t, content)) return tcs
def get_test_cases(exclude=[]): all_tests = [ t for t in os.listdir('.') if test_name_pattern.match(utils.get_file_name(t)) ] tcs = list() for t in [t for t in all_tests if utils.get_file_name(t) not in exclude]: with open(t, 'r') as inp: content = inp.read() tcs.append(utils.TestCase(utils.get_file_name(t), t, content)) return tcs
def get_test_cases(exclude=[]): # 'crashes' and 'hangs' cannot lead to an error as long as we don't abort in __VERIFIER_error() interesting_subdirs = ['queue'] tcs = list() for s in interesting_subdirs: abs_dir = os.path.join(findings_dir, s) for t in glob.glob(abs_dir + '/id:*'): test_name = get_test_name(t) if test_name not in exclude: with open(t, 'rb') as inp: content = inp.read() tcs.append(utils.TestCase(test_name, t, content)) return tcs
def get_test_cases(exclude=[]): if os.path.exists(tests_file): with open(tests_file, 'r') as inp: tests = [ l.strip() for l in inp.readlines() if l.strip().startswith('[') and l.strip().endswith(']') ] tests = [t for i, t in enumerate(tests) if str(i) not in exclude] tcs = list() for i, t in enumerate(tests): tcs.append(utils.TestCase(str(i), tests_file, t)) return tcs else: return []