diff options
Diffstat (limited to 'utils/lit/tests')
29 files changed, 237 insertions, 23 deletions
diff --git a/utils/lit/tests/Inputs/discovery/lit.cfg b/utils/lit/tests/Inputs/discovery/lit.cfg index 4049ab1..c48ca0b 100644 --- a/utils/lit/tests/Inputs/discovery/lit.cfg +++ b/utils/lit/tests/Inputs/discovery/lit.cfg @@ -1,3 +1,4 @@ +import lit.formats config.name = 'top-level-suite' config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() @@ -8,3 +9,6 @@ config.test_format = lit.formats.ShTest() # #config.test_source_root = None #config.test_exec_root = None + +# Check that arbitrary config values are copied (tested by subdir/lit.local.cfg). +config.an_extra_variable = False diff --git a/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg b/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg index 5ae6b3c..631cb60 100644 --- a/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg +++ b/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg @@ -1 +1,4 @@ config.suffixes = ['.py'] + +# Check that the arbitrary config values in our parent was inherited. +assert hasattr(config, 'an_extra_variable') diff --git a/utils/lit/tests/Inputs/discovery/subsuite/lit.cfg b/utils/lit/tests/Inputs/discovery/subsuite/lit.cfg index 0c2979d..b49329a 100644 --- a/utils/lit/tests/Inputs/discovery/subsuite/lit.cfg +++ b/utils/lit/tests/Inputs/discovery/subsuite/lit.cfg @@ -1,3 +1,4 @@ +import lit.formats config.name = 'sub-suite' config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() diff --git a/utils/lit/tests/Inputs/exec-discovery-in-tree/lit.cfg b/utils/lit/tests/Inputs/exec-discovery-in-tree/lit.cfg index 342b2fd..ae25b4f 100644 --- a/utils/lit/tests/Inputs/exec-discovery-in-tree/lit.cfg +++ b/utils/lit/tests/Inputs/exec-discovery-in-tree/lit.cfg @@ -1,6 +1,8 @@ +import lit.formats + # Verify that the site configuration was loaded. if config.test_source_root is None or config.test_exec_root is None: - lit.fatal("No site specific configuration") + lit_config.fatal("No site specific configuration") config.name = 'exec-discovery-in-tree-suite' config.suffixes = ['.txt'] diff --git a/utils/lit/tests/Inputs/exec-discovery-in-tree/obj/lit.site.cfg b/utils/lit/tests/Inputs/exec-discovery-in-tree/obj/lit.site.cfg index de9a3d0..4061c89 100644 --- a/utils/lit/tests/Inputs/exec-discovery-in-tree/obj/lit.site.cfg +++ b/utils/lit/tests/Inputs/exec-discovery-in-tree/obj/lit.site.cfg @@ -1,4 +1,4 @@ import os config.test_exec_root = os.path.dirname(__file__) config.test_source_root = os.path.dirname(config.test_exec_root) -lit.load_config(config, os.path.join(config.test_source_root, "lit.cfg"))
\ No newline at end of file +lit_config.load_config(config, os.path.join(config.test_source_root, "lit.cfg"))
\ No newline at end of file diff --git a/utils/lit/tests/Inputs/exec-discovery/lit.site.cfg b/utils/lit/tests/Inputs/exec-discovery/lit.site.cfg index 796569a..ac273c7 100644 --- a/utils/lit/tests/Inputs/exec-discovery/lit.site.cfg +++ b/utils/lit/tests/Inputs/exec-discovery/lit.site.cfg @@ -2,4 +2,4 @@ import os config.test_exec_root = os.path.dirname(__file__) config.test_source_root = os.path.join(os.path.dirname(config.test_exec_root), "discovery") -lit.load_config(config, os.path.join(config.test_source_root, "lit.cfg")) +lit_config.load_config(config, os.path.join(config.test_source_root, "lit.cfg")) diff --git a/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest b/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest new file mode 100755 index 0000000..9dff137 --- /dev/null +++ b/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import sys + +if len(sys.argv) != 2: + raise ValueError("unexpected number of args") + +if sys.argv[1] == "--gtest_list_tests": + print("""\ +FirstTest. + subTestA + subTestB +ParameterizedTest/0. + subTest +ParameterizedTest/1. + subTest""") + sys.exit(0) +elif not sys.argv[1].startswith("--gtest_filter="): + raise ValueError("unexpected argument: %r" % (sys.argv[1])) + +test_name = sys.argv[1].split('=',1)[1] +if test_name == 'FirstTest.subTestA': + print('I am subTest A, I PASS') + sys.exit(0) +elif test_name == 'FirstTest.subTestB': + print('I am subTest B, I FAIL') + print('And I have two lines of output') + sys.exit(1) +elif test_name in ('ParameterizedTest/0.subTest', + 'ParameterizedTest/1.subTest'): + print('I am a parameterized test, I also PASS') + sys.exit(0) +else: + raise SystemExit("error: invalid test name: %r" % (test_name,)) diff --git a/utils/lit/tests/Inputs/googletest-format/lit.cfg b/utils/lit/tests/Inputs/googletest-format/lit.cfg new file mode 100644 index 0000000..f2f6cda --- /dev/null +++ b/utils/lit/tests/Inputs/googletest-format/lit.cfg @@ -0,0 +1,3 @@ +import lit.formats +config.name = 'googletest-format' +config.test_format = lit.formats.GoogleTest('DummySubDir', 'Test') diff --git a/utils/lit/tests/Inputs/progress-bar/lit.cfg b/utils/lit/tests/Inputs/progress-bar/lit.cfg index 4878b65..7f31129 100644 --- a/utils/lit/tests/Inputs/progress-bar/lit.cfg +++ b/utils/lit/tests/Inputs/progress-bar/lit.cfg @@ -1,3 +1,4 @@ +import lit.formats config.name = 'shtest-shell' config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() diff --git a/utils/lit/tests/Inputs/shtest-format/argv0.txt b/utils/lit/tests/Inputs/shtest-format/argv0.txt new file mode 100644 index 0000000..2ff2890 --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/argv0.txt @@ -0,0 +1,6 @@ +# Check that we route argv[0] as it was written, instead of the resolved +# path. This is important for some tools, in particular '[' which at least on OS +# X only recognizes that it is in '['-mode when its argv[0] is exactly +# '['. Otherwise it will refuse to accept the trailing closing bracket. +# +# RUN: [ "A" = "A" ] diff --git a/utils/lit/tests/Inputs/shtest-format/external_shell/fail.txt b/utils/lit/tests/Inputs/shtest-format/external_shell/fail.txt index 1e74be5..069e376 100644 --- a/utils/lit/tests/Inputs/shtest-format/external_shell/fail.txt +++ b/utils/lit/tests/Inputs/shtest-format/external_shell/fail.txt @@ -1,3 +1,5 @@ # Run a command that fails with error on stdout. # +# RUN: echo "line 1: failed test output on stdout" +# RUN: echo "line 2: failed test output on stdout" # RUN: cat "does-not-exist" diff --git a/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt b/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt new file mode 100644 index 0000000..f6157e6 --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt @@ -0,0 +1,5 @@ +# Run a command that fails with error on stdout. +# +# RUN: %S/write-bad-encoding.sh +# RUN: false + diff --git a/utils/lit/tests/Inputs/shtest-format/external_shell/lit.local.cfg b/utils/lit/tests/Inputs/shtest-format/external_shell/lit.local.cfg index d14d147..5e87c72 100644 --- a/utils/lit/tests/Inputs/shtest-format/external_shell/lit.local.cfg +++ b/utils/lit/tests/Inputs/shtest-format/external_shell/lit.local.cfg @@ -1 +1,2 @@ +import lit.formats config.test_format = lit.formats.ShTest(execute_external=True) diff --git a/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh b/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh new file mode 100755 index 0000000..6b622cb --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "a line with bad encoding: Â." diff --git a/utils/lit/tests/Inputs/shtest-format/fail.txt b/utils/lit/tests/Inputs/shtest-format/fail.txt index 49932c3..8c305eb 100644 --- a/utils/lit/tests/Inputs/shtest-format/fail.txt +++ b/utils/lit/tests/Inputs/shtest-format/fail.txt @@ -1 +1,2 @@ +# RUN: printf "line 1: failed test output on stdout\nline 2: failed test output on stdout" # RUN: false diff --git a/utils/lit/tests/Inputs/shtest-format/lit.cfg b/utils/lit/tests/Inputs/shtest-format/lit.cfg index 78dd1bf..9b47985 100644 --- a/utils/lit/tests/Inputs/shtest-format/lit.cfg +++ b/utils/lit/tests/Inputs/shtest-format/lit.cfg @@ -1,3 +1,4 @@ +import lit.formats config.name = 'shtest-format' config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() diff --git a/utils/lit/tests/Inputs/shtest-shell/lit.cfg b/utils/lit/tests/Inputs/shtest-shell/lit.cfg index 4878b65..7f31129 100644 --- a/utils/lit/tests/Inputs/shtest-shell/lit.cfg +++ b/utils/lit/tests/Inputs/shtest-shell/lit.cfg @@ -1,3 +1,4 @@ +import lit.formats config.name = 'shtest-shell' config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() diff --git a/utils/lit/tests/Inputs/test-data/lit.cfg b/utils/lit/tests/Inputs/test-data/lit.cfg new file mode 100644 index 0000000..f5aba7b --- /dev/null +++ b/utils/lit/tests/Inputs/test-data/lit.cfg @@ -0,0 +1,44 @@ +import os +try: + import ConfigParser +except ImportError: + import configparser as ConfigParser + +import lit.formats +import lit.Test + +class DummyFormat(lit.formats.FileBasedTest): + def execute(self, test, lit_config): + # In this dummy format, expect that each test file is actually just a + # .ini format dump of the results to report. + + source_path = test.getSourcePath() + + cfg = ConfigParser.ConfigParser() + cfg.read(source_path) + + # Create the basic test result. + result_code = cfg.get('global', 'result_code') + result_output = cfg.get('global', 'result_output') + result = lit.Test.Result(getattr(lit.Test, result_code), + result_output) + + # Load additional metrics. + for key,value_str in cfg.items('results'): + value = eval(value_str) + if isinstance(value, int): + metric = lit.Test.IntMetricValue(value) + elif isinstance(value, float): + metric = lit.Test.RealMetricValue(value) + else: + raise RuntimeError("unsupported result type") + result.addMetric(key, metric) + + return result + +config.name = 'test-data' +config.suffixes = ['.ini'] +config.test_format = DummyFormat() +config.test_source_root = None +config.test_exec_root = None +config.target_triple = None diff --git a/utils/lit/tests/Inputs/test-data/metrics.ini b/utils/lit/tests/Inputs/test-data/metrics.ini new file mode 100644 index 0000000..01b09c5 --- /dev/null +++ b/utils/lit/tests/Inputs/test-data/metrics.ini @@ -0,0 +1,7 @@ +[global] +result_code = PASS +result_output = Test passed. + +[results] +value0 = 1 +value1 = 2.3456
\ No newline at end of file diff --git a/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg b/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg index 52de709..9e08a86 100644 --- a/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg +++ b/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg @@ -1,3 +1,4 @@ +import lit.formats config.name = 'unittest-adaptor' config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() diff --git a/utils/lit/tests/discovery.py b/utils/lit/tests/discovery.py index be98c4b..2801089 100644 --- a/utils/lit/tests/discovery.py +++ b/utils/lit/tests/discovery.py @@ -1,7 +1,7 @@ # Check the basic discovery process, including a sub-suite. # # RUN: %{lit} %{inputs}/discovery \ -# RUN: -j 1 --debug --show-tests --show-suites --max-tests 0 \ +# RUN: -j 1 --debug --show-tests --show-suites \ # RUN: -v > %t.out 2> %t.err # RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s # RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s @@ -24,7 +24,6 @@ # CHECK-BASIC-OUT: top-level-suite :: subdir/test-three # CHECK-BASIC-OUT: top-level-suite :: test-one # CHECK-BASIC-OUT: top-level-suite :: test-two -# CHECK-BASIC-OUT: -- Testing: 0 # Check discovery when exact test names are given. @@ -32,19 +31,18 @@ # RUN: %{lit} \ # RUN: %{inputs}/discovery/subdir/test-three.py \ # RUN: %{inputs}/discovery/subsuite/test-one.txt \ -# RUN: -j 1 --show-tests --show-suites --max-tests 0 -v > %t.out +# RUN: -j 1 --show-tests --show-suites -v > %t.out # RUN: FileCheck --check-prefix=CHECK-EXACT-TEST < %t.out %s # # CHECK-EXACT-TEST: -- Available Tests -- # CHECK-EXACT-TEST: sub-suite :: test-one # CHECK-EXACT-TEST: top-level-suite :: subdir/test-three -# CHECK-EXACT-TEST: -- Testing: 0 # Check discovery when using an exec path. # # RUN: %{lit} %{inputs}/exec-discovery \ -# RUN: -j 1 --debug --show-tests --show-suites --max-tests 0 \ +# RUN: -j 1 --debug --show-tests --show-suites \ # RUN: -v > %t.out 2> %t.err # RUN: FileCheck --check-prefix=CHECK-ASEXEC-OUT < %t.out %s # RUN: FileCheck --check-prefix=CHECK-ASEXEC-ERR < %t.err %s @@ -70,7 +68,6 @@ # CHECK-ASEXEC-OUT: top-level-suite :: subdir/test-three # CHECK-ASEXEC-OUT: top-level-suite :: test-one # CHECK-ASEXEC-OUT: top-level-suite :: test-two -# CHECK-ASEXEC-OUT: -- Testing: 0 # Check discovery when exact test names are given. # @@ -78,12 +75,11 @@ # # RUN: %{lit} \ # RUN: %{inputs}/exec-discovery/subdir/test-three.py \ -# RUN: -j 1 --show-tests --show-suites --max-tests 0 -v > %t.out +# RUN: -j 1 --show-tests --show-suites -v > %t.out # RUN: FileCheck --check-prefix=CHECK-ASEXEC-EXACT-TEST < %t.out %s # # CHECK-ASEXEC-EXACT-TEST: -- Available Tests -- # CHECK-ASEXEC-EXACT-TEST: top-level-suite :: subdir/test-three -# CHECK-ASEXEC-EXACT-TEST: -- Testing: 0 # Check that we don't recurse infinitely when loading an site specific test @@ -91,7 +87,7 @@ # # RUN: %{lit} \ # RUN: %{inputs}/exec-discovery-in-tree/obj/ \ -# RUN: -j 1 --show-tests --show-suites --max-tests 0 -v > %t.out +# RUN: -j 1 --show-tests --show-suites -v > %t.out # RUN: FileCheck --check-prefix=CHECK-ASEXEC-INTREE < %t.out %s # # CHECK-ASEXEC-INTREE: exec-discovery-in-tree-suite - 1 tests @@ -99,4 +95,3 @@ # CHECK-ASEXEC-INTREE-NEXT: Exec Root : {{.*/exec-discovery-in-tree/obj$}} # CHECK-ASEXEC-INTREE-NEXT: -- Available Tests -- # CHECK-ASEXEC-INTREE-NEXT: exec-discovery-in-tree-suite :: test-one -# CHECK-ASEXEC-INTREE: -- Testing: 0 diff --git a/utils/lit/tests/googletest-format.py b/utils/lit/tests/googletest-format.py new file mode 100644 index 0000000..a62fd1b --- /dev/null +++ b/utils/lit/tests/googletest-format.py @@ -0,0 +1,20 @@ +# Check the various features of the GoogleTest format. +# +# RUN: not %{lit} -j 1 -v %{inputs}/googletest-format > %t.out +# RUN: FileCheck < %t.out %s +# +# END. + +# CHECK: -- Testing: +# CHECK: PASS: googletest-format :: DummySubDir/OneTest/FirstTest.subTestA +# CHECK: FAIL: googletest-format :: DummySubDir/OneTest/FirstTest.subTestB +# CHECK-NEXT: *** TEST 'googletest-format :: DummySubDir/OneTest/FirstTest.subTestB' FAILED *** +# CHECK-NEXT: I am subTest B, I FAIL +# CHECK-NEXT: And I have two lines of output +# CHECK: *** +# CHECK: PASS: googletest-format :: DummySubDir/OneTest/ParameterizedTest/0.subTest +# CHECK: PASS: googletest-format :: DummySubDir/OneTest/ParameterizedTest/1.subTest +# CHECK: Failing Tests (1) +# CHECK: Expected Passes : 3 +# CHECK: Unexpected Failures: 1 + diff --git a/utils/lit/tests/lit.cfg b/utils/lit/tests/lit.cfg index 32760ce..2111b72 100644 --- a/utils/lit/tests/lit.cfg +++ b/utils/lit/tests/lit.cfg @@ -1,6 +1,9 @@ # -*- Python -*- import os +import sys + +import lit.formats # Configuration file for the 'lit' test runner. @@ -20,17 +23,23 @@ config.excludes = ['Inputs'] config.test_source_root = os.path.dirname(__file__) config.test_exec_root = config.test_source_root -config.target_triple = None +config.target_triple = '(unused)' src_root = os.path.join(config.test_source_root, '..') config.environment['PYTHONPATH'] = src_root config.substitutions.append(('%{src_root}', src_root)) config.substitutions.append(('%{inputs}', os.path.join( src_root, 'tests', 'Inputs'))) -config.substitutions.append(('%{lit}', os.path.join(src_root, 'lit.py'))) +config.substitutions.append(('%{lit}', "%%{python} %s" % ( + os.path.join(src_root, 'lit.py'),))) +config.substitutions.append(('%{python}', sys.executable)) # Enable coverage.py reporting, assuming the coverage module has been installed # and sitecustomize.py in the virtualenv has been modified appropriately. -if lit.params.get('check-coverage', None): +if lit_config.params.get('check-coverage', None): config.environment['COVERAGE_PROCESS_START'] = os.path.join( os.path.dirname(__file__), ".coveragerc") + +# Add a feature to detect the Python version. +config.available_features.add("python%d.%d" % (sys.version_info[0], + sys.version_info[1])) diff --git a/utils/lit/tests/shell-parsing.py b/utils/lit/tests/shell-parsing.py index f644132..a07e988 100644 --- a/utils/lit/tests/shell-parsing.py +++ b/utils/lit/tests/shell-parsing.py @@ -1,3 +1,3 @@ # Just run the ShUtil unit tests. # -# RUN: python -m lit.ShUtil +# RUN: %{python} -m lit.ShUtil diff --git a/utils/lit/tests/shtest-encoding.py b/utils/lit/tests/shtest-encoding.py new file mode 100644 index 0000000..dfc987f --- /dev/null +++ b/utils/lit/tests/shtest-encoding.py @@ -0,0 +1,3 @@ +# RUN: true + +# Here is a string that cannot be decoded in line mode: Â. diff --git a/utils/lit/tests/shtest-format.py b/utils/lit/tests/shtest-format.py index 4b36873..751f0d7 100644 --- a/utils/lit/tests/shtest-format.py +++ b/utils/lit/tests/shtest-format.py @@ -7,15 +7,43 @@ # CHECK: -- Testing: +# CHECK: PASS: shtest-format :: argv0.txt # CHECK: FAIL: shtest-format :: external_shell/fail.txt -# CHECK: *** TEST 'shtest-format :: external_shell/fail.txt' FAILED *** +# CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail.txt' FAILED *** +# CHECK: Command Output (stdout): +# CHECK-NEXT: -- +# CHECK-NEXT: line 1: failed test output on stdout +# CHECK-NEXT: line 2: failed test output on stdout # CHECK: Command Output (stderr): -# CHECK: cat: does-not-exist: No such file or directory +# CHECK-NEXT: -- +# CHECK-NEXT: cat: does-not-exist: No such file or directory +# CHECK: -- + +# CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt +# CHECK-NEXT: *** TEST 'shtest-format :: external_shell/fail_with_bad_encoding.txt' FAILED *** +# CHECK: Command Output (stdout): +# CHECK-NEXT: -- +# CHECK-NEXT: a line with bad encoding: # CHECK: -- # CHECK: PASS: shtest-format :: external_shell/pass.txt # CHECK: FAIL: shtest-format :: fail.txt +# CHECK-NEXT: *** TEST 'shtest-format :: fail.txt' FAILED *** +# CHECK-NEXT: Script: +# CHECK-NEXT: -- +# CHECK-NEXT: printf "line 1 +# CHECK-NEXT: false +# CHECK-NEXT: -- +# CHECK-NEXT: Exit Code: 1 +# +# CHECK: Command Output (stdout): +# CHECK-NEXT: -- +# CHECK-NEXT: Command 0: "printf" +# CHECK-NEXT: Command 0 Result: 0 +# CHECK-NEXT: Command 0 Output: +# CHECK-NEXT: line 1: failed test output on stdout +# CHECK-NEXT: line 2: failed test output on stdout # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt # CHECK: PASS: shtest-format :: pass.txt @@ -26,18 +54,24 @@ # CHECK: XFAIL: shtest-format :: xfail-target.txt # CHECK: XFAIL: shtest-format :: xfail.txt # CHECK: XPASS: shtest-format :: xpass.txt +# CHECK-NEXT: *** TEST 'shtest-format :: xpass.txt' FAILED *** +# CHECK-NEXT: Script +# CHECK-NEXT: -- +# CHECK-NEXT: true +# CHECK-NEXT: -- # CHECK: Testing Time # CHECK: Unexpected Passing Tests (1) # CHECK: shtest-format :: xpass.txt -# CHECK: Failing Tests (2) +# CHECK: Failing Tests (3) # CHECK: shtest-format :: external_shell/fail.txt +# CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt # CHECK: shtest-format :: fail.txt -# CHECK: Expected Passes : 3 +# CHECK: Expected Passes : 4 # CHECK: Expected Failures : 3 # CHECK: Unsupported Tests : 2 # CHECK: Unresolved Tests : 1 # CHECK: Unexpected Passes : 1 -# CHECK: Unexpected Failures: 2 +# CHECK: Unexpected Failures: 3 diff --git a/utils/lit/tests/test-data.py b/utils/lit/tests/test-data.py new file mode 100644 index 0000000..54909d7 --- /dev/null +++ b/utils/lit/tests/test-data.py @@ -0,0 +1,12 @@ +# Test features related to formats which support reporting additional test data. + +# RUN: %{lit} -j 1 -v %{inputs}/test-data > %t.out +# RUN: FileCheck < %t.out %s + +# CHECK: -- Testing: + +# CHECK: PASS: test-data :: metrics.ini +# CHECK-NEXT: *** TEST 'test-data :: metrics.ini' RESULTS *** +# CHECK-NEXT: value0: 1 +# CHECK-NEXT: value1: 2.3456 +# CHECK-NEXT: *** diff --git a/utils/lit/tests/test-output.py b/utils/lit/tests/test-output.py new file mode 100644 index 0000000..adfbcd8 --- /dev/null +++ b/utils/lit/tests/test-output.py @@ -0,0 +1,21 @@ +# XFAIL: python2.5 + +# RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out +# RUN: FileCheck < %t.results.out %s + +# CHECK: { +# CHECK: "__version__" +# CHECK: "elapsed" +# CHECK-NEXT: "tests": [ +# CHECK-NEXT: { +# CHECK-NEXT: "code": "PASS", +# CHECK-NEXT: "elapsed": {{[0-9.]+}}, +# CHECK-NEXT: "metrics": { +# CHECK-NEXT: "value0": 1, +# CHECK-NEXT: "value1": 2.3456 +# CHECK-NEXT: } +# CHECK-NEXT: "name": "test-data :: metrics.ini", +# CHECK-NEXT: "output": "Test passed." +# CHECK-NEXT: } +# CHECK-NEXT: ] +# CHECK-NEXT: } diff --git a/utils/lit/tests/unittest-adaptor.py b/utils/lit/tests/unittest-adaptor.py index 243dd41..7435dda 100644 --- a/utils/lit/tests/unittest-adaptor.py +++ b/utils/lit/tests/unittest-adaptor.py @@ -1,6 +1,6 @@ # Check the lit adaption to run under unittest. # -# RUN: python %s %{inputs}/unittest-adaptor 2> %t.err +# RUN: %{python} %s %{inputs}/unittest-adaptor 2> %t.err # RUN: FileCheck < %t.err %s # # CHECK: unittest-adaptor :: test-one.txt ... ok |