[lld] [Support] Better error msg when cache dir can't be created. (PR #69575)

Tobias Hieta via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 01:41:55 PDT 2023


tru wrote:

I pushed a test, but it's not yet working 100% - I am struggling with this a bit. It seems since we are "dying" of report_fatal_error the normal `not <cmd>` construct is not working, lit still seems to think it has failed.

<details>
<summary>Lit output</summary>
```
➜ bin/llvm-lit -sa ../lld/test/COFF/lto-cache-errors.ll
llvm-lit: /home/tobias/code/llvm-project/llvm/utils/lit/lit/llvm/config.py:487: note: using ld.lld: /home/tobias/code/llvm-project/build/bin/ld.lld
llvm-lit: /home/tobias/code/llvm-project/llvm/utils/lit/lit/llvm/config.py:487: note: using lld-link: /home/tobias/code/llvm-project/build/bin/lld-link
llvm-lit: /home/tobias/code/llvm-project/llvm/utils/lit/lit/llvm/config.py:487: note: using ld64.lld: /home/tobias/code/llvm-project/build/bin/ld64.lld
llvm-lit: /home/tobias/code/llvm-project/llvm/utils/lit/lit/llvm/config.py:487: note: using wasm-ld: /home/tobias/code/llvm-project/build/bin/wasm-ld
FAIL: lld :: COFF/lto-cache-errors.ll (1 of 1)
******************** TEST 'lld :: COFF/lto-cache-errors.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 3: /home/tobias/code/llvm-project/build/bin/opt -module-hash -module-summary /home/tobias/code/llvm-project/lld/test/COFF/lto-cache-errors.ll -o /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.o
+ /home/tobias/code/llvm-project/build/bin/opt -module-hash -module-summary /home/tobias/code/llvm-project/lld/test/COFF/lto-cache-errors.ll -o /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.o
RUN: at line 4: /home/tobias/code/llvm-project/build/bin/opt -module-hash -module-summary /home/tobias/code/llvm-project/lld/test/COFF/Inputs/lto-cache.ll -o /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp2.o
+ /home/tobias/code/llvm-project/build/bin/opt -module-hash -module-summary /home/tobias/code/llvm-project/lld/test/COFF/Inputs/lto-cache.ll -o /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp2.o
RUN: at line 5: rm -Rf /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache && mkdir /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache
+ rm -Rf /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache
+ mkdir /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache
RUN: at line 6: chmod 444 /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache
+ chmod 444 /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache
RUN: at line 9: not /home/tobias/code/llvm-project/build/bin/lld-link /lldltocache:/home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache/cache /out:/home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp3 /entry:main /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp2.o /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.o 2>&1 | /home/tobias/code/llvm-project/build/bin/FileCheck /home/tobias/code/llvm-project/lld/test/COFF/lto-cache-errors.ll
+ not /home/tobias/code/llvm-project/build/bin/lld-link /lldltocache:/home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.cache/cache /out:/home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp3 /entry:main /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp2.o /home/tobias/code/llvm-project/build/tools/lld/test/COFF/Output/lto-cache-errors.ll.tmp.o
+ /home/tobias/code/llvm-project/build/bin/FileCheck /home/tobias/code/llvm-project/lld/test/COFF/lto-cache-errors.ll

--

********************
********************
Failed Tests (1):
  lld :: COFF/lto-cache-errors.ll


Testing Time: 0.12s
  Failed: 1
```
</details>

Another thing that bothered me is that the method of setting the permissions of the directory to make it fail only works on Linux, this this would have to be disabled on Windows and I was not able to find any prior art for how to handle this.

https://github.com/llvm/llvm-project/pull/69575


More information about the llvm-commits mailing list