test bug: only attempt to compile when cc is available
This commit is contained in:
parent
f5fd7241ea
commit
3c4769c58d
1 changed files with 7 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import unittest
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import contextlib
|
import contextlib
|
||||||
|
from distutils.spawn import find_executable
|
||||||
|
|
||||||
is_py3k = sys.version_info[0] >= 3
|
is_py3k = sys.version_info[0] >= 3
|
||||||
BITS = tuple.__itemsize__ * 8
|
BITS = tuple.__itemsize__ * 8
|
||||||
|
|
@ -31,7 +32,6 @@ import llvmpy
|
||||||
|
|
||||||
tests = []
|
tests = []
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
if sys.version_info[:2] <= (2, 6):
|
if sys.version_info[:2] <= (2, 6):
|
||||||
|
|
@ -674,6 +674,7 @@ tests.append(TestTargetMachines)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class TestNative(TestCase):
|
class TestNative(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.tmpdir = tempfile.mkdtemp()
|
self.tmpdir = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
|
@ -694,8 +695,12 @@ class TestNative(TestCase):
|
||||||
return m
|
return m
|
||||||
|
|
||||||
def _compile(self, src):
|
def _compile(self, src):
|
||||||
|
cc = find_executable('cc')
|
||||||
|
if not cc:
|
||||||
|
return
|
||||||
|
|
||||||
dst = os.path.join(self.tmpdir, 'llvmobj.out')
|
dst = os.path.join(self.tmpdir, 'llvmobj.out')
|
||||||
s = subprocess.call(['cc', '-o', dst, src])
|
s = subprocess.call([cc, '-o', dst, src])
|
||||||
if s != 0:
|
if s != 0:
|
||||||
raise Exception("Cannot compile")
|
raise Exception("Cannot compile")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue