diff --git a/common.py b/common.py index e6ce8bed..efc4df6d 100644 --- a/common.py +++ b/common.py @@ -66,7 +66,14 @@ def _init_build_directory(config, initialised, directory, tute_directory, output tute_dir = "-DTUTORIAL_DIR=" + os.path.basename(tute_directory) args = ['-G', 'Ninja'] + config_dict[config] + [tute_dir] + \ ["-C", "../projects/sel4-tutorials/settings.cmake"] - return sh.cmake(args + [tute_directory], _cwd=directory, _out=output, _err=output) + result = None + if sh.__version__.startswith("1"): + result = sh.cmake(args + [tute_directory], _cwd=directory, _out=output, + _err=output) + else: + result = sh.cmake(args + [tute_directory], _cwd=directory, _out=output, + _err=output, _return_cmd=True) + return result def _init_tute_directory(config, tut, solution, task, directory, output=None): diff --git a/test.py b/test.py index 12c6e046..f5702b91 100755 --- a/test.py +++ b/test.py @@ -40,17 +40,28 @@ def print_pexpect_failure(failure): def run_single_test_iteration(build_dir, solution, logfile): # Build - result = sh.ninja(_out=logfile, _cwd=build_dir) + result = None + if sh.__version__.startswith("1"): + result = sh.ninja(_out=logfile, _cwd=build_dir) + else: + result = sh.ninja(_out=logfile, _cwd=build_dir, _return_cmd=True) if result.exit_code != 0: logging.error("Failed to build. Not deleting build directory %s" % build_dir) sys.exit(1) check = sh.Command(os.path.join(build_dir, "check")) if solution: - result = check(_out=logfile, _cwd=build_dir) + if sh.__version__.startswith("1"): + result = check(_out=logfile, _cwd=build_dir) + else: + result = check(_out=logfile, _cwd=build_dir, _return_cmd=True) else: # We check the start state if not solution - result = check("--start", _out=logfile, _cwd=build_dir) + if sh.__version__.startswith("1"): + result = check("--start", _out=logfile, _cwd=build_dir) + else: + result = check("--start", _out=logfile, _cwd=build_dir, + _return_cmd=True) for proc in psutil.process_iter(): if "qemu" in proc.name(): proc.kill()