lit.cfg.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. __copyright__ = """
  2. Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  3. Exceptions. See /LICENSE for license information.
  4. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. """
  6. import lit.formats
  7. import os
  8. # This is a provided variable, ignore the undefined name warning.
  9. config = config # noqa: F821
  10. def fullpath(relative_path):
  11. return os.path.join(os.environ["TEST_SRCDIR"], relative_path)
  12. config.name = "lit"
  13. config.suffixes = [".carbon"]
  14. config.test_format = lit.formats.ShTest()
  15. config.substitutions.append(
  16. (
  17. "%{carbon}",
  18. fullpath("carbon/toolchain/driver/carbon"),
  19. )
  20. )
  21. _EXPLORER = "%s --prelude=%s" % (
  22. fullpath("carbon/explorer/explorer"),
  23. fullpath("carbon/explorer/data/prelude.carbon"),
  24. )
  25. config.substitutions.append(("%{explorer}", _EXPLORER))
  26. config.substitutions.append(
  27. ("%{explorer-trace}", _EXPLORER + " --parser_debug --trace_file=-")
  28. )
  29. config.substitutions.append(("%{not}", fullpath("llvm-project/llvm/not")))
  30. _FILE_CHECK = "%s --dump-input-filter=all" % fullpath(
  31. "llvm-project/llvm/FileCheck"
  32. )
  33. config.substitutions.append(("%{FileCheck}", _FILE_CHECK))
  34. config.substitutions.append(
  35. (
  36. "%{FileCheck-allow-unmatched}",
  37. _FILE_CHECK + " --match-full-lines --strict-whitespace",
  38. )
  39. )
  40. config.substitutions.append(
  41. (
  42. "%{FileCheck-strict}",
  43. _FILE_CHECK
  44. + " --implicit-check-not={{.}} --match-full-lines --strict-whitespace",
  45. )
  46. )