diff options
Diffstat (limited to 'test/Configure')
-rw-r--r-- | test/Configure/CONFIGUREDIR.py | 4 | ||||
-rw-r--r-- | test/Configure/CONFIGURELOG.py | 8 | ||||
-rw-r--r-- | test/Configure/Configure.py | 36 |
3 files changed, 30 insertions, 18 deletions
diff --git a/test/Configure/CONFIGUREDIR.py b/test/Configure/CONFIGUREDIR.py index 2064886..ae1ea2b 100644 --- a/test/Configure/CONFIGUREDIR.py +++ b/test/Configure/CONFIGUREDIR.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation +# __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -22,7 +22,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "test/Configure.py 0.96.D308 2005/09/25 12:59:35 knight" +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that the configure context directory can be specified by diff --git a/test/Configure/CONFIGURELOG.py b/test/Configure/CONFIGURELOG.py index 456fcc9..4b63440 100644 --- a/test/Configure/CONFIGURELOG.py +++ b/test/Configure/CONFIGURELOG.py @@ -33,7 +33,9 @@ import TestSCons test = TestSCons.TestSCons() -test.write("SConstruct", """\ +SConstruct_path = test.workpath('SConstruct') + +test.write(SConstruct_path, """\ def CustomTest(context): context.Message('Executing Custom Test ...') context.Result(1) @@ -47,13 +49,13 @@ env = conf.Finish() test.run() expect = """\ -file SConstruct,line 6: +file %(SConstruct_path)s,line 6: \tConfigure(confdir = .sconf_temp) scons: Configure: Executing Custom Test ... scons: Configure: (cached) yes -""" +""" % locals() test.must_match('custom.logfile', expect, mode='r') diff --git a/test/Configure/Configure.py b/test/Configure/Configure.py index 41c858b..4063699 100644 --- a/test/Configure/Configure.py +++ b/test/Configure/Configure.py @@ -55,6 +55,7 @@ else: work_cnt = 0 work_dir = None python = TestSCons.python +_python_ = TestSCons._python_ test = TestSCons.TestSCons() _obj = TestSCons._obj _exe = TestSCons._exe @@ -123,7 +124,7 @@ def checkLogAndStdout(checks, results, cached, sconf_dir = sconf_dir sconstruct = sconstruct - log = re.escape("file " + sconstruct + ",line ") + r"\d+:" + ls + log = r'file\ \S*%s\,line \d+:' % re.escape(sconstruct) + ls if doCheckLog: lastEnd = matchPart(log, logfile, lastEnd) log = "\t" + re.escape("Configure(confdir = %s)" % sconf_dir) + ls if doCheckLog: lastEnd = matchPart(log, logfile, lastEnd) @@ -615,9 +616,9 @@ def CustomTest(*args): return 0 conf = env.Configure(custom_tests = {'MyTest' : CustomTest}) if not conf.MyTest(): - env.Command("hello", [], "%s cmd.py $TARGET") + env.Command("hello", [], '%(_python_)s cmd.py $TARGET') env = conf.Finish() -""" % python) +""" % locals()) test.run(chdir=work_dir, stderr="Hello World on stderr\n") # 4.2 test that calling Configure from a builder results in a @@ -673,7 +674,10 @@ conf.Finish() # 5.1 test the ConfigureDryRunError reset(EXACT) # exact match - test.write([work_dir, 'SConstruct'], """ + + SConstruct_path = test.workpath(work_dir, 'SConstruct') + + test.write(SConstruct_path, """ env = Environment() import os env.AppendENVPath('PATH', os.environ['PATH']) @@ -687,15 +691,17 @@ if not (r1 and not r2): test.run(chdir=work_dir, arguments='-n', status=2, stderr=""" scons: *** Cannot create configure directory ".sconf_temp" within a dry-run. -File "SConstruct", line 5, in ? -""") +File "%(SConstruct_path)s", line 5, in ? +""" % locals()) test.must_not_exist([work_dir, 'config.log']) test.subdir([work_dir, '.sconf_temp']) + + conftest_0_c = os.path.join(".sconf_temp", "conftest_0.c") test.run(chdir=work_dir, arguments='-n', status=2, stderr=""" -scons: *** Cannot update configure test "%s" within a dry-run. -File "SConstruct", line 6, in ? -""" % os.path.join(".sconf_temp", "conftest_0.c")) +scons: *** Cannot update configure test "%(conftest_0_c)s" within a dry-run. +File "%(SConstruct_path)s", line 6, in ? +""" % locals()) test.run(chdir=work_dir) checkLogAndStdout( ["Checking for C library %s... " % lib, @@ -722,7 +728,9 @@ File "SConstruct", line 6, in ? # 5.2 test the --config=<auto|force|cache> option reset(EXACT) # exact match - test.write([work_dir, 'SConstruct'], """ + SConstruct_path = test.workpath(work_dir, 'SConstruct') + + test.write(SConstruct_path, """ env = Environment(CPPPATH='#/include') import os env.AppendENVPath('PATH', os.environ['PATH']) @@ -736,10 +744,12 @@ env = conf.Finish() /* A header */ """) + conftest_0_c = os.path.join(".sconf_temp", "conftest_0.c") + test.run(chdir=work_dir, arguments='--config=cache', status=2, stderr=""" -scons: *** "%s" is not yet built and cache is forced. -File "SConstruct", line 6, in ? -""" % os.path.join(".sconf_temp", "conftest_0.c")) +scons: *** "%(conftest_0_c)s" is not yet built and cache is forced. +File "%(SConstruct_path)s", line 6, in ? +""" % locals()) test.run(chdir=work_dir, arguments='--config=auto') checkLogAndStdout( ["Checking for C header file non_system_header1.h... ", |