Add /TP to CXXFLAGS for msvc. Win32 portability fixes for tests.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 1 Aug 2003 10:45:03 +0000 (10:45 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 1 Aug 2003 10:45:03 +0000 (10:45 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@755 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/ActionTests.py
src/engine/SCons/Tool/msvc.py
test/QT.py
test/QTFLAGS.py
test/bad-drive.py
test/errors.py
test/sconsign-script.py

index f966b79c7bb95b99e47952f58580ad0cca3f1d28..babc0f34a7c79bb6327e88ec3bff11f4d83dfd28 100644 (file)
@@ -74,6 +74,9 @@ RELEASE 0.XX - XXX
 
   - 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
index 64b5f536c987045893e2b6d557162a1b70d2d805..be1435763acd722009c7203df4f6ad87148692b1 100644 (file)
@@ -63,13 +63,13 @@ except:
     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 ) 
@@ -537,28 +537,32 @@ class CommandActionTestCase(unittest.TestCase):
         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)
index 94d0c3e0539c9681b6f5544e9551fe949db6a3d6..fc86ee121a8cbde54c5ee5104a6e59f6a14c7941 100644 (file)
@@ -382,7 +382,7 @@ def generate(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'
index ec64d35f382e8cd5649a9b9c0f5c26194baf0ca5..0ee8a30fbe324fd72c33828a482f25911a24d98c 100644 (file)
@@ -125,10 +125,10 @@ QT_UIC = '%s %s' % (python, test.workpath('qt','bin','myuic.py'))
 
 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):
index c61fb9ce10df6b1fba507feb74a2ccdf6487aa3f..7964d4437ab2580a4ecc59066ca3849bd0c256e0 100644 (file)
@@ -127,10 +127,10 @@ QT_UIC = '%s %s' % (python, test.workpath('qt','bin','myuic.py'))
 
 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):
index 56f2127fd2cce9b137e83bb57b54c40eaa4e773d..d7a820f332845f9f9111deb418b1cdff30e56a55 100644 (file)
@@ -86,7 +86,7 @@ test.run(arguments = 'aaa.out')
 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',
index 420eb5ee758088c354e9f5fb0eabe5b1bce593d1..d87b41abc193676f7bab945df1d26330c32ab176 100644 (file)
@@ -94,7 +94,7 @@ a == 1
 """)
 
 test.run(status = 2, stderr = """\
-NameError: a:
+NameError: [^\n]*
   File "SConstruct", line 1:
     a == 1
 """)
index 1966c2791964132a27a6e160cd118991b31805d0..eac6ab3247c4310383f23913beedab0ea1641d0c 100644 (file)
@@ -30,6 +30,23 @@ import string
 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')
@@ -74,7 +91,7 @@ test.write(['sub2', 'inc2.h'], r"""\
 test.run(arguments = '--implicit-cache .')
 
 test.run(interpreter = TestSCons.python,
-         program = "sconsign",
+         program = sconsign,
          arguments = "sub1/.sconsign",
          stdout = """\
 hello.exe: None \S+ None
@@ -82,7 +99,7 @@ hello.obj: None \S+ None
 """)
 
 test.run(interpreter = TestSCons.python,
-         program = "sconsign",
+         program = sconsign,
          arguments = "-v sub1/.sconsign",
          stdout = """\
 hello.exe:
@@ -96,7 +113,7 @@ hello.obj:
 """)
 
 test.run(interpreter = TestSCons.python,
-         program = "sconsign",
+         program = sconsign,
          arguments = "-b -v sub1/.sconsign",
          stdout = """\
 hello.exe:
@@ -106,7 +123,7 @@ hello.obj:
 """)
 
 test.run(interpreter = TestSCons.python,
-         program = "sconsign",
+         program = sconsign,
          arguments = "-c -v sub1/.sconsign",
          stdout = """\
 hello.exe:
@@ -116,14 +133,14 @@ hello.obj:
 """)
 
 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
@@ -132,7 +149,7 @@ hello.obj: None \S+ None
 """)
 
 test.run(interpreter = TestSCons.python,
-         program = "sconsign",
+         program = sconsign,
          arguments = "sub2/.sconsign",
          stdout = """\
 hello.exe: None \S+ None
@@ -143,7 +160,7 @@ hello.obj: 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:
@@ -155,7 +172,7 @@ hello.obj:
        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
@@ -182,21 +199,23 @@ time.sleep(1)
 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()