diff options
author | Steven Knight <knight@baldmt.com> | 2003-06-10 14:48:53 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-06-10 14:48:53 (GMT) |
commit | 19a3c78db2cdd47cc38df41c014c30072c1ac461 (patch) | |
tree | 0062bbecd0c31906eff05c339458537df9ac7a29 /test/Configure.py | |
parent | e2386c6ee94cca68e90eb9faee33b7f4d425b39f (diff) | |
download | SCons-19a3c78db2cdd47cc38df41c014c30072c1ac461.zip SCons-19a3c78db2cdd47cc38df41c014c30072c1ac461.tar.gz SCons-19a3c78db2cdd47cc38df41c014c30072c1ac461.tar.bz2 |
Fix use of SConf with SConscriptChdir(). (David Snopek, Christoph Wiedemann)
Diffstat (limited to 'test/Configure.py')
-rw-r--r-- | test/Configure.py | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/test/Configure.py b/test/Configure.py index 97333ab..eeb040d 100644 --- a/test/Configure.py +++ b/test/Configure.py @@ -27,6 +27,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import re import sys +import shutil import TestCmd import TestSCons @@ -64,7 +65,7 @@ def checkLog( test, logfile, numUpToDate, numCache ): test.fail_test( len( re.findall( "is up to date", log ) ) != numUpToDate ) test.fail_test( len( re.findall( "\(cached\): Building \S+ failed in a previous run.", log ) ) != numCache ) except: - #print "contents of log ", test.workpath(logfile), "\n", log + print "contents of log ", test.workpath(logfile), "\n", log raise @@ -218,10 +219,16 @@ Checking for C header no_std_c_header.h ... failed # 2.3 test that Configure calls in SConscript files work # even if BuildDir is set reset() - test.subdir( 'sub' ) test.write( 'SConstruct', """ +opts = Options() +opts.Add('chdir') +env = Environment(options=opts) +if env['chdir'] == 'yes': + SConscriptChdir(1) +else: + SConscriptChdir(0) BuildDir( 'build', '.' ) SConscript( 'build/SConscript' ) """) @@ -233,7 +240,10 @@ env = Environment() import os env['ENV']['PATH'] = os.environ['PATH'] conf = Configure( env ) -conf.CheckCHeader( 'math.h' ) +if not conf.CheckCHeader( 'math.h' ): + Exit(1) +if conf.CheckCHeader( 'no_std_c_header.h' ): + Exit(1) env = conf.Finish() env.Program( 'TestProgram', 'TestProgram.c' ) """) @@ -248,13 +258,34 @@ int main() { printf( "Hello\\n" ); } """) - test.run() + required_stdout = test.wrap_stdout(build_str='.*', + read_str= + """Checking for C header math.h ... ok +Checking for C header no_std_c_header.h ... failed +""") + # first with SConscriptChdir(0) + test.run(stdout = required_stdout, arguments='chdir=no') checkFiles( test, [".sconf_temp/.cache", "config.log"] ) + checkLog( test, 'config.log', 0, 0 ) + + test.run(stdout = required_stdout, arguments='chdir=no') + checkFiles( test, [".sconf_temp/.cache", "config.log"] ) + checkLog( test, 'config.log', 3, 1 ) + + shutil.rmtree(test.workpath(".sconf_temp")) + + # now with SConscriptChdir(1) + test.run(stdout = required_stdout, arguments='chdir=yes') + checkFiles( test, [".sconf_temp/.cache", "config.log"] ) + checkLog( test, 'config.log', 0, 0 ) + + test.run(stdout = required_stdout, arguments='chdir=yes') + checkFiles( test, [".sconf_temp/.cache", "config.log"] ) + checkLog( test, 'config.log', 3, 1 ) # 3.1 test custom tests reset() - compileOK = '#include <stdio.h>\\nint main() {printf("Hello");return 0;}' compileFAIL = "syntax error" linkOK = compileOK |