From: cournape Date: Wed, 3 Sep 2008 08:29:43 +0000 (+0000) Subject: Basic test for CheckCC. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=082df6a59991903d3d868331be6893132568c32e;p=scons.git Basic test for CheckCC. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3330 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index ba9f2f5e..1399d3ab 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()