diff --git a/src/auto_grader/commands/test/compile.py b/src/auto_grader/commands/test/compile.py index 8282c45..01ea727 100644 --- a/src/auto_grader/commands/test/compile.py +++ b/src/auto_grader/commands/test/compile.py @@ -20,7 +20,9 @@ from auto_grader.utils import build_root, clean_root help='Overrides command that is run to build roots. The default command is `make distclean`.') @click.option('-t', '--timeout', default=10, type=click.INT, help='Sets timeout of both clean and build commands, defaults to 10s.') -def compile(number, path, command, student, timeout, clean_command): +@click.option('--verbose', is_flag=True, default=False, + help='Sets timeout of both clean and build commands, defaults to 10s.') +def compile(number, path, command, student, timeout, clean_command, verbose): current_wd = os.getcwd() students = os.listdir(path) if student and student not in students: @@ -51,7 +53,11 @@ def compile(number, path, command, student, timeout, clean_command): f"{indent_text('[CLEAN]:' + clean_log.oneline(type_as_prefix=False), 4)}") continue log = build_root(root, command, timeout=timeout) - click.echo(f"{indent_text(log.oneline(type_as_prefix=False), 4)}") + if not verbose: + click.echo( + f"{indent_text(log.oneline(type_as_prefix=False), 4)}") + else: + click.echo(f"{indent_text(log.as_str(),4)}") clean_log = clean_root(root, clean_command) if not clean_log.run_success or not clean_log.cmd_return_code == 0: click.echo( diff --git a/src/auto_grader/commands/test/dissect.py b/src/auto_grader/commands/test/dissect.py index 403974e..f5b962f 100644 --- a/src/auto_grader/commands/test/dissect.py +++ b/src/auto_grader/commands/test/dissect.py @@ -219,10 +219,10 @@ def dissect(number, solution_path, path): shlex.split(command), capture_output=True, text=True, timeout=10) if result.returncode == 0: click.echo( - f"\t[{os.path.basename(root)}]:[BUILD]:[{function}]:{SUCCESS_BOX}") + f"\t[{os.path.basename(root)}]:[{function}]:[BUILD]:{SUCCESS_BOX}") else: click.echo( - f"\t[{os.path.basename(root)}]:[BUILD]:[{function}]:{ERROR_BOX}") + f"\t[{os.path.basename(root)}]:[{function}]:[BUILD]:{ERROR_BOX}") click.echo(f"\t\tstderr: {result.stderr[:61]:61s}...") continue @@ -238,14 +238,14 @@ def dissect(number, solution_path, path): except subprocess.TimeoutExpired: result.returncode = 1 click.echo( - f"\t[{os.path.basename(root)}]:[RUN]:[{function}]:{ERROR_BOX} -- Timeout") + f"\t[{os.path.basename(root)}]:[{function}]:[RUN]:{ERROR_BOX} -- Timeout") if result.returncode == 0: click.echo( - f"\t[{os.path.basename(root)}]:[RUN]:[{function}]:{SUCCESS_BOX}") + f"\t[{os.path.basename(root)}]:[{function}]:[RUN]:{SUCCESS_BOX}") else: click.echo( - f"\t[{os.path.basename(root)}]:[RUN]:[{function}]:{ERROR_BOX}") + f"\t[{os.path.basename(root)}]:[{function}]:[RUN]:{ERROR_BOX}") click.echo(f"\t\tstderr: {result.stderr[:61]:61s}...") continue @@ -254,9 +254,9 @@ def dissect(number, solution_path, path): if np.allclose(ref_sol_data, usr_sol_data, rtol=1e-1) == 0: click.echo( - f"\t[{os.path.basename(root)}]:[CORRECT]:[{function}]:{SUCCESS_BOX}") + f"\t[{os.path.basename(root)}]:[{function}]:[CORRECT]:{SUCCESS_BOX}") else: click.echo( - f"\t[{os.path.basename(root)}]:[CORRECT]:[{function}]:{ERROR_BOX}") + f"\t[{os.path.basename(root)}]:[{function}]:[CORRECT]:{ERROR_BOX}") continue os.chdir(current_wd) diff --git a/src/auto_grader/commands/test/run.py b/src/auto_grader/commands/test/run.py index a31b8c8..5cbaef0 100644 --- a/src/auto_grader/commands/test/run.py +++ b/src/auto_grader/commands/test/run.py @@ -49,6 +49,7 @@ def run( clean_command, exe_name ): + print("NOT IMPLEMENTED") pass # current_wd = os.getcwd() # students = os.listdir(path)