[PATCH] D83055: [clang][Driver] Fix tool path priority test failures
Steven Wan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 10 11:19:16 PDT 2020
stevewan added inline comments.
================
Comment at: clang/test/Driver/program-path-priority.c:117
+/// Check file exists first in case $DEFAULT_TRIPLE == %target_triple
+// RUN: file -E %t/$DEFAULT_TRIPLE-gcc 2>&1 > /dev/null && \
+// RUN: mv %t/$DEFAULT_TRIPLE-gcc %t/prefix || true
----------------
DavidSpickett wrote:
> stevewan wrote:
> > Maybe I'm not seeing something obvious here, but I'm not aware of the `file -E` usage, and on Linux I got `file: invalid option -- 'E'`.
> I was looking for a way to mimic [! -f <file>], which worked on the command line but not in a test. From my system's file:
> -E On filesystem errors (file not found etc), instead of handling the error as regu‐
> lar output as POSIX mandates and keep going, issue an error message and exit.
>
> I didn't realise it was non-standard, so I've switched to mv || true with the error redirected so it won't confuse the verbose output.
I believe having just `mv || true` works, but I did like the idea of pre-checking for the existence of the file, and the test is more robust with the check. Is there a reason we wouldn't use `test -f` here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83055/new/
https://reviews.llvm.org/D83055
More information about the cfe-commits
mailing list