diff options
author | David Cournapeau <cournape@gmail.com> | 2008-09-03 08:29:43 (GMT) |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-09-03 08:29:43 (GMT) |
commit | 43f47128378072a3b78910bbc4274a1ff94ed9f7 (patch) | |
tree | bd9e84f6fd8bb3c2c0a7d69c9c8a9786692cf66e /src/engine/SCons/SConfTests.py | |
parent | c183b6e80b298e474a59b1c4f71d680183ca5519 (diff) | |
download | SCons-43f47128378072a3b78910bbc4274a1ff94ed9f7.zip SCons-43f47128378072a3b78910bbc4274a1ff94ed9f7.tar.gz SCons-43f47128378072a3b78910bbc4274a1ff94ed9f7.tar.bz2 |
Basic test for CheckCC.
Diffstat (limited to 'src/engine/SCons/SConfTests.py')
-rw-r--r-- | src/engine/SCons/SConfTests.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index ba9f2f5e..1399d3a 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -307,6 +307,48 @@ int main() { finally: sconf.Finish() + def _test_check_compilers(self, comp, func, name): + """This is the implementation for CheckCC and CheckCXX tests.""" + from copy import deepcopy + + # Check that Check* works + r = func() + assert r, "could not find %s ?" % comp + + # Check that Check* does fail if comp is not available in env + oldcomp = deepcopy(self.scons_env[comp]) + del self.scons_env[comp] + r = func() + assert not r, "%s worked wo comp ?" % name + + # Check that Check* does fail if comp is set but empty + self.scons_env[comp] = '' + r = func() + assert not r, "%s worked with comp = '' ?" % name + + # Check that Check* does fail if comp is set to buggy executable + self.scons_env[comp] = 'thiscccompilerdoesnotexist' + r = func() + assert not r, "%s worked with comp = thiscompilerdoesnotexist ?" % name + + # Check that Check* does fail if CFLAGS is buggy + self.scons_env[comp] = oldcomp + self.scons_env['%sFLAGS' % comp] = 'qwertyuiop' + r = func() + assert not r, "%s worked with %sFLAGS = qwertyuiop ?" % name + + def test_CheckCC(self): + """Test SConf.CheckCC() + """ + self._resetSConfState() + sconf = self.SConf.SConf(self.scons_env, + conf_dir=self.test.workpath('config.tests'), + log_file=self.test.workpath('config.log')) + try: + self._test_check_compilers('CC', sconf.CheckCC, 'CheckCC') + finally: + sconf.Finish() + def test_CheckHeader(self): """Test SConf.CheckHeader() |