From b814d929ffba615faab7e7cbd09ecb4a01e2f50c Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 9 Jun 2015 12:37:49 +0100 Subject: tests: Show compiler output if building the test C program fails. --- tests/programs.py | 10 ++++++++-- 1 file 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') -- cgit v1.2.1