<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56836>56836</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] [test] test/Driver/config-file-errs.c fails if CLANG_CONFIG_FILE_SYSTEM_DIR is specified
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          mgorny
      </td>
    </tr>
</table>

<pre>
    If `CLANG_CONFIG_FILE_SYSTEM_DIR` is actually specified, the tests fail:

```
FAIL: Clang :: Driver/config-file-errs.c (7434 of 15641)
******************** TEST 'Clang :: Driver/config-file-errs.c' FAILED ********************
Script:
--
: 'RUN: at line 3';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config 1.cfg --config 2.cfg 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-DUPLICATE
: 'RUN: at line 9';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-MISSING-FILE
: 'RUN: at line 15';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config-6.cfg 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NESTED
: 'RUN: at line 21';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config somewhere/nonexistent-config-file 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NONEXISTENT
: 'RUN: at line 27';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config-system-dir= --config-user-dir= --config nonexistent-config-file 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NOTFOUND0
: 'RUN: at line 32';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config-system-dir= --config-user-dir=/var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config2 --config nonexistent-config-file 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NOTFOUND1
: 'RUN: at line 38';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config-system-dir=/var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config --config-user-dir= --config nonexistent-config-file 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NOTFOUND2
: 'RUN: at line 44';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config-system-dir=/var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config --config-user-dir=/var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config2 --config nonexistent-config-file 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NOTFOUND3
: 'RUN: at line 53';   not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config-5.cfg x86_64-unknown-linux-gnu -c /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c 2>&1 | /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-CROSS
--
Exit Code: 1

Command Output (stderr):
--
+ : 'RUN: at line 3'
+ not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config 1.cfg --config 2.cfg
+ /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-DUPLICATE
+ : 'RUN: at line 9'
+ not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config
+ /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-MISSING-FILE
+ : 'RUN: at line 15'
+ /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NESTED
+ not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/Inputs/config-6.cfg
+ : 'RUN: at line 21'
+ /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NONEXISTENT
+ not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config somewhere/nonexistent-config-file
+ : 'RUN: at line 27'
+ /usr/lib/llvm/15/bin/FileCheck /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c -check-prefix CHECK-NOTFOUND0
+ not /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin/clang --config-system-dir= --config-user-dir= --config nonexistent-config-file
/var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c:30:25: error: CHECK-NOTFOUND0-NOT: excluded string found in input
// CHECK-NOTFOUND0-NOT: was searched for in the directory:
                        ^
<stdin>:3:17: note: found here
clang-15: note: was searched for in the directory: /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Input file: <stdin>
Check file: /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/clang/test/Driver/config-file-errs.c

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        1: clang-15: error: configuration file 'nonexistent-config-file.cfg' cannot be found 
        2: clang-15: note: was searched for in the directory: /etc/clang 
        3: clang-15: note: was searched for in the directory: /var/tmp/portage/sys-devel/clang-15.0.0.9999/work/x/y/clang-abi_x86_32.x86/bin 
not:30                     !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                 error: no match expected
        4: clang-15: error: no input files 
>>>>>>

--

********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWt9zqjgU_mvwJYMD4Zc8-NCidp3ttTvVzuw-OQhBswXikNDqf78nUSnaynZvb7XevTQCISE55zvfOaQHZixed4cJ0lwjuL0a3UyDu9FgeDMdDG_70_Ff40n_27Q3vIdmRDkKI1GGabpGfEkimlASazhAYkGQIFxwlIQ01awrzehpxm7vGtuiqoOr4S30QEEa5nMk-0KlV9AnUmh4ELE8oXM9oSnRSVHwdoQ03PFsy0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