summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2015-06-09 12:37:49 +0100
committerSam Thursfield <sam@afuera.me.uk>2015-06-09 12:37:49 +0100
commitb814d929ffba615faab7e7cbd09ecb4a01e2f50c (patch)
tree1239c571fc6d19ade9102df31fc63e7b18d1ec52
parented091ac398216bc7e35bd3ad3f6aaa57e69e7326 (diff)
downloadsandboxlib-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.py10
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')