41 lines · python
1## Show that lit reports the path of tools found via use_llvm_tool.2## Additionally show that use_llvm_tool uses in order of preference:3## 1) The path specified in an environment variable,4## 2) The LLVM tools build directory,5## 3) The PATH, if requested.6 7# RUN: %{lit} %{inputs}/use-llvm-tool 2>&1 | \8# RUN: FileCheck %s -DDIR=%p9 10## The exact breakdown of cases is:11## Case | Env | Build Dir | PATH |12## 1 | / | X | N/S | <- Can be found via env13## 2 | X | / | N/S | <- Can be found via build dir if env specified14## 3 | N/S | / | N/S | <- Can be found via build dir15## 4 | N/S | X | / | <- Can be found via PATH, if requested16## 5 | N/S | X | N/S | <- Cannot be found via PATH, if not requested17## 6 | / | / | / | <- Env is preferred over build, PATH18## 7 | N/S | / | / | <- Build dir is preferred over PATH19## 8 | X | X | X | <- Say nothing if cannot be found if not required20## 9 | N/S | override | N/S | <- Use specified search directory, instead of default directory21## 10 | N/S | override | / | <- Use PATH if not in search directory22 23## Check the exact path reported for the first case, but don't bother for the24## others.25# CHECK: note: using case1: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}use-llvm-tool{{[\\/]}}env-case126# CHECK-NEXT: note: using case2: {{.*}}build{{[\\/]}}case227# CHECK-NEXT: note: using case3: {{.*}}build{{[\\/]}}case328# CHECK-NEXT: note: using case4: {{.*}}path{{[\\/]}}case429# CHECK-NOT: case530# CHECK-NEXT: note: using case6: {{.*}}env-case631# CHECK-NEXT: note: using case7: {{.*}}build{{[\\/]}}case732# CHECK-NOT: case833# CHECK-NEXT: note: using case9: {{.*}}search2{{[\\/]}}case934# CHECK-NEXT: note: using case10: {{.*}}path{{[\\/]}}case1035 36## Test that if required is True, lit errors if the tool is not found.37# RUN: not %{lit} %{inputs}/use-llvm-tool-required 2>&1 | \38# RUN: FileCheck %s --check-prefix=ERROR39# ERROR: note: using found: {{.*}}found40# ERROR-NEXT: fatal: couldn't find 'not-found' program41