lit.cfg.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. _MERGE_OUTPUT = fullpath("carbon/bazel/testing/merge_output")
  16. config.substitutions.append(
  17. (
  18. "%{carbon}",
  19. "%s %s" % (_MERGE_OUTPUT, fullpath("carbon/toolchain/driver/carbon")),
  20. )
  21. )
  22. _EXPLORER = "%s %s --prelude=%s" % (
  23. _MERGE_OUTPUT,
  24. fullpath("carbon/explorer/explorer"),
  25. fullpath("carbon/explorer/data/prelude.carbon"),
  26. )
  27. config.substitutions.append(("%{explorer}", _EXPLORER))
  28. config.substitutions.append(
  29. ("%{explorer-trace}", _EXPLORER + " --parser_debug --trace_file=-")
  30. )
  31. config.substitutions.append(("%{not}", fullpath("llvm-project/llvm/not")))
  32. _FILE_CHECK = "%s --dump-input-filter=all" % fullpath(
  33. "llvm-project/llvm/FileCheck"
  34. )
  35. config.substitutions.append(("%{FileCheck}", _FILE_CHECK))
  36. config.substitutions.append(
  37. (
  38. "%{FileCheck-allow-unmatched}",
  39. _FILE_CHECK + " --match-full-lines --strict-whitespace",
  40. )
  41. )
  42. config.substitutions.append(
  43. (
  44. "%{FileCheck-strict}",
  45. _FILE_CHECK
  46. + " --implicit-check-not={{.}} --match-full-lines --strict-whitespace",
  47. )
  48. )