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

    <tr>
        <th>Summary</th>
        <td>
            [llvm-lit] Expected string not found in input error in clang and compiler-rt when testing with lit internal shell
        </td>
    </tr>

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

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

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

<pre>
    When testing with the lit internal shell several tests in Clang and compiler-rt fail with "Expected string not found in input" errors. For example:
Clang:
```
FAIL: Clang :: APINotes/yaml-roundtrip.test (16 of 20640)
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
not diff -b /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes /usr/local/google/home/harinidonthula/llvm-project/build/tools/clang/test/APINotes/Output/yaml-roundtrip.test.tmp.result | /usr/local/google/home/harinidonthula/llvm-project/build/bin/FileCheck /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/yaml-roundtrip.test
# executed command: not diff -b /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes /usr/local/google/home/harinidonthula/llvm-project/build/tools/clang/test/APINotes/Output/yaml-roundtrip.test.tmp.result
# executed command: /usr/local/google/home/harinidonthula/llvm-project/build/bin/FileCheck /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/yaml-roundtrip.test
# .---command stderr------------
# | /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/yaml-roundtrip.test:11:8: error: CHECK: expected string not found in input
# | CHECK: 7c8
# | ^
# | <stdin>:1:1: note: scanning from here
# | *** /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes
# | ^
# | <stdin>:1:11: note: possible intended match here
# | *** /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes
# |           ^
# |
# | Input file: <stdin>
# | Check file: /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/yaml-roundtrip.test
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# |             1: *** /usr/local/google/home/harinidonthula/llvm-project/clang/test/APINotes/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes 
# | check:11'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | check:11'1               ? possible intended match
# |             2: --- /usr/local/google/home/harinidonthula/llvm-project/build/tools/clang/test/APINotes/Output/yaml-roundtrip.test.tmp.result 
# | check:11'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3: *************** 
# | check:11'0     ~~~~~~~~~~~~~~~~
# |             4: *** 1,28 **** 
# | check:11'0     ~~~~~~~~~~~~~~
# | 5:  Name: SimpleKit 
# | check:11'0     ~~~~~~~~~~~~~~~~~
# | 6:  Classes: 
# | check:11'0     ~~~~~~~~~~
# | .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
```

compiler-rt:
```
********************
Testing: 
FAIL: ThreadSanitizer-x86_64 :: ignore_lib0.cpp (89 of 9570)
******************** TEST 'ThreadSanitizer-x86_64 :: ignore_lib0.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir
# executed command: rm -rf /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir
# RUN: at line 2
mkdir /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir
# executed command: mkdir /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir
# RUN: at line 4
/usr/local/google/home/harinidonthula/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=thread -Wall  -m64  -msse4.2 -gline-tables-only -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -std=c++11 -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -nostdinc++ -I/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/include/c++/v1 -O1 -fno-builtin /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp -DLIB -fPIC -fno-sanitize=thread -shared -o /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir/libignore_lib0.so
# executed command: /usr/local/google/home/harinidonthula/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=thread -Wall -m64 -msse4.2 -gline-tables-only -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -std=c++11 -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -nostdinc++ -I/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/include/c++/v1 -O1 -fno-builtin /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp -DLIB -fPIC -fno-sanitize=thread -shared -o /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir/libignore_lib0.so
# RUN: at line 5
/usr/local/google/home/harinidonthula/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=thread -Wall  -m64  -msse4.2 -gline-tables-only -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -std=c++11 -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -nostdinc++ -I/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/include/c++/v1 -O1 /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp -L/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir -lignore_lib0 /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/lib/libc++.a -o /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp
# executed command: /usr/local/google/home/harinidonthula/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=thread -Wall -m64 -msse4.2 -gline-tables-only -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -std=c++11 -I/usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/../ -nostdinc++ -I/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/include/c++/v1 -O1 /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp -L/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir -lignore_lib0 /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/tsan/libcxx_tsan_x86_64/lib/libc++.a -o /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp
# RUN: at line 6
echo running w/o suppressions:
# executed command: echo running w/o suppressions:
# .---command stdout------------
# | running w/o suppressions:
# `-----------------------------
# RUN: at line 7
env LD_LIBRARY_PATH=/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/deflake.bash 10 /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp | FileCheck /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp --check-prefix=CHECK-NOSUPP
# executed command: env 'LD_LIBRARY_PATH=/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}' /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/deflake.bash 10 /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp
# executed command: FileCheck /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp --check-prefix=CHECK-NOSUPP
# .---command stderr------------
# | /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp:35:18: error: CHECK-NOSUPP: expected string not found in input
# | // CHECK-NOSUPP: WARNING: ThreadSanitizer: data race
# | ^
# | <stdin>:1:1: note: scanning from here
# | /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp: error while loading shared libraries: libignore_lib0.so: cannot open shared object file: No such file or directory
# | ^
# | <stdin>:1:156: note: possible intended match here
# | /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp: error while loading shared libraries: libignore_lib0.so: cannot open shared object file: No such file or directory
# | ^
# | 
# | Input file: <stdin>
# | Check file: /usr/local/google/home/harinidonthula/llvm-project/compiler-rt/test/tsan/ignore_lib0.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: /usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/tsan/X86_64Config/Output/ignore_lib0.cpp.tmp: error while loading shared libraries: libignore_lib0.so: cannot open shared object file: No such file or directory 
# | check:35'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | check:35'1 ? possible intended match
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************

```

Steps to reproduce:
1. CMAKE config: 
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;llvm;clang-tools-extra;lld;lldb;bolt;mlir;libclc;polly" -DLLVM_ENABLE_RUNTIMES="compiler-rt;libc;libcxx;libunwind;libcxxabi" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -B build -S .
2. Using the following commands to test each subproject using the lit internal shell
`LIT_USE_INTERNAL_SHELL=1 ninja check-clang`
`LIT_USE_INTERNAL_SHELL=1 ninja check-compiler-rt`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsG9ty4rjya5SXLlEgc33IA9cdzjAkFciZ2SdKtgXWjmy5JDlhzsP59i3J3EMITJhJsovLIdi69L3VLVpUaz5LGLtGlRaqdK5oZiKprj9RxRNebJDylS_DH9dfI5aAYdrwZAaP3ERgIgaCG-CJYSqhAnTEhADNHpiiwvXVwBNoC5rMgCYhBDJOuWAKKwNTykU-DyKkO09ZYFgI2ig7fyINTGWWhHY8T9LMIEKAKSWVLkBPKmBzGqeCIa-Jih1UbDogqydULS5u99hr9gfIay4wsb28JjRv-0NpmEak94PGAisLzyieFizmgEi9VAU5BVKslouINPKpunNuoC1DCxlKC2g5BjKOLZE3mUkzN16bUFrMGyu8MF6MIB7c3Q_tHNSA4AkDkrdYykM-nQL2AZFephUiPSEDKhDpzaScCYZIL5Kx--dkFMrERJmgtqN4iHGq5F8sMIj0AscU0rMEIdLboLhveWq_9BSN2aNU3-3DiFueFqbLd4j0PjEaMrXRSFOe2Elej52fcRFa7KQU-iC2OUv3C6pg4rSgmM6EAVRrnw8tnyeWP1ywdsSC779SGnvIWusJm7Mgs7YR5ApmleaiJT-vJYc5-49TnwLGeEEfaBMypfDGte53Fts5DUevWSohr1m3fHe-3fnoT932Z_fm5TVhC_nVwFpQ3yGr0t154bW1CXmCvK5FYvFnITi3rgOaJBbkVMkYIqbYLpua-f2-be90JmxxIZVac18wt74nIQshpiaI_in8WF-7nNnu5-DClLtYY4tp29rnjHzV7Y2M_Qn2OMziFOfW4nUiJlJrV4LyRLv4bSqFkI9W110fsN0LL3Ljkep1qLVWp937GX4DlHIefQitgW0yAivn3FZIrQjf_v8errX3TOTCSp2nPIB6Cb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