summaryrefslogtreecommitdiff
path: root/test/runtest/baseline
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2009-12-16 07:07:13 +0000
committerSteven Knight <knight@baldmt.com>2009-12-16 07:07:13 +0000
commit0bf3d84a5097f2fa365c979a539ddcd707d9bc8e (patch)
tree76a5d74c1ecb5a1a17d53d89712d0264b1bfa5de /test/runtest/baseline
parent892b6628410116a534d1a6d323726e8cd6b35b1c (diff)
downloadscons-0bf3d84a5097f2fa365c979a539ddcd707d9bc8e.tar.gz
Fix the tests of runtest.py now that QMTest is no longer being used
by default. Fix use of subprocess in Python 2.4+ and exit statuses of popen'ed scripts in earlier versions of Python. Support the ability to execute a directory's tests by naming the directory as a command- line argument.
Diffstat (limited to 'test/runtest/baseline')
-rw-r--r--test/runtest/baseline/combined.py53
-rw-r--r--test/runtest/baseline/fail.py31
-rw-r--r--test/runtest/baseline/no_result.py29
-rw-r--r--test/runtest/baseline/pass.py26
4 files changed, 57 insertions, 82 deletions
diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py
index bd479087..02f3f53e 100644
--- a/test/runtest/baseline/combined.py
+++ b/test/runtest/baseline/combined.py
@@ -34,6 +34,7 @@ import os.path
import TestRuntest
+python = TestRuntest.python
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')
@@ -48,41 +49,31 @@ test.write_no_result_test(['test', 'no_result.py'])
test.write_passing_test(['test', 'pass.py'])
-# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both
-# have spaces at the end.
+expect_stdout = """\
+%(python)s -tt test/fail.py
+FAILING TEST STDOUT
+%(python)s -tt test/no_result.py
+NO RESULT TEST STDOUT
+%(python)s -tt test/pass.py
+PASSING TEST STDOUT
-expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test
---- TEST RESULTS -------------------------------------------------------------
+Failed the following test:
+\ttest/fail.py
- %(test_fail_py)s : FAIL
-
- FAILING TEST STDOUT
-
- FAILING TEST STDERR
-
- %(test_no_result_py)s : NO_RESULT
-
- NO RESULT TEST STDOUT
-
- NO RESULT TEST STDERR
-
- %(test_pass_py)s : PASS
-
---- TESTS WITH UNEXPECTED OUTCOMES -------------------------------------------
-
- %(test_no_result_py)s : NO_RESULT
-
- %(test_pass_py)s : PASS
-
-
---- STATISTICS ---------------------------------------------------------------
-
- 1 ( 33%%) tests as expected
- 1 ( 33%%) tests unexpected PASS
- 1 ( 33%%) tests unexpected NO_RESULT
+NO RESULT from the following test:
+\ttest/no_result.py
""" % locals()
-test.run(arguments = '-b . test', status = 1, stdout = expect)
+expect_stderr = """\
+FAILING TEST STDERR
+NO RESULT TEST STDERR
+PASSING TEST STDERR
+"""
+
+test.run(arguments='-b . test',
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py
index bd52a182..fb7265e5 100644
--- a/test/runtest/baseline/fail.py
+++ b/test/runtest/baseline/fail.py
@@ -30,34 +30,27 @@ Test how we handle a failing test specified on the command line.
import TestRuntest
+python = TestRuntest.python
+
test = TestRuntest.TestRuntest()
test.subdir('test')
test.write_failing_test(['test', 'fail.py'])
-# NOTE: The "test/fail.py : FAIL" line has spaces at the end.
-
-expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/fail.py
---- TEST RESULTS -------------------------------------------------------------
-
- test/fail.py : FAIL
-
- FAILING TEST STDOUT
-
- FAILING TEST STDERR
-
---- TESTS WITH UNEXPECTED OUTCOMES -------------------------------------------
-
- None.
-
-
---- STATISTICS ---------------------------------------------------------------
+expect_stdout = """\
+%(python)s -tt test/fail.py
+FAILING TEST STDOUT
+""" % locals()
- 1 (100%) tests as expected
+expect_stderr = """\
+FAILING TEST STDERR
"""
-test.run(arguments = '-b . test/fail.py', status = 1, stdout = expect)
+test.run(arguments='-b . test/fail.py',
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py
index d1c0f759..8641c907 100644
--- a/test/runtest/baseline/no_result.py
+++ b/test/runtest/baseline/no_result.py
@@ -30,32 +30,27 @@ Test how we handle a no-results test specified on the command line.
import TestRuntest
+python = TestRuntest.python
+
test = TestRuntest.TestRuntest()
test.subdir('test')
test.write_no_result_test(['test', 'no_result.py'])
-expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/no_result.py
---- TEST RESULTS -------------------------------------------------------------
-
- test/no_result.py : NO_RESULT
-
- NO RESULT TEST STDOUT
-
- NO RESULT TEST STDERR
-
---- TESTS WITH UNEXPECTED OUTCOMES -------------------------------------------
-
- test/no_result.py : NO_RESULT
-
-
---- STATISTICS ---------------------------------------------------------------
+expect_stdout = """\
+%(python)s -tt test/no_result.py
+NO RESULT TEST STDOUT
+""" % locals()
- 1 (100%) tests unexpected NO_RESULT
+expect_stderr = """\
+NO RESULT TEST STDERR
"""
-test.run(arguments = '-b . test/no_result.py', status = 1, stdout = expect)
+test.run(arguments='-b . test/no_result.py',
+ status=2,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py
index 3644052b..ef3a99e1 100644
--- a/test/runtest/baseline/pass.py
+++ b/test/runtest/baseline/pass.py
@@ -30,30 +30,26 @@ Test how we handle a passing test specified on the command line.
import TestRuntest
+python = TestRuntest.python
+
test = TestRuntest.TestRuntest()
test.subdir('test')
test.write_passing_test(['test', 'pass.py'])
-# NOTE: The "test/pass.py : PASS" line has spaces at the end.
-
-expect = r"""qmtest run --output baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/pass.py
---- TEST RESULTS -------------------------------------------------------------
-
- test/pass.py : PASS
-
---- TESTS WITH UNEXPECTED OUTCOMES -------------------------------------------
-
- test/pass.py : PASS
-
-
---- STATISTICS ---------------------------------------------------------------
+expect_stdout = """\
+%(python)s -tt test/pass.py
+PASSING TEST STDOUT
+""" % locals()
- 1 (100%) tests unexpected PASS
+expect_stderr = """\
+PASSING TEST STDERR
"""
-test.run(arguments = '-b . test/pass.py', stdout = expect)
+test.run(arguments='-b . test',
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()