summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordirkbaechle <dl9obn@darc.de>2014-12-21 11:40:29 +0100
committerdirkbaechle <dl9obn@darc.de>2014-12-21 11:40:29 +0100
commitd9f35601599181e30be880ce8a94261e9d100739 (patch)
tree1395b505baa89a31ce0125790dce8b9750d76c3d
parent4a893d5461e27fe0c52988d912232b7747a68aee (diff)
parentec44963c058ef0460ac69a4cb8f5310da9a8c5e9 (diff)
downloadscons-d9f35601599181e30be880ce8a94261e9d100739.tar.gz
Merged in dirkbaechle/scons (pull request #189)
Fix for Interactive/configure test (fails under Windows currently)
-rw-r--r--test/Interactive/configure.py55
1 files changed, 38 insertions, 17 deletions
diff --git a/test/Interactive/configure.py b/test/Interactive/configure.py
index ceb1aea2..1a92f6c4 100644
--- a/test/Interactive/configure.py
+++ b/test/Interactive/configure.py
@@ -32,20 +32,43 @@ Also tests that "b" can be used as a synonym for "build".
import TestSCons
+_python_ = TestSCons._python_
+
test = TestSCons.TestSCons()
-test.write('SConstruct', """\
+test.write('mycc.py', r"""
import sys
+outfile = open(sys.argv[1], 'wb')
+infile = open(sys.argv[2], 'rb')
+for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']:
+ outfile.write(l)
+sys.exit(0)
+""")
-env = Environment()
-
-conf = Configure(env)
-if not conf.CheckCXX():
- sys.exit(1)
+test.write('SConstruct', """\
+env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE',
+ OBJSUFFIX='.obj')
+
+# Ensure that our 'compiler' works...
+def CheckMyCC(context):
+ context.Message('Checking for MyCC compiler...')
+ result = context.TryBuild(context.env.Object,
+ 'int main(void) {return 0;}',
+ '.cpp')
+ context.Result(result)
+ return result
+
+conf = Configure(env,
+ custom_tests = {'CheckMyCC' : CheckMyCC})
+
+if conf.CheckMyCC():
+ pass # build succeeded
+else:
+ Exit(1)
conf.Finish()
-env.Program('foo','foo.cpp')
-""")
+env.Object('foo.obj','foo.cpp')
+""" % locals())
test.write('foo.cpp', """\
#include <stdio.h>
@@ -60,11 +83,11 @@ int main (int argc, char *argv[])
scons = test.start(arguments = '-Q --interactive')
# Initial build
-scons.send("build foo\n")
+scons.send("build foo.obj\n")
-test.wait_for(test.workpath('foo'))
+test.wait_for(test.workpath('foo.obj'))
# Update without any changes -> no action
-scons.send("build foo\n")
+scons.send("build foo.obj\n")
# Changing the source file
test.write('foo.cpp', """\
#include <stdio.h>
@@ -82,16 +105,14 @@ int main (int argc, char *argv[])
""")
# Verify that "b" can be used as a synonym for the "build" command.
-scons.send("b foo\n")
+scons.send("b foo.obj\n")
-scons.send("build foo\n")
+scons.send("build foo.obj\n")
expect_stdout = r"""scons>>> .*foo\.cpp.*
-.*foo.*
scons>>> .*foo\.cpp.*
-.*foo.*
-scons>>> scons: `foo' is up to date.
-scons>>> scons: `foo' is up to date.
+scons>>> scons: `foo.obj' is up to date.
+scons>>> scons: `foo.obj' is up to date.
scons>>>\s*
"""