def make_makefile(directory): """ Make makefile into a selected directory. Parameters ---------- directory : str relative path to tested directory """ print("Testing " + directory) make_ok = False old_pwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory) run_fobis(fake_args=['build', '-f', 'fobos', '-m', 'makefile_check']) make_ok = filecmp.cmp('makefile_check', 'makefile_ok') if not make_ok: if os.path.exists('makefile_ok2'): make_ok = filecmp.cmp('makefile_check', 'makefile_ok2') if not make_ok: print('makefile generated') with open('makefile_check', 'r') as mk_check: print(mk_check.read()) run_fobis(fake_args=['clean', '-f', 'fobos']) os.chdir(old_pwd) return make_ok
def run_install(directory): """ Run the install function into a selected directory. Parameters ---------- directory : str relative path to tested directory """ print("Testing " + directory) install_ok = False old_pwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory) run_fobis(fake_args=['clean', '-f', 'fobos']) run_fobis(fake_args=['build', '-f', 'fobos']) run_fobis(fake_args=['install', '-f', 'fobos', '--prefix', 'prefix']) files = [os.path.join(dp, f) for dp, _, filenames in os.walk('./prefix/') for f in filenames] install_ok = len(files) > 0 run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize']) run_fobis(fake_args=['clean', '-f', 'fobos']) os.chdir(old_pwd) return install_ok
def run_build(directory): """ Method for running the build function into a selected directory. Parameters ---------- directory : str relative path to tested directory """ print("Testing " + directory) build_ok = False old_pwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory) run_fobis(fake_args=['clean', '-f', 'fobos']) try: run_fobis(fake_args=['build', '-f', 'fobos']) build_ok = os.path.exists(directory) except: if directory == 'build-test6': with open('building-errors.log') as logerror: build_ok = 'Unclassifiable statement' in list(logerror)[-1] os.remove('building-errors.log') run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize']) run_fobis(fake_args=['clean', '-f', 'fobos']) os.chdir(old_pwd) return build_ok
def run_rule(directory): """ Run the rule function into a selected directory. Parameters ---------- directory : str relative path to tested directory """ print("Testing " + directory) rule_ok = False old_pwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory) run_fobis(fake_args=['rule', '-ex', 'test']) rule_ok = True os.chdir(old_pwd) return rule_ok
def run_clean(directory): """ Method for running the clean function into a selected directory. Parameters ---------- directory : str relative path to tested directory """ print("Testing " + directory) old_pwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory) run_fobis(fake_args=['build', '-f', 'fobos']) run_fobis(fake_args=['clean', '-f', 'fobos']) clean_ok = not os.path.exists(directory) os.chdir(old_pwd) return clean_ok
def run_doctest(directory): """ Method for running the doctest function into a selected directory. Parameters ---------- directory : str relative path to tested directory """ print("Testing " + directory) doctest_ok = True old_pwd = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory) run_fobis(fake_args=['clean', '-f', 'fobos']) run_fobis(fake_args=['doctests', '-f', 'fobos']) run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize']) run_fobis(fake_args=['clean', '-f', 'fobos']) os.chdir(old_pwd) return doctest_ok