From 376c8bef903657e020e482037b94a7b63514f640 Mon Sep 17 00:00:00 2001 From: jwansek Date: Sat, 12 Feb 2022 13:19:48 +0000 Subject: added rendering runtime analysis to markdown --- examplerun.bat | 2 +- smarker.conf | 4 +++- templates/md.jinja2 | 28 ++++++++++++++++++++++++++++ templates/txt.jinja2 | 2 +- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/examplerun.bat b/examplerun.bat index 2c5217d..48aa4eb 100644 --- a/examplerun.bat +++ b/examplerun.bat @@ -1,3 +1,3 @@ zip -r 100301654.zip .\ExampleSubmission\ -python .\mark.py -s 100301654.zip -a .\ExampleAssessments\example.yml -f txt -o auto +python .\mark.py -s 100301654.zip -a .\ExampleAssessments\example.yml -f md -o auto rm 100301654.zip \ No newline at end of file diff --git a/smarker.conf b/smarker.conf index 1d6b9da..b700f85 100644 --- a/smarker.conf +++ b/smarker.conf @@ -7,9 +7,11 @@ passwd = smarkerPassword [md] show_full_docs = True show_source = True +show_all_regex_occurrences = True +show_all_run_output = True [txt] show_full_docs = True show_source = True show_all_regex_occurrences = True -show_all_run_output = False \ No newline at end of file +show_all_run_output = True \ No newline at end of file diff --git a/templates/md.jinja2 b/templates/md.jinja2 index 400da26..f998f7c 100644 --- a/templates/md.jinja2 +++ b/templates/md.jinja2 @@ -100,6 +100,34 @@ Please note that this file cannot be analysed or have tests preformed upon it- {{ expand_function(function_name, function_contents)|indent(8, True) }} {%- endfor -%} {%- endif -%} +{% if "run" in files_contents.keys() %} + - #### Runtime Analysis: +{%- set flat_runtime = flatten_struct(files_contents["run"]) %} +{%- for cmd, runtime_contents in flat_runtime.items() %} + - ##### Command `{{ cmd }}`: + - **Monitor:** +{%- if "monitor" in runtime_contents.keys() %} + - {{ runtime_contents["monitor"] }} +{%- else %} + - stdout +{%- endif %} + - **Regexes:** +{%- for regex_, results in runtime_contents["regexes"].items() %} + - `{{regex_}}`: + - Found occurrences: {{ len_(results) }} +{%- if md_show_all_regex_occurrences == "True" and len_(results) > 0 %} + - Occurrences list: +{%- for result in results %} + - `{{ result }}` +{%- endfor -%} +{%- if txt_show_all_run_output == "True" %} + - Full runtime output: +{{ code_block(runtime_contents["full_output"])|indent(24, True) }} +{%- endif -%} +{%- endif -%} +{%- endfor -%} +{%- endfor -%} +{%- endif -%} {%- endif -%} {% else %} - [ ] File not present diff --git a/templates/txt.jinja2 b/templates/txt.jinja2 index b27abda..5ca0c62 100644 --- a/templates/txt.jinja2 +++ b/templates/txt.jinja2 @@ -131,7 +131,7 @@ Report generated at {{ get_datetime() }} {{ runtime_contents["full_output"]|indent(20, False) }} ``` {%- endif -%} - {%- endfor -%} + {%- endfor -%} {%- endif -%} {%- endif -%} {% else %} -- cgit v1.2.3