diff options
-rw-r--r-- | HACKING.rst | 4 | ||||
-rw-r--r-- | tests/programs.py | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/HACKING.rst b/HACKING.rst index b5627a9..53a482e 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -46,6 +46,10 @@ You can also run ``PYTHONPATH=. py.test``, which is quicker but only tests with a single version of Python, and runs in your host environment rather than a clean one managed by 'virtualenv'. +On Mac OS X the test suite mostly doesn't work, because the C compiler on Mac +OS X `cannot build statically linked programs +<https://stackoverflow.com/questions/5259249/>`_. + Testing that a sandbox conforms to the App Container spec --------------------------------------------------------- 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') |