diff options
Diffstat (limited to 'utils/lit/tests/Inputs')
11 files changed, 79 insertions, 41 deletions
diff --git a/utils/lit/tests/Inputs/shtest-format/requires-missing.txt b/utils/lit/tests/Inputs/shtest-format/requires-missing.txt index 9e6648d8b8f0..d643e57edcad 100644 --- a/utils/lit/tests/Inputs/shtest-format/requires-missing.txt +++ b/utils/lit/tests/Inputs/shtest-format/requires-missing.txt @@ -1,2 +1,5 @@ -RUN: true -REQUIRES: a-missing-feature +# REQUIRES with a false clause. Test should not run. +REQUIRES: true +REQUIRES: a-missing-feature, true +REQUIRES: true +RUN: false diff --git a/utils/lit/tests/Inputs/shtest-format/requires-present.txt b/utils/lit/tests/Inputs/shtest-format/requires-present.txt index 064f7074a76e..9fcbdca69be3 100644 --- a/utils/lit/tests/Inputs/shtest-format/requires-present.txt +++ b/utils/lit/tests/Inputs/shtest-format/requires-present.txt @@ -1,2 +1,4 @@ +# REQUIRES with only true clauses. Test should run. +REQUIRES: a-present-feature, true, !not-true +REQUIRES: true RUN: true -REQUIRES: a-present-feature diff --git a/utils/lit/tests/Inputs/shtest-format/requires-star.txt b/utils/lit/tests/Inputs/shtest-format/requires-star.txt new file mode 100644 index 000000000000..5566d8b15b07 --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/requires-star.txt @@ -0,0 +1,3 @@ +# '*' only works in XFAIL +REQUIRES: * +RUN: false diff --git a/utils/lit/tests/Inputs/shtest-format/requires-triple.txt b/utils/lit/tests/Inputs/shtest-format/requires-triple.txt new file mode 100644 index 000000000000..6470bf404145 --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/requires-triple.txt @@ -0,0 +1,3 @@ +# REQUIRES line that uses target triple, which doesn't work. Test should not run +REQUIRES: x86_64 +RUN: false diff --git a/utils/lit/tests/Inputs/shtest-format/unsupported-expr-false.txt b/utils/lit/tests/Inputs/shtest-format/unsupported-expr-false.txt new file mode 100644 index 000000000000..00c6160a367c --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/unsupported-expr-false.txt @@ -0,0 +1,9 @@ +# UNSUPPORTED with only false clauses. Test should run. +UNSUPPORTED: false +UNSUPPORTED: false, not-true +UNSUPPORTED: false +UNSUPPORTED: still-not-true +UNSUPPORTED: false +UNSUPPORTED: false +UNSUPPORTED: false +RUN: true diff --git a/utils/lit/tests/Inputs/shtest-format/unsupported-expr-true.txt b/utils/lit/tests/Inputs/shtest-format/unsupported-expr-true.txt new file mode 100644 index 000000000000..f48ba7b2c2d2 --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/unsupported-expr-true.txt @@ -0,0 +1,4 @@ +# UNSUPPORTED with a true clause. Test should not run. +UNSUPPORTED: false +UNSUPPORTED: false, false, false, _64-unk && a-present-feature, false +RUN: false diff --git a/utils/lit/tests/Inputs/shtest-format/unsupported-star.txt b/utils/lit/tests/Inputs/shtest-format/unsupported-star.txt new file mode 100644 index 000000000000..16630207dacb --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/unsupported-star.txt @@ -0,0 +1,3 @@ +# '*' only works in XFAIL +UNSUPPORTED: * +RUN: false diff --git a/utils/lit/tests/Inputs/shtest-format/xfail-expr-false.txt b/utils/lit/tests/Inputs/shtest-format/xfail-expr-false.txt new file mode 100644 index 000000000000..83b0de1621d0 --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/xfail-expr-false.txt @@ -0,0 +1,3 @@ +# XFAIL with only false clauses. Test should run. +XFAIL: false, a-missing-feature || ! a-present-feature || ! x86_64, false +RUN: true diff --git a/utils/lit/tests/Inputs/shtest-format/xfail-expr-true.txt b/utils/lit/tests/Inputs/shtest-format/xfail-expr-true.txt new file mode 100644 index 000000000000..3c197484897e --- /dev/null +++ b/utils/lit/tests/Inputs/shtest-format/xfail-expr-true.txt @@ -0,0 +1,4 @@ +# XFAIL with a true clause. Test should not run. +XFAIL: false +XFAIL: false, a-present-feature && ! a-missing-feature && x86_64 +RUN: false diff --git a/utils/lit/tests/Inputs/test-data/dummy_format.py b/utils/lit/tests/Inputs/test-data/dummy_format.py new file mode 100644 index 000000000000..93e48eeb8396 --- /dev/null +++ b/utils/lit/tests/Inputs/test-data/dummy_format.py @@ -0,0 +1,38 @@ +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 + diff --git a/utils/lit/tests/Inputs/test-data/lit.cfg b/utils/lit/tests/Inputs/test-data/lit.cfg index f5aba7b21774..0191cc218884 100644 --- a/utils/lit/tests/Inputs/test-data/lit.cfg +++ b/utils/lit/tests/Inputs/test-data/lit.cfg @@ -1,44 +1,10 @@ -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 +import site +site.addsitedir(os.path.dirname(__file__)) +import dummy_format config.name = 'test-data' config.suffixes = ['.ini'] -config.test_format = DummyFormat() +config.test_format = dummy_format.DummyFormat() config.test_source_root = None config.test_exec_root = None config.target_triple = None |