diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-07-03 15:05:08 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@chickadee.tech> | 2017-08-11 17:16:13 -0700 |
| commit | fab634e3eeb456e9d5dffa2cabb9ded39c45d6b6 (patch) | |
| tree | 4f1926142546130d7bd0388303ebe0cd2ab1181c /tests/run-tests | |
| parent | f6a702538a0b3dd72879d65e3acc32520d4371f5 (diff) | |
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.
Diffstat (limited to 'tests/run-tests')
| -rwxr-xr-x | tests/run-tests | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/tests/run-tests b/tests/run-tests index f24fc0961..a45477dea 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -123,9 +123,13 @@ def run_micropython(pyb, args, test_file, is_special=False): cmdlist.append(test_file) # run the actual test - try: - output_mupy = subprocess.check_output(cmdlist) - except subprocess.CalledProcessError: + e = {"MICROPYPATH": os.getcwd() + ":", "LANG": "en_US.UTF-8"} + p = subprocess.Popen(cmdlist, env=e, stdout=subprocess.PIPE) + output_mupy = b'' + while p.poll() is None: + output_mupy += p.stdout.read() + output_mupy += p.stdout.read() + if p.returncode != 0: output_mupy = b'CRASH' # clean up if we had an intermediate .mpy file @@ -368,13 +372,19 @@ def run_tests(pyb, tests, args, base_path="."): output_expected = f.read() else: # run CPython to work out expected output - try: - output_expected = subprocess.check_output([CPYTHON3, '-B', test_file]) - if args.write_exp: - with open(test_file_expected, 'wb') as f: - f.write(output_expected) - except subprocess.CalledProcessError: + e = {"PYTHONPATH": os.getcwd(), + "PATH": os.environ["PATH"], + "LANG": "en_US.UTF-8"} + p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE) + output_expected = b'' + while p.poll() is None: + output_expected += p.stdout.read() + output_expected += p.stdout.read() + if p.returncode != 0: output_expected = b'CPYTHON3 CRASH' + elif args.write_exp: + with open(test_file_expected, 'wb') as f: + f.write(output_expected) # canonical form for all host platforms is to use \n for end-of-line output_expected = output_expected.replace(b'\r\n', b'\n') @@ -405,6 +415,10 @@ def run_tests(pyb, tests, args, base_path="."): f.write(output_expected) with open(filename_mupy, "wb") as f: f.write(output_mupy) + print("### Expected") + print(output_expected) + print("### Actual") + print(output_mupy) print("FAIL ", test_file) failed_tests.append(test_name) |
