summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-06-06 00:48:58 (GMT)
committerSteven Knight <knight@baldmt.com>2010-06-06 00:48:58 (GMT)
commit5bf482c69d08f5ef89e9cb120ae89872b033b287 (patch)
treeac058390368dd11f3cdf8fb8b716eb2803b8dd6b /test
parent2fc4d8d28cfba093f9d14c4215cee301aa6602c7 (diff)
downloadSCons-5bf482c69d08f5ef89e9cb120ae89872b033b287.zip
SCons-5bf482c69d08f5ef89e9cb120ae89872b033b287.tar.gz
SCons-5bf482c69d08f5ef89e9cb120ae89872b033b287.tar.bz2
Windows portability fixes in various tests. Fix runtest.py detection
of non-zero exit status on systems that don't have os.WEXITSTATUS().
Diffstat (limited to 'test')
-rw-r--r--test/Builder/multi/same-overrides.py2
-rw-r--r--test/VariantDir/reflect.py2
-rw-r--r--test/explain/basic.py12
-rw-r--r--test/runtest/qmtest.py26
-rw-r--r--test/runtest/xml/output.py8
5 files changed, 31 insertions, 19 deletions
diff --git a/test/Builder/multi/same-overrides.py b/test/Builder/multi/same-overrides.py
index 3e1408f..33c4e7b 100644
--- a/test/Builder/multi/same-overrides.py
+++ b/test/Builder/multi/same-overrides.py
@@ -57,7 +57,7 @@ test.write('file4b.in', 'file4b.in\n')
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)
diff --git a/test/VariantDir/reflect.py b/test/VariantDir/reflect.py
index e7ff6db..ea5689a 100644
--- a/test/VariantDir/reflect.py
+++ b/test/VariantDir/reflect.py
@@ -41,7 +41,7 @@ import TestSCons
test = TestSCons.TestSCons()
_python_ = TestSCons._python_
-re_python = re.escape(TestSCons.python)
+re_python = re.escape(TestSCons._python_)
test.write("mycc.py", """
print 'Compile'
diff --git a/test/explain/basic.py b/test/explain/basic.py
index 7b3e512..bca8436 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -93,8 +93,8 @@ kscan = Scanner(name = 'kfile',
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},
@@ -341,9 +341,9 @@ env.AddPreAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES')
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
@@ -369,10 +369,10 @@ env.AddPreAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES')
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
diff --git a/test/runtest/qmtest.py b/test/runtest/qmtest.py
index de04c3f..6b9c5a2 100644
--- a/test/runtest/qmtest.py
+++ b/test/runtest/qmtest.py
@@ -30,6 +30,12 @@ not directly via Python.
"""
import os.path
+import sys
+
+if sys.platform == 'win32':
+ qmtest_py = 'qmtest.py'
+else:
+ qmtest_py = 'qmtest'
import TestRuntest
@@ -52,38 +58,38 @@ test.write_passing_test(test_pass_py)
# 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,
diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py
index 7bf6b2d..4702b7e 100644
--- a/test/runtest/xml/output.py
+++ b/test/runtest/xml/output.py
@@ -34,7 +34,8 @@ import re
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'))
@@ -89,6 +90,11 @@ expect = """\
</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()