From fab634e3eeb456e9d5dffa2cabb9ded39c45d6b6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 3 Jul 2017 15:05:08 -0700 Subject: Turn on Rosie CI testing to test new builds on real hardware. This introduces a skip_if module that can be used by tests to determine when they should be skipped due to the environment. Some tests have been split in order to have finer grained skip control. --- tools/tinytest-codegen.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py index dadfea1cc..0f9e62847 100755 --- a/tools/tinytest-codegen.py +++ b/tools/tinytest-codegen.py @@ -20,7 +20,23 @@ def chew_filename(t): def script_to_map(t): r = { 'name': chew_filename(t)['func'] } - with open(t) as f: r['script'] = escape(''.join(f.readlines())) + with open(t) as test: + script = test.readlines() + + # Test for import skip_if and inject it into the test as needed. + if "import skip_if\n" in script: + index = script.index("import skip_if\n") + script.pop(index) + script.insert(index, "class skip_if:\n") + with open("../tests/skip_if.py") as skip_if: + total_lines = 1 + for line in skip_if: + stripped = line.strip() + if not stripped or stripped.startswith(("#", "\"\"\"")): + continue + script.insert(index + total_lines, "\t" + line) + total_lines += 1 + r['script'] = escape(''.join(script)) return r test_function = ( -- cgit v1.2.3