diff --git a/bin/hooks/git_hook_main b/bin/hooks/git_hook_main index 6258d028ea026746b96b39c855ccbdc0f18ed8c7..556adc5c8f74ca4c90d628767e75ae6977f83c64 100755 --- a/bin/hooks/git_hook_main +++ b/bin/hooks/git_hook_main @@ -38,7 +38,7 @@ def main(repotype, repopath, hook, amend, *args): return OK if hook == "pre-push": - return run_ctest_minimal() + return run_ctest_minimal(repopath) logger.error(_("hook '{0}' is not defined").format(hook)) return 1 diff --git a/lib/hgaster/hooks/codeaster.py b/lib/hgaster/hooks/codeaster.py index 0b6687d6817faf4f6ba0e6c03769b92c07599171..22a7e47cf820db3c026556942ecb0f3064e1c89e 100644 --- a/lib/hgaster/hooks/codeaster.py +++ b/lib/hgaster/hooks/codeaster.py @@ -126,32 +126,42 @@ def aslint(repopath, paths=(), amend=False): return OK -def run_ctest_minimal(): - """Run a minimal list of testcases.""" +def run_ctest_minimal(repopath): + """Run a minimal list of testcases. + + Arguments: + repopath (str): Repository path. + """ from subprocess import call + from aslint.base_checkers import checkcontext from aslint.check_files import read_waf_parameters from aslint.config import ASCFG - logger.warning("Run a minimal list of testcases (for about 30 seconds).") - logger.info("NB: It will used the already installed version.") - try: - answ = input("Do you want to continue (y/[n], 'Ctrl+C' to abort push) ? ") - except KeyboardInterrupt: - return NOOK - if answ.lower() not in ("y", "o"): - logger.info("run_ctest skipped.") + checkcontext.reponame = get_repo_name(repopath) + if checkcontext.reponame != "src": return OK + logger.warning("Run a minimal list of testcases (for about 30 seconds).") + builddir = ASCFG.get("waf.builddir") target = "release" if os.environ.get("BUILD") == "debug": builddir = "build/mpidebug" if osp.isdir("build/mpidebug") else "build/mpi" target = "debug" wafc4che = osp.join(builddir, "c4che", target + "_cache.py") - c4che = read_waf_parameters(wafc4che) run_ctest = Path(c4che["BINDIR"]) / "run_ctest" + + logger.info("NB: This version will be used: %s", run_ctest) + try: + answ = input("Do you want to continue (y/[n], 'Ctrl+C' to abort push) ? ") + except KeyboardInterrupt: + return NOOK + if answ.lower() not in ("y", "o"): + logger.info("run_ctest skipped.") + return OK + cmd = [run_ctest, "-R", "(asrun0|mumps02b|supv002|vocab0|zzzz509j)", "--no-resutest"] if call(cmd): return NOOK