1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/utils/lit/tests/use-llvm-tool.py
James Henderson 902f3f26fd [lit] Fix testing of standalone clang and lld builds
In such cases, the executables are not in the llvm_tools_dir directory, so we need to look in the other search locations. Previously, they were found via the PATH, but this was disabled by default in commit rGa1e6565.

Depends on D103154.

Reviewed By: thopre

Differential Revision: https://reviews.llvm.org/D103156
2021-06-03 13:57:50 +01:00

41 lines
2.0 KiB
Python

## Show that lit reports the path of tools found via use_llvm_tool.
## Additionally show that use_llvm_tool uses in order of preference:
## 1) The path specified in an environment variable,
## 2) The LLVM tools build directory,
## 3) The PATH, if requested.
# RUN: %{lit} %{inputs}/use-llvm-tool 2>&1 | \
# RUN: FileCheck %s -DDIR=%p
## The exact breakdown of cases is:
## Case | Env | Build Dir | PATH |
## 1 | / | X | N/S | <- Can be found via env
## 2 | X | / | N/S | <- Can be found via build dir if env specified
## 3 | N/S | / | N/S | <- Can be found via build dir
## 4 | N/S | X | / | <- Can be found via PATH, if requested
## 5 | N/S | X | N/S | <- Cannot be found via PATH, if not requested
## 6 | / | / | / | <- Env is preferred over build, PATH
## 7 | N/S | / | / | <- Build dir is preferred over PATH
## 8 | X | X | X | <- Say nothing if cannot be found if not required
## 9 | N/S | override | N/S | <- Use specified search directory, instead of default directory
## 10 | N/S | override | / | <- Use PATH if not in search directory
## Check the exact path reported for the first case, but don't bother for the
## others.
# CHECK: note: using case1: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}use-llvm-tool{{[\\/]}}env-case1
# CHECK-NEXT: note: using case2: {{.*}}build{{[\\/]}}case2
# CHECK-NEXT: note: using case3: {{.*}}build{{[\\/]}}case3
# CHECK-NEXT: note: using case4: {{.*}}path{{[\\/]}}case4
# CHECK-NOT: case5
# CHECK-NEXT: note: using case6: {{.*}}env-case6
# CHECK-NEXT: note: using case7: {{.*}}build{{[\\/]}}case7
# CHECK-NOT: case8
# CHECK-NEXT: note: using case9: {{.*}}search2{{[\\/]}}case9
# CHECK-NEXT: note: using case10: {{.*}}path{{[\\/]}}case10
## Test that if required is True, lit errors if the tool is not found.
# RUN: not %{lit} %{inputs}/use-llvm-tool-required 2>&1 | \
# RUN: FileCheck %s --check-prefix=ERROR
# ERROR: note: using found: {{.*}}found
# ERROR-NEXT: fatal: couldn't find 'not-found' program