The ShTest files contain some number of shell-like command pipelines, along
with assertions about what should be in the output.
"""
- def __init__(self, execute_external=False):
+ def __init__(self, execute_external=False, extra_substitutions=[],
+ preamble_commands=[]):
self.execute_external = execute_external
+ self.extra_substitutions = extra_substitutions
+ self.preamble_commands = preamble_commands
def execute(self, test, litConfig):
return lit.TestRunner.executeShTest(test, litConfig,
- self.execute_external)
+ self.execute_external,
+ self.extra_substitutions,
+ self.preamble_commands)
import lit
-class CustomFormat(lit.formats.TestFormat):
- def execute(self, test, litConfig):
- commands = [
- 'echo "THIS WAS"',
- 'echo "INJECTED"'
- ]
- return lit.TestRunner.executeShTest(test, litConfig,
- useExternalSh=False,
- preamble_commands=commands)
+preamble_commands = [
+ 'echo "THIS WAS"',
+ 'echo "INJECTED"'
+];
config.name = 'shtest-inject'
config.suffixes = ['.txt']
-config.test_format = CustomFormat()
+config.test_format = lit.formats.ShTest(preamble_commands=preamble_commands)
config.test_source_root = None
config.test_exec_root = None
-# Check that we can inject commands at the beginning of a ShTest using a custom
-# test format.
+# Check that we can inject commands at the beginning of a ShTest.
# RUN: %{lit} -j 1 %{inputs}/shtest-inject/test-empty.txt --show-all | FileCheck --check-prefix=CHECK-TEST1 %s
#