From 2e27753f4a19ad0e72c733e6a1759b0c3b9bd36b Mon Sep 17 00:00:00 2001 From: Benjamin Lipp Date: Tue, 10 Jun 2025 17:13:42 +0200 Subject: [PATCH] feat: move pretty_output to Python * Remove pretty_output_line from Bash * Remove pretty_output_line from click CLI Co-Authored-By: Anja Rabich --- marzipan/TODO.md | 4 ++-- marzipan/src/__init__.py | 12 +++++------- marzipan/src/analyze.sh | 4 ---- 3 files changed, 7 insertions(+), 13 deletions(-) mode change 100755 => 100644 marzipan/src/analyze.sh diff --git a/marzipan/TODO.md b/marzipan/TODO.md index 57d8813..9de1703 100644 --- a/marzipan/TODO.md +++ b/marzipan/TODO.md @@ -15,9 +15,9 @@ * `pretty_output` Bash function * ~~pretty_output_line~~ + * ~~click function intervention weirdness~~ + * ~~why is everything red in the pretty output? (see line 96 in __init__.py)~~ * awk RESULT flush in marzipan() - * click function intervention weirdness - * why is everything red in the pretty output? (see line 96 in __init__.py) * move the whole metaverif function to Python * move the whole analyze function to Python * find the files diff --git a/marzipan/src/__init__.py b/marzipan/src/__init__.py index c317c4a..227333c 100644 --- a/marzipan/src/__init__.py +++ b/marzipan/src/__init__.py @@ -53,11 +53,6 @@ def awk_prep(cpp_prep, awk_prep): file.write("\nprocess main") -#@click.command() -#@click.argument("prefix", required=True) -#@click.argument("mark", required=True) -#@click.argument("color", required=True) -#@click.argument("text", default='') def pretty_output_line(prefix, mark, color, text): prefix = f"[grey42]{prefix}[/grey42]" content = f"[{color}]{mark} {text}[/{color}]" @@ -93,7 +88,11 @@ def pretty_output(file_path): for outp in pkgs.sys.stdin: tz = pkgs.time.time() - if outp == expected[ctr]: + + # Output from ProVerif contains a trailing newline, which we do not have in the expected output. Remove it for meaningful matching. + outp_clean = outp.rstrip() + + if outp_clean == expected[ctr]: pretty_output_line(f"{int(tz - ta)}s ", "✔", "green", descs[ctr]) else: res = 1 @@ -154,6 +153,5 @@ main.add_command(clean) main.add_command(run_proverif) main.add_command(cpp) main.add_command(awk_prep) -#main.add_command(pretty_output_line) main.add_command(pretty_output) main.add_command(clean_warnings) diff --git a/marzipan/src/analyze.sh b/marzipan/src/analyze.sh old mode 100755 new mode 100644 index 1825ef1..4840e5a --- a/marzipan/src/analyze.sh +++ b/marzipan/src/analyze.sh @@ -24,10 +24,6 @@ color_clear='' checkmark="✔" cross="❌" -pretty_output_line() { - exc rosenpass-marzipan pretty-output-line "${@}" -} - pretty_output() { exc rosenpass-marzipan pretty-output "${@}" }