Commits

Anonymous committed 27d7402

Windows portability fixes in various tests. Fix runtest.py detection
of non-zero exit status on systems that don't have os.WEXITSTATUS().

  • Participants
  • Parent commits 6507acb

Comments (0)

Files changed (6)

         sys.stdout.flush()
     status = 0
     if execute_tests:
-        status = os.WEXITSTATUS(os.system(cmd))
+        status = os.system(cmd)
+        try:
+            wexitstatus = os.WEXITSTATUS
+        except AttributeError:
+            pass
+        else:
+            status = wexitstatus(status)
     sys.exit(status)
 
 #try:

test/Builder/multi/same-overrides.py

 expect = ("""
 scons: warning: Two different environments were specified for target file4.out,
 \tbut they appear to have the same action: %s build.py .foo .TARGET .SOURCES
-""" % _python_) + TestSCons.file_expr
+""" % TestSCons.re_escape(_python_)) + TestSCons.file_expr
 
 test.run(arguments='file4.out', stderr=expect)
 

test/VariantDir/reflect.py

 test = TestSCons.TestSCons()
 
 _python_ = TestSCons._python_
-re_python = re.escape(TestSCons.python)
+re_python = re.escape(TestSCons._python_)
 
 test.write("mycc.py", """
 print 'Compile'

test/explain/basic.py

                 argument = None,
                 skeys = ['.k'])
 
-cat = Builder(action = [[r'%(_python_)s', r'%(cat_py)s', '$TARGET', '$SOURCES']])
-one_cat = Builder( action = [[r'%(_python_)s', r'%(cat_py)s', '$TARGET', '${SOURCES[0]}']])
+cat = Builder(action = [[r'%(python)s', r'%(cat_py)s', '$TARGET', '$SOURCES']])
+one_cat = Builder( action = [[r'%(python)s', r'%(cat_py)s', '$TARGET', '${SOURCES[0]}']])
 
 env = Environment()
 env.Append(BUILDERS = {'Cat':cat, 'OneCat':one_cat},
 
 expect = test.wrap_stdout("""\
 scons: rebuilding `file3' because the build action changed:
-               old: %(_python_)s %(cat_py)s $TARGET $SOURCES
+               old: %(python)s %(cat_py)s $TARGET $SOURCES
                new: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES
-                    %(_python_)s %(cat_py)s $TARGET $SOURCES
+                    %(python)s %(cat_py)s $TARGET $SOURCES
                     %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy
 %(_python_)s %(cat_py)s file3.alt zzz yyy xxx
 %(_python_)s %(cat_py)s file3 zzz yyy xxx
 expect = test.wrap_stdout("""\
 scons: rebuilding `file3' because the build action changed:
                old: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES
-                    %(_python_)s %(cat_py)s $TARGET $SOURCES
+                    %(python)s %(cat_py)s $TARGET $SOURCES
                     %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy
                new: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES
-                    %(_python_)s %(cat_py)s $TARGET $SOURCES
+                    %(python)s %(cat_py)s $TARGET $SOURCES
                     %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES xxx
 %(_python_)s %(cat_py)s file3.alt zzz yyy xxx
 %(_python_)s %(cat_py)s file3 zzz yyy xxx

test/runtest/qmtest.py

 """
 
 import os.path
+import sys
+
+if sys.platform == 'win32':
+    qmtest_py = 'qmtest.py'
+else:
+    qmtest_py = 'qmtest'
 
 import TestRuntest
 
 # NOTE:  the FAIL and PASS lines below have trailing spaces.
 
 expect_stdout = """\
-qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/fail.py test/no_result.py test/pass.py
+%(qmtest_py)s run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" %(test_fail_py)s %(test_no_result_py)s %(test_pass_py)s
 --- TEST RESULTS -------------------------------------------------------------
 
-  test/fail.py                                  : FAIL    
+  %(test_fail_py)s                                  : FAIL    
 
     FAILING TEST STDOUT
 
     FAILING TEST STDERR
 
-  test/no_result.py                             : NO_RESULT
+  %(test_no_result_py)s                             : NO_RESULT
 
     NO RESULT TEST STDOUT
 
     NO RESULT TEST STDERR
 
-  test/pass.py                                  : PASS    
+  %(test_pass_py)s                                  : PASS    
 
 --- TESTS THAT DID NOT PASS --------------------------------------------------
 
-  test/fail.py                                  : FAIL    
+  %(test_fail_py)s                                  : FAIL    
 
-  test/no_result.py                             : NO_RESULT
+  %(test_no_result_py)s                             : NO_RESULT
 
 
 --- STATISTICS ---------------------------------------------------------------
 
        3        tests total
 
-       1 ( 33%) tests PASS
-       1 ( 33%) tests FAIL
-       1 ( 33%) tests NO_RESULT
-"""
+       1 ( 33%%) tests PASS
+       1 ( 33%%) tests FAIL
+       1 ( 33%%) tests NO_RESULT
+""" % locals()
 
 testlist = [
     test_fail_py,

test/runtest/xml/output.py

 import TestCmd
 import TestRuntest
 
-test = TestRuntest.TestRuntest(match = TestCmd.match_re)
+test = TestRuntest.TestRuntest(match = TestCmd.match_re,
+                               diff = TestCmd.diff_re)
 
 pythonstring = re.escape(TestRuntest.pythonstring)
 test_fail_py = re.escape(os.path.join('test', 'fail.py'))
   </results>
 """ % locals()
 
+# Just strip carriage returns so the regular expression matching works.
+contents = test.read('xml.out')
+contents = contents.replace('\r', '')
+test.write('xml.out', contents)
+
 test.must_match('xml.out', expect)
 
 test.pass_test()