1 // UNSUPPORTED: target=powerpc64-ibm-aix{{.*}}
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: cp %S/Inputs/resource_directory/* %t
7 // Deduce the resource directory from the compiler path.
9 // With `%clang-scan-deps --resource-dir-recipe modify-compiler-path`, the
10 // resource directory should be identical to `%clang -print-resource-dir`.
11 // (Assuming both binaries are built from the same Git checkout.)
12 // Here we get the expected path by running `%clang -print-resource-dir` and
13 // then verify `%clang-scan-deps` arrives at the same path by calling the
14 // `Driver::GetResourcesPath` function.
16 // RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir`
17 // RUN: sed -e "s|CLANG|%clang|g" -e "s|DIR|%/t|g" \
18 // RUN: %S/Inputs/resource_directory/cdb.json.template > %t/cdb_path.json
20 // RUN: clang-scan-deps -compilation-database %t/cdb_path.json --format experimental-full \
21 // RUN: --resource-dir-recipe modify-compiler-path > %t/result_path.json
22 // RUN: cat %t/result_path.json | sed 's:\\\\\?:/:g' \
23 // RUN: | FileCheck %s --check-prefix=CHECK-PATH -DEXPECTED_RESOURCE_DIR="$EXPECTED_RESOURCE_DIR"
24 // CHECK-PATH: "-resource-dir"
25 // CHECK-PATH-NEXT: "[[EXPECTED_RESOURCE_DIR]]"
27 // Run the compiler and ask it for the resource directory.
29 // With `%clang-scan-deps --resource-dir-recipe invoke-compiler`, the resource
30 // directory should be identical to `<clang> -print-resource-dir`, where <clang>
31 // is an arbitrary version of Clang. (This configuration is not really supported.)
32 // Here we hard-code the expected path into `%t/compiler` and then verify
33 // `%clang-scan-deps` arrives at the path by actually running the executable.
35 // RUN: EXPECTED_RESOURCE_DIR="/custom/compiler/resources"
36 // RUN: echo "#!/bin/sh" > %t/compiler
37 // RUN: echo "echo '$EXPECTED_RESOURCE_DIR'" >> %t/compiler
38 // RUN: chmod +x %t/compiler
39 // RUN: sed -e "s|CLANG|%/t/compiler|g" -e "s|DIR|%/t|g" \
40 // RUN: %S/Inputs/resource_directory/cdb.json.template > %t/cdb_invocation.json
42 // RUN: clang-scan-deps -compilation-database %t/cdb_invocation.json --format experimental-full \
43 // RUN: --resource-dir-recipe invoke-compiler > %t/result_invocation.json
44 // RUN: cat %t/result_invocation.json | sed 's:\\\\\?:/:g' \
45 // RUN: | FileCheck %s --check-prefix=CHECK-PATH -DEXPECTED_RESOURCE_DIR="$EXPECTED_RESOURCE_DIR"
46 // CHECK-INVOCATION: "-resource-dir"
47 // CHECK-INVOCATION-NEXT: "[[EXPECTED_RESOURCE_DIR]]"