Win32 portability in runtest.py tests after disabling QMTest by default.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 26 Jan 2010 16:26:26 +0000 (16:26 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 26 Jan 2010 16:26:26 +0000 (16:26 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4650 fdb21ef1-2011-0410-befe-b5e4ea1792b1

17 files changed:
QMTest/TestRuntest.py
test/runtest/aegis/batch-output.py
test/runtest/baseline/combined.py
test/runtest/baseline/fail.py
test/runtest/baseline/no_result.py
test/runtest/baseline/pass.py
test/runtest/fallback.py
test/runtest/noqmtest.py
test/runtest/print_time.py
test/runtest/python.py
test/runtest/simple/combined.py
test/runtest/simple/fail.py
test/runtest/simple/no_result.py
test/runtest/simple/pass.py
test/runtest/src.py
test/runtest/testlistfile.py
test/runtest/xml/output.py

index 08cfb4f58e6cb35d16e4679df0f4270c324732a3..679a6aba4068456cb4d90a2cee61032b2c7841db 100644 (file)
@@ -18,6 +18,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import os
 import os.path
 
 import os
 import os.path
+import re
 import string
 import shutil
 import sys
 import string
 import shutil
 import sys
@@ -27,12 +28,19 @@ from TestCommon import __all__
 
 __all__.extend([ 'TestRuntest',
                  'python',
 
 __all__.extend([ 'TestRuntest',
                  'python',
+                 'pythonstring',
                  '_python_',
                ])
 
 python = python_executable
 _python_ = '"' + python_executable + '"'
 
                  '_python_',
                ])
 
 python = python_executable
 _python_ = '"' + python_executable + '"'
 
+if re.search('\s', python):
+    pythonstring = _python_
+else:
+    pythonstring = python
+pythonstring = string.replace(pythonstring, '\\', '\\\\')
+
 
 failing_test_template = """\
 import sys
 
 failing_test_template = """\
 import sys
index e2f00ee74ea140e4c0001f152e144a3688261630..68bd166de4a71d183a397a97da88f8affc436dab 100644 (file)
@@ -28,8 +28,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 Test writing Aegis batch output to a file.
 """
 
 Test writing Aegis batch output to a file.
 """
 
+import os
+
 import TestRuntest
 
 import TestRuntest
 
+test_fail_py = os.path.join('test', 'fail.py')
+test_no_result_py = os.path.join('test', 'no_result.py')
+test_pass_py = os.path.join('test', 'pass.py')
+
 test = TestRuntest.TestRuntest()
 
 test.subdir('test')
 test = TestRuntest.TestRuntest()
 
 test.subdir('test')
@@ -50,14 +56,14 @@ test.run(arguments = '-o aegis.out --aegis test', stderr=expect_stderr)
 
 expect = """\
 test_result = [
 
 expect = """\
 test_result = [
-    { file_name = "test/fail.py";
+    { file_name = "%(test_fail_py)s";
       exit_status = 1; },
       exit_status = 1; },
-    { file_name = "test/no_result.py";
+    { file_name = "%(test_no_result_py)s";
       exit_status = 2; },
       exit_status = 2; },
-    { file_name = "test/pass.py";
+    { file_name = "%(test_pass_py)s";
       exit_status = 0; },
 ];
       exit_status = 0; },
 ];
-"""
+""" % locals()
 
 # The mode is 'r' (not default 'rb') because QMTest opens the file
 # description on which we write as non-binary.
 
 # The mode is 'r' (not default 'rb') because QMTest opens the file
 # description on which we write as non-binary.
index 02f3f53e42584ccf76d094a1dcbedc4bb44d5bf4..119fc63673253a3d8285ffe1e8f913b6f1f0d8e8 100644 (file)
@@ -1,4 +1,3 @@
-
 #!/usr/bin/env python
 #
 # __COPYRIGHT__
 #!/usr/bin/env python
 #
 # __COPYRIGHT__
@@ -30,11 +29,11 @@ Test a combination of a passing test, failing test, and no-result
 test with no argument on the command line.
 """
 
 test with no argument on the command line.
 """
 
-import os.path
+import os
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 test_fail_py = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py = os.path.join('test', 'pass.py')
 test_fail_py = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py = os.path.join('test', 'pass.py')
@@ -50,18 +49,18 @@ test.write_no_result_test(['test', 'no_result.py'])
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
-%(python)s -tt test/fail.py
+%(pythonstring)s -tt %(test_fail_py)s
 FAILING TEST STDOUT
 FAILING TEST STDOUT
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt %(test_no_result_py)s
 NO RESULT TEST STDOUT
 NO RESULT TEST STDOUT
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 
 Failed the following test:
 PASSING TEST STDOUT
 
 Failed the following test:
-\ttest/fail.py
+\t%(test_fail_py)s
 
 NO RESULT from the following test:
 
 NO RESULT from the following test:
-\ttest/no_result.py
+\t%(test_no_result_py)s
 """ % locals()
 
 expect_stderr = """\
 """ % locals()
 
 expect_stderr = """\
index fb7265e59b5b6d099a473874203c38481d5beb9b..baa974a3453dc44e5f262c4d8a7e0cdee043ed6b 100644 (file)
@@ -30,7 +30,7 @@ Test how we handle a failing test specified on the command line.
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest()
 
 
 test = TestRuntest.TestRuntest()
 
@@ -39,7 +39,7 @@ test.subdir('test')
 test.write_failing_test(['test', 'fail.py'])
 
 expect_stdout = """\
 test.write_failing_test(['test', 'fail.py'])
 
 expect_stdout = """\
-%(python)s -tt test/fail.py
+%(pythonstring)s -tt test/fail.py
 FAILING TEST STDOUT
 """ % locals()
 
 FAILING TEST STDOUT
 """ % locals()
 
index 8641c907a86c2da7a561c8d06f5f8d26dba1504a..8e0d0ddb935d8b596bb2e840ba30094ddfe9bcf2 100644 (file)
@@ -30,7 +30,7 @@ Test how we handle a no-results test specified on the command line.
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest()
 
 
 test = TestRuntest.TestRuntest()
 
@@ -39,7 +39,7 @@ test.subdir('test')
 test.write_no_result_test(['test', 'no_result.py'])
 
 expect_stdout = """\
 test.write_no_result_test(['test', 'no_result.py'])
 
 expect_stdout = """\
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt test/no_result.py
 NO RESULT TEST STDOUT
 """ % locals()
 
 NO RESULT TEST STDOUT
 """ % locals()
 
index ef3a99e1a017f833ea6deb06ccf910643acd82f7..77cd84d9cf773998d2754384f479a93d13ca6800 100644 (file)
@@ -28,9 +28,12 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 Test how we handle a passing test specified on the command line.
 """
 
 Test how we handle a passing test specified on the command line.
 """
 
+import os
+
 import TestRuntest
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
+test_pass_py = os.path.join('test', 'pass.py')
 
 test = TestRuntest.TestRuntest()
 
 
 test = TestRuntest.TestRuntest()
 
@@ -39,7 +42,7 @@ test.subdir('test')
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 """ % locals()
 
 PASSING TEST STDOUT
 """ % locals()
 
index c7354a313e3eb100d3c0b5768678546584f2eb84..6a971f8e52a1a4b6d2cdd679d20bf1e87ee29a50 100644 (file)
@@ -30,13 +30,11 @@ if it can't find qmtest on the $PATH.
 """
 
 import os
 """
 
 import os
-import re
 import string
 
 import TestRuntest
 
 import string
 
 import TestRuntest
 
-python = TestRuntest.python
-_python_ = TestRuntest._python_
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest(noqmtest=1)
 
 
 test = TestRuntest.TestRuntest(noqmtest=1)
 
@@ -54,33 +52,16 @@ test_fail_py      = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py      = os.path.join('test', 'pass.py')
 
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py      = os.path.join('test', 'pass.py')
 
-workpath_fail_py      = test.workpath(test_fail_py)
-workpath_no_result_py = test.workpath(test_no_result_py)
-workpath_pass_py      = test.workpath(test_pass_py)
-
 test.write_failing_test(test_fail_py)
 test.write_no_result_test(test_no_result_py)
 test.write_passing_test(test_pass_py)
 
 test.write_failing_test(test_fail_py)
 test.write_no_result_test(test_no_result_py)
 test.write_passing_test(test_pass_py)
 
-if re.search('\s', python):
-    expect_python = _python_
-else:
-    expect_python = python
-
-def escape(s):
-    return string.replace(s, '\\', '\\\\')
-
-expect_python                = escape(expect_python)
-expect_workpath_fail_py             = escape(test_fail_py)
-expect_workpath_no_result_py = escape(test_no_result_py)
-expect_workpath_pass_py      = escape(test_pass_py)
-
 expect_stdout = """\
 expect_stdout = """\
-%(expect_python)s -tt %(expect_workpath_fail_py)s
+%(pythonstring)s -tt %(test_fail_py)s
 FAILING TEST STDOUT
 FAILING TEST STDOUT
-%(expect_python)s -tt %(expect_workpath_no_result_py)s
+%(pythonstring)s -tt %(test_no_result_py)s
 NO RESULT TEST STDOUT
 NO RESULT TEST STDOUT
-%(expect_python)s -tt %(expect_workpath_pass_py)s
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 
 Failed the following test:
 PASSING TEST STDOUT
 
 Failed the following test:
index 2ff4f6579a054ceda5d06ef11bd8dd2470245e3b..78b021d9a045d86a73882484e881d1128eac92be 100644 (file)
@@ -29,14 +29,12 @@ Test that the --noqmtest option invokes tests directly via Python, not
 using qmtest.
 """
 
 using qmtest.
 """
 
-import os.path
-import re
+import os
 import string
 
 import TestRuntest
 
 import string
 
 import TestRuntest
 
-python = TestRuntest.python
-_python_ = TestRuntest._python_
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest(noqmtest=1)
 
 
 test = TestRuntest.TestRuntest(noqmtest=1)
 
@@ -46,33 +44,16 @@ test_fail_py      = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py      = os.path.join('test', 'pass.py')
 
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py      = os.path.join('test', 'pass.py')
 
-workpath_fail_py      = test.workpath(test_fail_py)
-workpath_no_result_py = test.workpath(test_no_result_py)
-workpath_pass_py      = test.workpath(test_pass_py)
-
 test.write_failing_test(test_fail_py)
 test.write_no_result_test(test_no_result_py)
 test.write_passing_test(test_pass_py)
 
 test.write_failing_test(test_fail_py)
 test.write_no_result_test(test_no_result_py)
 test.write_passing_test(test_pass_py)
 
-if re.search('\s', python):
-    expect_python = _python_
-else:
-    expect_python = python
-
-def escape(s):
-    return string.replace(s, '\\', '\\\\')
-
-expect_python                = escape(expect_python)
-expect_workpath_fail_py      = escape(test_fail_py)
-expect_workpath_no_result_py = escape(test_no_result_py)
-expect_workpath_pass_py      = escape(test_pass_py)
-
 expect_stdout = """\
 expect_stdout = """\
-%(expect_python)s -tt %(expect_workpath_fail_py)s
+%(pythonstring)s -tt %(test_fail_py)s
 FAILING TEST STDOUT
 FAILING TEST STDOUT
-%(expect_python)s -tt %(expect_workpath_no_result_py)s
+%(pythonstring)s -tt %(test_no_result_py)s
 NO RESULT TEST STDOUT
 NO RESULT TEST STDOUT
-%(expect_python)s -tt %(expect_workpath_pass_py)s
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 
 Failed the following test:
 PASSING TEST STDOUT
 
 Failed the following test:
index 54f90fe236ccd7ac02598a16497424fdd17676eb..e0684475f221b070e88a498d26b7fcdf004895e0 100644 (file)
@@ -29,13 +29,13 @@ Test a combination of a passing test, failing test, and no-result
 test with no argument on the command line.
 """
 
 test with no argument on the command line.
 """
 
-import os.path
+import os
 import re
 
 import TestCmd
 import TestRuntest
 
 import re
 
 import TestCmd
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = re.escape(TestRuntest.pythonstring)
 test_fail_py = re.escape(os.path.join('test', 'fail.py'))
 test_no_result_py = re.escape(os.path.join('test', 'no_result.py'))
 test_pass_py = re.escape(os.path.join('test', 'pass.py'))
 test_fail_py = re.escape(os.path.join('test', 'fail.py'))
 test_no_result_py = re.escape(os.path.join('test', 'no_result.py'))
 test_pass_py = re.escape(os.path.join('test', 'pass.py'))
@@ -51,22 +51,22 @@ test.write_no_result_test(['test', 'no_result.py'])
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
-%(python)s -tt test/fail.py
+%(pythonstring)s -tt %(test_fail_py)s
 FAILING TEST STDOUT
 Test execution time: \\d+.\\d seconds
 FAILING TEST STDOUT
 Test execution time: \\d+.\\d seconds
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt %(test_no_result_py)s
 NO RESULT TEST STDOUT
 Test execution time: \\d+.\\d seconds
 NO RESULT TEST STDOUT
 Test execution time: \\d+.\\d seconds
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 Test execution time: \\d+.\\d seconds
 Total execution time for all tests: \\d+.\\d seconds
 
 Failed the following test:
 PASSING TEST STDOUT
 Test execution time: \\d+.\\d seconds
 Total execution time for all tests: \\d+.\\d seconds
 
 Failed the following test:
-\ttest/fail.py
+\t%(test_fail_py)s
 
 NO RESULT from the following test:
 
 NO RESULT from the following test:
-\ttest/no_result.py
+\t%(test_no_result_py)s
 """ % locals()
 
 expect_stderr = """\
 """ % locals()
 
 expect_stderr = """\
index e798a53d89e5b9856cd8de3378dfe3d2d80913c8..9579746c8bc3fb0682493ec19983493549784bc2 100644 (file)
@@ -28,7 +28,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 Test that the -P option lets us specify a Python version to use.
 """
 
 Test that the -P option lets us specify a Python version to use.
 """
 
-import os.path
+import os
+import re
+import string
 
 if not hasattr(os.path, 'pardir'):
     os.path.pardir = '..'
 
 if not hasattr(os.path, 'pardir'):
     os.path.pardir = '..'
@@ -44,12 +46,20 @@ head, dir = os.path.split(head)
 
 mypython = os.path.join(head, dir, os.path.pardir, dir, python)
 
 
 mypython = os.path.join(head, dir, os.path.pardir, dir, python)
 
+def escape(s):
+    return string.replace(s, '\\', '\\\\')
+
+if re.search('\s', mypython):
+    mypythonstring = '"%s"' % escape(mypython)
+else:
+    mypythonstring = escape(mypython)
+
 test.subdir('test')
 
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
 test.subdir('test')
 
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
-%(mypython)s -tt test/pass.py
+%(mypythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 """ % locals()
 
 PASSING TEST STDOUT
 """ % locals()
 
index 6794ea5dcffb3135dda9f9b70de7213b29dddc8a..68178201ec008d36caa513d1233b815c8f469e4f 100644 (file)
@@ -30,13 +30,13 @@ Test a combination of a passing test, failing test, and no-result
 test with no argument on the command line.
 """
 
 test with no argument on the command line.
 """
 
-import os.path
+import os
 
 import TestRuntest
 
 test = TestRuntest.TestRuntest()
 
 
 import TestRuntest
 
 test = TestRuntest.TestRuntest()
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 test_fail_py = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py = os.path.join('test', 'pass.py')
 test_fail_py = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py = os.path.join('test', 'pass.py')
@@ -50,18 +50,18 @@ test.write_no_result_test(['test', 'no_result.py'])
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
-%(python)s -tt test/fail.py
+%(pythonstring)s -tt %(test_fail_py)s
 FAILING TEST STDOUT
 FAILING TEST STDOUT
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt %(test_no_result_py)s
 NO RESULT TEST STDOUT
 NO RESULT TEST STDOUT
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 
 Failed the following test:
 PASSING TEST STDOUT
 
 Failed the following test:
-\ttest/fail.py
+\t%(test_fail_py)s
 
 NO RESULT from the following test:
 
 NO RESULT from the following test:
-\ttest/no_result.py
+\t%(test_no_result_py)s
 """ % locals()
 
 expect_stderr = """\
 """ % locals()
 
 expect_stderr = """\
index 4a36c47282cbc3d0797cbc0f09abf7a0e6d05b1a..36ec0d0192d4db534f3def3af7f9a93342c4e7ad 100644 (file)
@@ -30,7 +30,7 @@ Test how we handle a failing test specified on the command line.
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest()
 
 
 test = TestRuntest.TestRuntest()
 
@@ -39,7 +39,7 @@ test.subdir('test')
 test.write_failing_test(['test', 'fail.py'])
 
 expect_stdout = """\
 test.write_failing_test(['test', 'fail.py'])
 
 expect_stdout = """\
-%(python)s -tt test/fail.py
+%(pythonstring)s -tt test/fail.py
 FAILING TEST STDOUT
 """ % locals()
 
 FAILING TEST STDOUT
 """ % locals()
 
index 475c5a8a61eb1e0876b7e88678e8c3b7afc87a4e..97dcede541e77509a24dc8b824a4f55dd94ac335 100644 (file)
@@ -30,7 +30,7 @@ Test how we handle a no-results test specified on the command line.
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest()
 
 
 test = TestRuntest.TestRuntest()
 
@@ -39,7 +39,7 @@ test.subdir('test')
 test.write_no_result_test(['test', 'no_result.py'])
 
 expect_stdout = """\
 test.write_no_result_test(['test', 'no_result.py'])
 
 expect_stdout = """\
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt test/no_result.py
 NO RESULT TEST STDOUT
 """ % locals()
 
 NO RESULT TEST STDOUT
 """ % locals()
 
index 873be09ff36e33b6d34386dd997500cc909f9fd5..6332e5fc431885258da1ea425dd948fe01c4eebf 100644 (file)
@@ -30,7 +30,7 @@ Test how we handle a passing test specified on the command line.
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 
 test = TestRuntest.TestRuntest()
 
 
 test = TestRuntest.TestRuntest()
 
@@ -39,7 +39,7 @@ test.subdir('test')
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
 test.write_passing_test(['test', 'pass.py'])
 
 expect_stdout = """\
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt test/pass.py
 PASSING TEST STDOUT
 """ % locals()
 
 PASSING TEST STDOUT
 """ % locals()
 
index 18db972a75660e0bb8cfc482bfc4aa3ae1533559..9136a4d7d07ed6626c597c0072cae429528ccbcc 100644 (file)
@@ -29,7 +29,7 @@ Verify that we find tests under the src/ tree only if they end
 with *Tests.py.
 """
 
 with *Tests.py.
 """
 
-import os.path
+import os
 
 import TestRuntest
 
 
 import TestRuntest
 
@@ -38,7 +38,7 @@ test = TestRuntest.TestRuntest()
 test.subdir(['src'],
             ['src', 'suite'])
 
 test.subdir(['src'],
             ['src', 'suite'])
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 src_passTests_py = os.path.join('src', 'passTests.py')
 src_suite_passTests_py = os.path.join('src', 'suite', 'passTests.py')
 
 src_passTests_py = os.path.join('src', 'passTests.py')
 src_suite_passTests_py = os.path.join('src', 'suite', 'passTests.py')
 
@@ -51,9 +51,9 @@ test.write_passing_test(['src', 'suite', 'pass.py'])
 test.write_passing_test(['src', 'suite', 'passTests.py'])
 
 expect_stdout = """\
 test.write_passing_test(['src', 'suite', 'passTests.py'])
 
 expect_stdout = """\
-%(python)s -tt src/passTests.py
+%(pythonstring)s -tt %(src_passTests_py)s
 PASSING TEST STDOUT
 PASSING TEST STDOUT
-%(python)s -tt src/suite/passTests.py
+%(pythonstring)s -tt %(src_suite_passTests_py)s
 PASSING TEST STDOUT
 """ % locals()
 
 PASSING TEST STDOUT
 """ % locals()
 
index dc78c296993f3a3cdca5a55fa2611a30443f5490..8836c8e4bb218f19a34ae014b1e5d02f5aa9af53 100644 (file)
@@ -29,10 +29,11 @@ Test a list of tests to run in a file specified with the -f option.
 """
 
 import os.path
 """
 
 import os.path
+import re
 
 import TestRuntest
 
 
 import TestRuntest
 
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
 test_fail_py = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py = os.path.join('test', 'pass.py')
 test_fail_py = os.path.join('test', 'fail.py')
 test_no_result_py = os.path.join('test', 'no_result.py')
 test_pass_py = os.path.join('test', 'pass.py')
@@ -53,7 +54,7 @@ test.write('t.txt', """\
 """ % locals())
 
 expect_stdout = """\
 """ % locals())
 
 expect_stdout = """\
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
 PASSING TEST STDOUT
 """ % locals()
 
 PASSING TEST STDOUT
 """ % locals()
 
index 3641d22fdc421b9ff4eb89a322504ebdb82c357d..c024f37bf0b632e94dcccfe1cb26d496b1ba2bfd 100644 (file)
@@ -28,28 +28,20 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 Test writing XML output to a file.
 """
 
 Test writing XML output to a file.
 """
 
-import os.path
+import os
 import re
 import re
-import sys
+import string
 
 import TestCmd
 import TestRuntest
 
 test = TestRuntest.TestRuntest(match = TestCmd.match_re)
 
 
 import TestCmd
 import TestRuntest
 
 test = TestRuntest.TestRuntest(match = TestCmd.match_re)
 
-python = TestRuntest.python
+pythonstring = re.escape(TestRuntest.pythonstring)
 test_fail_py = re.escape(os.path.join('test', 'fail.py'))
 test_no_result_py = re.escape(os.path.join('test', 'no_result.py'))
 test_pass_py = re.escape(os.path.join('test', 'pass.py'))
 
 test_fail_py = re.escape(os.path.join('test', 'fail.py'))
 test_no_result_py = re.escape(os.path.join('test', 'no_result.py'))
 test_pass_py = re.escape(os.path.join('test', 'pass.py'))
 
-# sys.stdout and sys.stderr are open non-binary ('w' instead of 'wb')
-# so the lines written on Windows are terminated \r\n, not just \n.  The
-# expressions below use 'cr' as the optional carriage return character.
-if sys.platform in ['win32']:
-    cr = '\r'
-else:
-    cr = ''
-
 test.subdir('test')
 
 test.write_fake_scons_source_tree()
 test.subdir('test')
 
 test.write_fake_scons_source_tree()
@@ -65,8 +57,8 @@ test.run(arguments = '-o xml.out --xml test', status=1)
 expect = """\
   <results>
     <test>
 expect = """\
   <results>
     <test>
-      <file_name>test/fail.py</file_name>
-      <command_line>%(python)s -tt test/fail.py</command_line>
+      <file_name>%(test_fail_py)s</file_name>
+      <command_line>%(pythonstring)s -tt %(test_fail_py)s</command_line>
       <exit_status>1</exit_status>
       <stdout>FAILING TEST STDOUT
 </stdout>
       <exit_status>1</exit_status>
       <stdout>FAILING TEST STDOUT
 </stdout>
@@ -75,8 +67,8 @@ expect = """\
       <time>\\d+\.\d</time>
     </test>
     <test>
       <time>\\d+\.\d</time>
     </test>
     <test>
-      <file_name>test/no_result.py</file_name>
-      <command_line>%(python)s -tt test/no_result.py</command_line>
+      <file_name>%(test_no_result_py)s</file_name>
+      <command_line>%(pythonstring)s -tt %(test_no_result_py)s</command_line>
       <exit_status>2</exit_status>
       <stdout>NO RESULT TEST STDOUT
 </stdout>
       <exit_status>2</exit_status>
       <stdout>NO RESULT TEST STDOUT
 </stdout>
@@ -85,8 +77,8 @@ expect = """\
       <time>\\d+\.\d</time>
     </test>
     <test>
       <time>\\d+\.\d</time>
     </test>
     <test>
-      <file_name>test/pass.py</file_name>
-      <command_line>%(python)s -tt test/pass.py</command_line>
+      <file_name>%(test_pass_py)s</file_name>
+      <command_line>%(pythonstring)s -tt %(test_pass_py)s</command_line>
       <exit_status>0</exit_status>
       <stdout>PASSING TEST STDOUT
 </stdout>
       <exit_status>0</exit_status>
       <stdout>PASSING TEST STDOUT
 </stdout>