Switch prelude to a file and refactor lit testing to pass commands directly. (#966)

This commit is contained in:
Jon Meow
2021-12-03 14:23:13 -08:00
committed by GitHub
parent f75b4d322f
commit beea60d0b8
143 changed files with 745 additions and 728 deletions
+39
View File
@@ -0,0 +1,39 @@
__copyright__ = """
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
Exceptions. See /LICENSE for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""
import lit.formats
import os
# This is a provided variable, ignore the undefined name warning.
config = config # noqa: F821
def fullpath(relative_path):
return os.path.join(os.environ["TEST_SRCDIR"], relative_path)
config.name = "lit"
config.suffixes = [".carbon"]
config.test_format = lit.formats.ShTest()
config.substitutions.append(
("%{prelude}", fullpath("carbon/executable_semantics/data/prelude.carbon"))
)
config.substitutions.append(
(
"%{executable_semantics}",
"%s --prelude=%s"
% (
fullpath("carbon/executable_semantics/executable_semantics"),
fullpath("carbon/executable_semantics/data/prelude.carbon"),
),
)
)
config.substitutions.append(("%{not}", fullpath("llvm-project/llvm/not")))
config.substitutions.append(
("%{FileCheck}", fullpath("llvm-project/llvm/FileCheck"))
)