summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Biondi <juanernestobiondi@gmail.com>2019-01-10 17:21:30 +0100
committerGitHub <noreply@github.com>2019-01-10 17:21:30 +0100
commita6e0ea3e23d196e8e5f104f2392a01d4891d600e (patch)
tree8e6660c17654b886eab0db1f09e1f38df2dc8ba2 /tools
parent749b2b0aacffb0dc3445699ef5251cee723160ff (diff)
parentdabb8ffdaa46ae84d0cdbd00511da9300a4dc8df (diff)
Merge pull request #3 from adafruit/master
Add latest changes on repo
Diffstat (limited to 'tools')
-rwxr-xr-xtools/print_status.py15
-rwxr-xr-xtools/tinytest-codegen.py8
2 files changed, 21 insertions, 2 deletions
diff --git a/tools/print_status.py b/tools/print_status.py
new file mode 100755
index 000000000..ed563fd68
--- /dev/null
+++ b/tools/print_status.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import sys
+if len(sys.argv) != 2:
+ print("""\
+Usage: print_status.py STATUS_FILENAME
+ STATUS_FILENAME contains one line with an integer status."""
+ )
+ sys.exit(1)
+with open(sys.argv[1], 'r') as status_in:
+ status = int(status_in.readline())
+
+print('{} with status {}'.format(
+ "\033[32msucceeded\033[0m" if status == 0 else "\033[31mfailed\033[0m",
+ status))
diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py
index 7f14db4ba..7a48f8a9a 100755
--- a/tools/tinytest-codegen.py
+++ b/tools/tinytest-codegen.py
@@ -23,7 +23,7 @@ def chew_filename(t):
def script_to_map(test_file):
r = {"name": chew_filename(test_file)["func"]}
- with open(t) as test:
+ with open(test_file, "rb") as test:
script = test.readlines()
# Test for import skip_if and inject it into the test as needed.
@@ -39,7 +39,11 @@ def script_to_map(test_file):
continue
script.insert(index + total_lines, "\t" + line)
total_lines += 1
- r['script'] = escape(''.join(script))
+ r['script'] = escape(b''.join(script))
+
+ with open(test_file + ".exp", "rb") as f:
+ r["output"] = escape(f.read())
+
return r
test_function = (