xref: /netbsd-src/external/apache2/llvm/dist/llvm/utils/lit/lit/formats/shtest.py (revision 82d56013d7b633d116a93943de88e08335357a7c)
1from __future__ import absolute_import
2
3import lit.TestRunner
4import lit.util
5
6from .base import FileBasedTest
7
8
9class ShTest(FileBasedTest):
10    """ShTest is a format with one file per test.
11
12    This is the primary format for regression tests as described in the LLVM
13    testing guide:
14
15        http://llvm.org/docs/TestingGuide.html
16
17    The ShTest files contain some number of shell-like command pipelines, along
18    with assertions about what should be in the output.
19    """
20    def __init__(self, execute_external=False, extra_substitutions=[],
21                 preamble_commands=[]):
22        self.execute_external = execute_external
23        self.extra_substitutions = extra_substitutions
24        self.preamble_commands = preamble_commands
25
26    def execute(self, test, litConfig):
27        return lit.TestRunner.executeShTest(test, litConfig,
28                                            self.execute_external,
29                                            self.extra_substitutions,
30                                            self.preamble_commands)
31