summaryrefslogtreecommitdiffstats
path: root/test/runtest
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-01-26 16:26:26 (GMT)
committerSteven Knight <knight@baldmt.com>2010-01-26 16:26:26 (GMT)
commitf5a80d8cf4143edd7434805a568cc0e7eeaf81c0 (patch)
tree3608231e6b538a5222c7d501cbd9ce8d8ef08c76 /test/runtest
parentb21c0b3f84d0b064e9d2dd548e0b6d246a537afb (diff)
downloadSCons-f5a80d8cf4143edd7434805a568cc0e7eeaf81c0.zip
SCons-f5a80d8cf4143edd7434805a568cc0e7eeaf81c0.tar.gz
SCons-f5a80d8cf4143edd7434805a568cc0e7eeaf81c0.tar.bz2
Win32 portability in runtest.py tests after disabling QMTest by default.
Diffstat (limited to 'test/runtest')
-rw-r--r--test/runtest/aegis/batch-output.py14
-rw-r--r--test/runtest/baseline/combined.py15
-rw-r--r--test/runtest/baseline/fail.py4
-rw-r--r--test/runtest/baseline/no_result.py4
-rw-r--r--test/runtest/baseline/pass.py7
-rw-r--r--test/runtest/fallback.py27
-rw-r--r--test/runtest/noqmtest.py29
-rw-r--r--test/runtest/print_time.py14
-rw-r--r--test/runtest/python.py14
-rw-r--r--test/runtest/simple/combined.py14
-rw-r--r--test/runtest/simple/fail.py4
-rw-r--r--test/runtest/simple/no_result.py4
-rw-r--r--test/runtest/simple/pass.py4
-rw-r--r--test/runtest/src.py8
-rw-r--r--test/runtest/testlistfile.py5
-rw-r--r--test/runtest/xml/output.py26
16 files changed, 83 insertions, 110 deletions
diff --git a/test/runtest/aegis/batch-output.py b/test/runtest/aegis/batch-output.py
index e2f00ee..68bd166 100644
--- a/test/runtest/aegis/batch-output.py
+++ b/test/runtest/aegis/batch-output.py
@@ -28,8 +28,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test writing Aegis batch output to a file.
"""
+import os
+
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')
@@ -50,14 +56,14 @@ test.run(arguments = '-o aegis.out --aegis test', stderr=expect_stderr)
expect = """\
test_result = [
- { file_name = "test/fail.py";
+ { file_name = "%(test_fail_py)s";
exit_status = 1; },
- { file_name = "test/no_result.py";
+ { file_name = "%(test_no_result_py)s";
exit_status = 2; },
- { file_name = "test/pass.py";
+ { file_name = "%(test_pass_py)s";
exit_status = 0; },
];
-"""
+""" % locals()
# The mode is 'r' (not default 'rb') because QMTest opens the file
# description on which we write as non-binary.
diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py
index 02f3f53..119fc63 100644
--- a/test/runtest/baseline/combined.py
+++ b/test/runtest/baseline/combined.py
@@ -1,4 +1,3 @@
-
#!/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.
"""
-import os.path
+import os
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')
@@ -50,18 +49,18 @@ test.write_no_result_test(['test', 'no_result.py'])
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
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt %(test_no_result_py)s
NO RESULT TEST STDOUT
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
PASSING TEST STDOUT
Failed the following test:
-\ttest/fail.py
+\t%(test_fail_py)s
NO RESULT from the following test:
-\ttest/no_result.py
+\t%(test_no_result_py)s
""" % locals()
expect_stderr = """\
diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py
index fb7265e..baa974a 100644
--- a/test/runtest/baseline/fail.py
+++ b/test/runtest/baseline/fail.py
@@ -30,7 +30,7 @@ Test how we handle a failing test specified on the command line.
import TestRuntest
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
test = TestRuntest.TestRuntest()
@@ -39,7 +39,7 @@ test.subdir('test')
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()
diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py
index 8641c90..8e0d0dd 100644
--- a/test/runtest/baseline/no_result.py
+++ b/test/runtest/baseline/no_result.py
@@ -30,7 +30,7 @@ Test how we handle a no-results test specified on the command line.
import TestRuntest
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
test = TestRuntest.TestRuntest()
@@ -39,7 +39,7 @@ test.subdir('test')
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()
diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py
index ef3a99e..77cd84d 100644
--- a/test/runtest/baseline/pass.py
+++ b/test/runtest/baseline/pass.py
@@ -28,9 +28,12 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test how we handle a passing test specified on the command line.
"""
+import os
+
import TestRuntest
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
+test_pass_py = os.path.join('test', 'pass.py')
test = TestRuntest.TestRuntest()
@@ -39,7 +42,7 @@ test.subdir('test')
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()
diff --git a/test/runtest/fallback.py b/test/runtest/fallback.py
index c7354a3..6a971f8 100644
--- a/test/runtest/fallback.py
+++ b/test/runtest/fallback.py
@@ -30,13 +30,11 @@ if it can't find qmtest on the $PATH.
"""
import os
-import re
import string
import TestRuntest
-python = TestRuntest.python
-_python_ = TestRuntest._python_
+pythonstring = TestRuntest.pythonstring
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')
-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)
-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_python)s -tt %(expect_workpath_fail_py)s
+%(pythonstring)s -tt %(test_fail_py)s
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
-%(expect_python)s -tt %(expect_workpath_pass_py)s
+%(pythonstring)s -tt %(test_pass_py)s
PASSING TEST STDOUT
Failed the following test:
diff --git a/test/runtest/noqmtest.py b/test/runtest/noqmtest.py
index 2ff4f65..78b021d 100644
--- a/test/runtest/noqmtest.py
+++ b/test/runtest/noqmtest.py
@@ -29,14 +29,12 @@ Test that the --noqmtest option invokes tests directly via Python, not
using qmtest.
"""
-import os.path
-import re
+import os
import string
import TestRuntest
-python = TestRuntest.python
-_python_ = TestRuntest._python_
+pythonstring = TestRuntest.pythonstring
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')
-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)
-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_python)s -tt %(expect_workpath_fail_py)s
+%(pythonstring)s -tt %(test_fail_py)s
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
-%(expect_python)s -tt %(expect_workpath_pass_py)s
+%(pythonstring)s -tt %(test_pass_py)s
PASSING TEST STDOUT
Failed the following test:
diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py
index 54f90fe..e068447 100644
--- a/test/runtest/print_time.py
+++ b/test/runtest/print_time.py
@@ -29,13 +29,13 @@ Test a combination of a passing test, failing test, and no-result
test with no argument on the command line.
"""
-import os.path
+import os
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'))
@@ -51,22 +51,22 @@ test.write_no_result_test(['test', 'no_result.py'])
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
-%(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
-%(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:
-\ttest/fail.py
+\t%(test_fail_py)s
NO RESULT from the following test:
-\ttest/no_result.py
+\t%(test_no_result_py)s
""" % locals()
expect_stderr = """\
diff --git a/test/runtest/python.py b/test/runtest/python.py
index e798a53..9579746 100644
--- a/test/runtest/python.py
+++ b/test/runtest/python.py
@@ -28,7 +28,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
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 = '..'
@@ -44,12 +46,20 @@ head, dir = os.path.split(head)
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 = """\
-%(mypython)s -tt test/pass.py
+%(mypythonstring)s -tt %(test_pass_py)s
PASSING TEST STDOUT
""" % locals()
diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py
index 6794ea5..6817820 100644
--- a/test/runtest/simple/combined.py
+++ b/test/runtest/simple/combined.py
@@ -30,13 +30,13 @@ Test a combination of a passing test, failing test, and no-result
test with no argument on the command line.
"""
-import os.path
+import os
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')
@@ -50,18 +50,18 @@ test.write_no_result_test(['test', 'no_result.py'])
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
-%(python)s -tt test/no_result.py
+%(pythonstring)s -tt %(test_no_result_py)s
NO RESULT TEST STDOUT
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
PASSING TEST STDOUT
Failed the following test:
-\ttest/fail.py
+\t%(test_fail_py)s
NO RESULT from the following test:
-\ttest/no_result.py
+\t%(test_no_result_py)s
""" % locals()
expect_stderr = """\
diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py
index 4a36c47..36ec0d0 100644
--- a/test/runtest/simple/fail.py
+++ b/test/runtest/simple/fail.py
@@ -30,7 +30,7 @@ Test how we handle a failing test specified on the command line.
import TestRuntest
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
test = TestRuntest.TestRuntest()
@@ -39,7 +39,7 @@ test.subdir('test')
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()
diff --git a/test/runtest/simple/no_result.py b/test/runtest/simple/no_result.py
index 475c5a8..97dcede 100644
--- a/test/runtest/simple/no_result.py
+++ b/test/runtest/simple/no_result.py
@@ -30,7 +30,7 @@ Test how we handle a no-results test specified on the command line.
import TestRuntest
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
test = TestRuntest.TestRuntest()
@@ -39,7 +39,7 @@ test.subdir('test')
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()
diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py
index 873be09..6332e5f 100644
--- a/test/runtest/simple/pass.py
+++ b/test/runtest/simple/pass.py
@@ -30,7 +30,7 @@ Test how we handle a passing test specified on the command line.
import TestRuntest
-python = TestRuntest.python
+pythonstring = TestRuntest.pythonstring
test = TestRuntest.TestRuntest()
@@ -39,7 +39,7 @@ test.subdir('test')
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()
diff --git a/test/runtest/src.py b/test/runtest/src.py
index 18db972..9136a4d 100644
--- a/test/runtest/src.py
+++ b/test/runtest/src.py
@@ -29,7 +29,7 @@ Verify that we find tests under the src/ tree only if they end
with *Tests.py.
"""
-import os.path
+import os
import TestRuntest
@@ -38,7 +38,7 @@ test = TestRuntest.TestRuntest()
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')
@@ -51,9 +51,9 @@ test.write_passing_test(['src', 'suite', 'pass.py'])
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
-%(python)s -tt src/suite/passTests.py
+%(pythonstring)s -tt %(src_suite_passTests_py)s
PASSING TEST STDOUT
""" % locals()
diff --git a/test/runtest/testlistfile.py b/test/runtest/testlistfile.py
index dc78c29..8836c8e 100644
--- a/test/runtest/testlistfile.py
+++ b/test/runtest/testlistfile.py
@@ -29,10 +29,11 @@ Test a list of tests to run in a file specified with the -f option.
"""
import os.path
+import re
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')
@@ -53,7 +54,7 @@ test.write('t.txt', """\
""" % locals())
expect_stdout = """\
-%(python)s -tt test/pass.py
+%(pythonstring)s -tt %(test_pass_py)s
PASSING TEST STDOUT
""" % locals()
diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py
index 3641d22..c024f37 100644
--- a/test/runtest/xml/output.py
+++ b/test/runtest/xml/output.py
@@ -28,28 +28,20 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test writing XML output to a file.
"""
-import os.path
+import os
import re
-import sys
+import string
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'))
-# 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()
@@ -65,8 +57,8 @@ test.run(arguments = '-o xml.out --xml test', status=1)
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>
@@ -75,8 +67,8 @@ expect = """\
<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>
@@ -85,8 +77,8 @@ expect = """\
<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>