def is_package(suite): path = config.regression_home() for s in suite.split('.'): path = os.path.join(path, s) if os.path.exists(path) and os.path.isdir(path): return True return False
def script_path(suite): assert is_testcase(suite) path = config.regression_home() for s in suite.split('.'): path = os.path.join(path, s) python_path = path + python_ext() if os.path.exists(python_path) and os.path.isfile(python_path): return python_path return None
def source_path(suite): assert is_testcase(suite) path = config.regression_home() for s in suite.split('.'): path = os.path.join(path, s) cxx_path = path + cxx_ext() if os.path.exists(cxx_path) and os.path.isfile(cxx_path): return cxx_path c_path = path + c_ext() if os.path.exists(c_path) and os.path.isfile(c_path): return c_path return None
def is_testcase(suite): path = config.regression_home() for s in suite.split('.'): path = os.path.join(path, s) cxx_path = path + cxx_ext() c_path = path + c_ext() python_path = path + python_ext() source_exists = False script_exists = False if os.path.exists(cxx_path) and os.path.isfile(cxx_path): source_exists = True if os.path.exists(c_path) and os.path.isfile(c_path): source_exists = True if os.path.exists(python_path) and os.path.isfile(python_path): script_exists = True if source_exists and script_exists: return True else: return False
def list_subsuites(suite): assert is_package(suite) subsuites = [] path = config.regression_home() for s in suite.split('.'): path = os.path.join(path, s) assert os.path.isdir(path) for f in os.listdir(path): if f.startswith('.'): continue # ignore hidden files and directories new_path = os.path.join(path, f) if os.path.isfile(new_path): name, ext = os.path.splitext(f) subsuite = suite + '.' + name if is_source(ext) and is_testcase(subsuite): subsuites.append(subsuite) if os.path.isdir(new_path): subsuite = suite + '.' + f subsuites.append(subsuite) return subsuites
def valid_suite_set(): base_dir = config.regression_home() return find_suites('', base_dir)