Skip to content
Snippets Groups Projects
Unverified Commit 23a948e3 authored by Ryan Hancock's avatar Ryan Hancock
Browse files

Decoding check

parent 7716b2a6
No related branches found
No related tags found
No related merge requests found
...@@ -69,9 +69,15 @@ class Namespace: ...@@ -69,9 +69,15 @@ class Namespace:
def main(args): def main(args):
tests = [] tests = []
with open(args.log, "r") as f: encoding_error = False
with open(args.log, "rb") as f:
log = f.read() log = f.read()
log.strip() try:
log.decode(encoding='utf-8', errors='strict')
except:
encoding_error = True
log = log.decode(encoding='utf-8', errors='ignore')
log = "\n".join([ l.strip() for l in log.split("\n") ])
# Remove one cause topline is a split so would get empty line before # Remove one cause topline is a split so would get empty line before
tmp = log.split(">SPLIT<")[1:] tmp = log.split(">SPLIT<")[1:]
for t in tmp: for t in tmp:
...@@ -90,6 +96,8 @@ def main(args): ...@@ -90,6 +96,8 @@ def main(args):
report = Report() report = Report()
for eval_func, out_of in verify.RUBRIC.items(): for eval_func, out_of in verify.RUBRIC.items():
name, mark, comments = eval_func(tests, helpers) name, mark, comments = eval_func(tests, helpers)
if encoding_error:
comments = "We could not decode your log into ASCII, this could lead to undefined behaviour everywhere, you have a memory corruption most likely in your code"
report.add(name, mark, out_of, comments) report.add(name, mark, out_of, comments)
print(str(report)) print(str(report))
report.to_csv("/logs/report.csv") report.to_csv("/logs/report.csv")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment