Serge Pavlov | 208ac65 | 2018-01-01 13:27:01 +0000 | [diff] [blame] | 1 | // REQUIRES: shell |
| 2 | // REQUIRES: x86-registered-target |
| 3 | |
| 4 | //--- If config file is specified by relative path (workdir/cfg-s2), it is searched for by that path. |
| 5 | // |
| 6 | // RUN: mkdir -p %T/workdir |
| 7 | // RUN: echo "@subdir/cfg-s2" > %T/workdir/cfg-1 |
| 8 | // RUN: mkdir -p %T/workdir/subdir |
| 9 | // RUN: echo "-Wundefined-var-template" > %T/workdir/subdir/cfg-s2 |
| 10 | // |
| 11 | // RUN: ( cd %T && %clang --config workdir/cfg-1 -c %s -### 2>&1 | FileCheck %s -check-prefix CHECK-REL ) |
| 12 | // |
| 13 | // CHECK-REL: Configuration file: {{.*}}/workdir/cfg-1 |
| 14 | // CHECK-REL: -Wundefined-var-template |
| 15 | |
| 16 | |
| 17 | //--- Invocation qqq-clang-g++ tries to find config file qqq-clang-g++.cfg first. |
| 18 | // |
| 19 | // RUN: mkdir -p %T/testdmode |
| 20 | // RUN: [ ! -s %T/testdmode/qqq-clang-g++ ] || rm %T/testdmode/qqq-clang-g++ |
| 21 | // RUN: ln -s %clang %T/testdmode/qqq-clang-g++ |
| 22 | // RUN: echo "-Wundefined-func-template" > %T/testdmode/qqq-clang-g++.cfg |
| 23 | // RUN: echo "-Werror" > %T/testdmode/qqq.cfg |
| 24 | // RUN: %T/testdmode/qqq-clang-g++ --config-system-dir= --config-user-dir= -c -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix FULL-NAME |
| 25 | // |
| 26 | // FULL-NAME: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg |
| 27 | // FULL-NAME: -Wundefined-func-template |
| 28 | // FULL-NAME-NOT: -Werror |
| 29 | // |
Martin Storsjo | 1fab23d | 2018-04-25 21:23:59 +0000 | [diff] [blame^] | 30 | //--- Invocation qqq-clang-g++ tries to find config file qqq-clang-g++.cfg even without -no-canonical-prefixes. |
| 31 | // (As the clang executable and symlink are in different directories, this |
| 32 | // requires specifying the path via --config-*-dir= though.) |
| 33 | // |
| 34 | // RUN: %T/testdmode/qqq-clang-g++ --config-system-dir= --config-user-dir=%T/testdmode -c %s -### 2>&1 | FileCheck %s -check-prefix SYMLINK |
| 35 | // |
| 36 | // SYMLINK: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg |
| 37 | // |
Serge Pavlov | 208ac65 | 2018-01-01 13:27:01 +0000 | [diff] [blame] | 38 | //--- File specified by --config overrides config inferred from clang executable. |
| 39 | // |
| 40 | // RUN: %T/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --config i386-qqq -c -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-EXPLICIT |
| 41 | // |
| 42 | // CHECK-EXPLICIT: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg |
| 43 | // |
| 44 | //--- Invocation qqq-clang-g++ tries to find config file qqq.cfg if qqq-clang-g++.cfg is not found. |
| 45 | // |
| 46 | // RUN: rm %T/testdmode/qqq-clang-g++.cfg |
| 47 | // RUN: %T/testdmode/qqq-clang-g++ --config-system-dir= --config-user-dir= -c -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix SHORT-NAME |
| 48 | // |
| 49 | // SHORT-NAME: Configuration file: {{.*}}/testdmode/qqq.cfg |
| 50 | // SHORT-NAME: -Werror |
| 51 | // SHORT-NAME-NOT: -Wundefined-func-template |
| 52 | |
| 53 | |
| 54 | //--- Config files are searched for in binary directory as well. |
| 55 | // |
| 56 | // RUN: mkdir -p %T/testbin |
| 57 | // RUN: [ ! -s %T/testbin/clang ] || rm %T/testbin/clang |
| 58 | // RUN: ln -s %clang %T/testbin/clang |
| 59 | // RUN: echo "-Werror" > %T/testbin/aaa.cfg |
| 60 | // RUN: %T/testbin/clang --config-system-dir= --config-user-dir= --config aaa.cfg -c -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-BIN |
| 61 | // |
| 62 | // CHECK-BIN: Configuration file: {{.*}}/testbin/aaa.cfg |
| 63 | // CHECK-BIN: -Werror |
| 64 | |
| 65 | |
| 66 | //--- If command line contains options that change triple (for instance, -m32), clang tries |
| 67 | // reloading config file. |
| 68 | |
| 69 | //--- When reloading config file, x86_64-clang-g++ tries to find config i386-clang-g++.cfg first. |
| 70 | // |
| 71 | // RUN: mkdir -p %T/testreload |
| 72 | // RUN: [ ! -s %T/testreload/x86_64-clang-g++ ] || rm %T/testreload/x86_64-clang-g++ |
| 73 | // RUN: ln -s %clang %T/testreload/x86_64-clang-g++ |
| 74 | // RUN: echo "-Wundefined-func-template" > %T/testreload/i386-clang-g++.cfg |
| 75 | // RUN: echo "-Werror" > %T/testreload/i386.cfg |
| 76 | // RUN: %T/testreload/x86_64-clang-g++ --config-system-dir= --config-user-dir= -c -m32 -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-RELOAD |
| 77 | // |
| 78 | // CHECK-RELOAD: Configuration file: {{.*}}/testreload/i386-clang-g++.cfg |
| 79 | // CHECK-RELOAD: -Wundefined-func-template |
| 80 | // CHECK-RELOAD-NOT: -Werror |
| 81 | |
| 82 | //--- If config file is specified by --config and its name does not start with architecture, it is used without reloading. |
| 83 | // |
| 84 | // RUN: %T/testreload/x86_64-clang-g++ --config-system-dir=%S/Inputs --config-user-dir= --config config-3 -c -m32 -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-RELOAD1a |
| 85 | // |
| 86 | // CHECK-RELOAD1a: Configuration file: {{.*}}/Inputs/config-3.cfg |
| 87 | // |
| 88 | // RUN: %T/testreload/x86_64-clang-g++ --config-system-dir=%S/Inputs --config-user-dir= --config config-3 -c -target i386 -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-RELOAD1b |
| 89 | // |
| 90 | // CHECK-RELOAD1b: Configuration file: {{.*}}/Inputs/config-3.cfg |
| 91 | |
| 92 | //--- If config file is specified by --config and its name starts with architecture, it is reloaded. |
| 93 | // |
| 94 | // RUN: %T/testreload/x86_64-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --config x86_64-qqq -c -m32 -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-RELOAD1c |
| 95 | // |
| 96 | // CHECK-RELOAD1c: Configuration file: {{.*}}/Inputs/config/i386-qqq.cfg |
| 97 | |
| 98 | //--- x86_64-clang-g++ tries to find config i386.cfg if i386-clang-g++.cfg is not found. |
| 99 | // |
| 100 | // RUN: rm %T/testreload/i386-clang-g++.cfg |
| 101 | // RUN: %T/testreload/x86_64-clang-g++ --config-system-dir= --config-user-dir= -c -m32 -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-RELOAD1d |
| 102 | // |
| 103 | // CHECK-RELOAD1d: Configuration file: {{.*}}/testreload/i386.cfg |
| 104 | // CHECK-RELOAD1d: -Werror |
| 105 | // CHECK-RELOAD1d-NOT: -Wundefined-func-template |
| 106 | |