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=%p 9 10## The exact breakdown of cases is: 11## Case | Env | Build Dir | PATH | 12## 1 | / | X | N/S | <- Can be found via env 13## 2 | X | / | N/S | <- Can be found via build dir if env specified 14## 3 | N/S | / | N/S | <- Can be found via build dir 15## 4 | N/S | X | / | <- Can be found via PATH, if requested 16## 5 | N/S | X | N/S | <- Cannot be found via PATH, if not requested 17## 6 | / | / | / | <- Env is preferred over build, PATH 18## 7 | N/S | / | / | <- Build dir is preferred over PATH 19## 8 | X | X | X | <- Say nothing if cannot be found if not required 20## 9 | N/S | override | N/S | <- Use specified search directory, instead of default directory 21## 10 | N/S | override | / | <- Use PATH if not in search directory 22 23## Check the exact path reported for the first case, but don't bother for the 24## others. 25# CHECK: note: using case1: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}use-llvm-tool{{[\\/]}}env-case1 26# CHECK-NEXT: note: using case2: {{.*}}build{{[\\/]}}case2 27# CHECK-NEXT: note: using case3: {{.*}}build{{[\\/]}}case3 28# CHECK-NEXT: note: using case4: {{.*}}path{{[\\/]}}case4 29# CHECK-NOT: case5 30# CHECK-NEXT: note: using case6: {{.*}}env-case6 31# CHECK-NEXT: note: using case7: {{.*}}build{{[\\/]}}case7 32# CHECK-NOT: case8 33# CHECK-NEXT: note: using case9: {{.*}}search2{{[\\/]}}case9 34# CHECK-NEXT: note: using case10: {{.*}}path{{[\\/]}}case10 35 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=ERROR 39# ERROR: note: using found: {{.*}}found 40# ERROR-NEXT: fatal: couldn't find 'not-found' program 41