- Remove the internal (and superfluous) SCons.Util.argmunge() function.
+ - Add /TP to the default CXXFLAGS for msvc, so it can compile all
+ of the suffixes we use as C++ files.
+
From Gary Oberbrunner:
- Report the target being built in error messages when building
pass
f.close()
if os.environ.has_key( 'ACTPY_PIPE' ):
- if os.environ.has_key( 'PIPE_STDOUT_MSG' ):
- stdout_msg = os.environ['PIPE_STDOUT_MSG']
+ if os.environ.has_key( 'PIPE_STDOUT_FILE' ):
+ stdout_msg = open(os.environ['PIPE_STDOUT_FILE'], 'r').read()
else:
stdout_msg = "act.py: stdout: executed act.py\\n"
sys.stdout.write( stdout_msg )
- if os.environ.has_key( 'PIPE_STDERR_MSG' ):
- stderr_msg = os.environ['PIPE_STDERR_MSG']
+ if os.environ.has_key( 'PIPE_STDERR_FILE' ):
+ stderr_msg = open(os.environ['PIPE_STDERR_FILE'], 'r').read()
else:
stderr_msg = "act.py: stderr: executed act.py\\n"
sys.stderr.write( stderr_msg )
self.env['PSTDOUT'].close()
pipe_out = test.read( pipe_file )
- if sys.platform == 'win32':
- cr = '\r'
- else:
- cr = ''
- act_out = "act.py: stdout: executed act.py\n"
- act_err = "act.py: stderr: executed act.py\n"
+ act_out = "act.py: stdout: executed act.py"
+ act_err = "act.py: stderr: executed act.py"
# Since we are now using select(), stdout and stderr can be
# intermixed, so count the lines separately.
- outlines = re.findall(act_out + cr, pipe_out)
- errlines = re.findall(act_err + cr, pipe_out)
+ outlines = re.findall(act_out, pipe_out)
+ errlines = re.findall(act_err, pipe_out)
assert len(outlines) == 8, outlines
assert len(errlines) == 8, errlines
# test redirection operators
def test_redirect(self, redir, stdout_msg, stderr_msg):
cmd = r'%s %s %s xyzzy %s' % (python, act_py, outfile, redir)
+ # Write the output and error messages to files because Win32
+ # can't handle strings that are too big in its external
+ # environment (os.spawnve() returns EINVAL, "Invalid
+ # argument").
+ stdout_file = test.workpath('stdout_msg')
+ stderr_file = test.workpath('stderr_msg')
+ open(stdout_file, 'w').write(stdout_msg)
+ open(stderr_file, 'w').write(stderr_msg)
pipe = open( pipe_file, "w" )
act = SCons.Action.CommandAction(cmd)
env = Environment( ENV = {'ACTPY_PIPE' : '1',
- 'PIPE_STDOUT_MSG' : stdout_msg,
- 'PIPE_STDERR_MSG' : stderr_msg},
+ 'PIPE_STDOUT_FILE' : stdout_file,
+ 'PIPE_STDERR_FILE' : stderr_file},
PIPE_BUILD = 1,
PSTDOUT = pipe, PSTDERR = pipe )
r = act([], [], env)
env['SHCCFLAGS'] = '$CCFLAGS'
env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS'
env['CXX'] = '$CC'
- env['CXXFLAGS'] = '$CCFLAGS'
+ env['CXXFLAGS'] = '$CCFLAGS $( /TP $)'
env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS'
env['SHCXX'] = '$CXX'
env['SHCXXFLAGS'] = '$CXXFLAGS'
def createSConstruct(test,place):
test.write(place, """
-env = Environment(QTDIR='%s',
- QT_LIB='%s',
- QT_MOC = '%s',
- QT_UIC = '%s',
+env = Environment(QTDIR = r'%s',
+ QT_LIB = r'%s',
+ QT_MOC = r'%s',
+ QT_UIC = r'%s',
tools=['default','qt'])
if ARGUMENTS.get('build_dir', 0):
if ARGUMENTS.get('chdir', 0):
def createSConstruct(test,place,overrides):
test.write(place, """
-env = Environment(QTDIR='%s',
- QT_LIB='%s',
- QT_MOC = '%s',
- QT_UIC = '%s',
+env = Environment(QTDIR = r'%s',
+ QT_LIB = r'%s',
+ QT_MOC = r'%s',
+ QT_UIC = r'%s',
%s
tools=['default','qt'])
if ARGUMENTS.get('build_dir', 0):
test.fail_test(test.read('aaa.out') != "aaa.in\n")
test.run(arguments = bad_drive + 'not_mentioned',
- stderr = "scons: *** Do not know how to make target `%snot_mentioned'. Stop.\n" % bad_drive,
+ stderr = "scons: *** No drive `%s' for target `%snot_mentioned'. Stop.\n" % (bad_drive, bad_drive),
status = 2)
test.run(arguments = bad_drive + 'no_target_1',
""")
test.run(status = 2, stderr = """\
-NameError: a:
+NameError: [^\n]*
File "SConstruct", line 1:
a == 1
""")
import TestCmd
import TestSCons
+# Check for the sconsign script before we instantiate TestSCons(),
+# because that will change directory on us.
+if os.path.exists('sconsign.py'):
+ sconsign = 'sconsign.py'
+elif os.path.exists('sconsign'):
+ sconsign = 'sconsign'
+else:
+ print "Can find neither 'sconsign.py' nor 'sconsign' scripts."
+ test.no_result(1)
+
+def sort_match(test, lines, expect):
+ lines = string.split(lines, '\n')
+ lines.sort()
+ expect = string.split(expect, '\n')
+ expect.sort()
+ return test.match_re(lines, expect)
+
test = TestSCons.TestSCons(match = TestCmd.match_re)
test.subdir('sub1', 'sub2')
test.run(arguments = '--implicit-cache .')
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "sub1/.sconsign",
stdout = """\
hello.exe: None \S+ None
""")
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-v sub1/.sconsign",
stdout = """\
hello.exe:
""")
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-b -v sub1/.sconsign",
stdout = """\
hello.exe:
""")
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-c -v sub1/.sconsign",
stdout = """\
hello.exe:
""")
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-e hello.obj sub1/.sconsign",
stdout = """\
hello.obj: None \S+ None
""")
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-e hello.obj -e hello.exe -e hello.obj sub1/.sconsign",
stdout = """\
hello.obj: None \S+ None
""")
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "sub2/.sconsign",
stdout = """\
hello.exe: None \S+ None
string.replace(os.path.join('sub2', 'inc2.h'), '\\', '\\\\')))
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-i -v sub2/.sconsign",
stdout = """\
hello.exe:
string.replace(os.path.join('sub2', 'inc2.h'), '\\', '\\\\')))
test.run(interpreter = TestSCons.python,
- program = "sconsign",
+ program = sconsign,
arguments = "-e hello.obj sub2/.sconsign sub1/.sconsign",
stdout = """\
hello.obj: None \S+ None
test.run(arguments = '. --max-drift=1')
test.run(interpreter = TestSCons.python,
- program = "sconsign",
- arguments = "sub1/.sconsign",
- stdout = """\
+ program = sconsign,
+ arguments = "sub1/.sconsign")
+
+test.fail_test(not sort_match(test, test.stdout(), """\
hello.exe: None \S+ None
hello.c: \d+ None \d+
hello.obj: None \S+ None
-""")
+"""))
test.run(interpreter = TestSCons.python,
- program = "sconsign",
- arguments = "-r sub1/.sconsign",
- stdout = """\
+ program = sconsign,
+ arguments = "-r sub1/.sconsign")
+
+test.fail_test(not sort_match(test, test.stdout(), """\
hello.exe: None \S+ None
-hello.c: '\S+ \S+ \d+ \d\d:\d\d:\d\d \d\d\d\d' None \d+
+hello.c: '\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' None \d+
hello.obj: None \S+ None
-""")
+"""))
test.pass_test()