diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2015-06-09 12:37:49 +0100 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2015-06-09 12:37:49 +0100 |
commit | b814d929ffba615faab7e7cbd09ecb4a01e2f50c (patch) | |
tree | 1239c571fc6d19ade9102df31fc63e7b18d1ec52 | |
parent | ed091ac398216bc7e35bd3ad3f6aaa57e69e7326 (diff) | |
download | sandboxlib-sam/tweaks-from-osx.tar.gz |
tests: Show compiler output if building the test C program fails.sam/tweaks-from-osx
-rw-r--r-- | tests/programs.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/programs.py b/tests/programs.py index 02ae798..c6f05ee 100644 --- a/tests/programs.py +++ b/tests/programs.py @@ -33,6 +33,7 @@ import py import pytest import subprocess +import sys import tempfile @@ -47,8 +48,13 @@ def build_c_program(source_code, output_path, compiler_args=None): f.write(source_code.encode('utf-8')) f.flush() - subprocess.check_call( - ['cc', '-static', f.name, '-o', str(output_path)]) + process = subprocess.Popen( + ['cc', '-static', f.name, '-o', str(output_path)], + stderr=subprocess.PIPE) + process.wait() + if process.returncode != 0: + pytest.fail( + "Unable to compile test C program: %s" % process.stderr.read()) @pytest.fixture(scope='session') |