[PATCH] D83055: [clang][Driver] Fix tool path priority test failures
David Spickett via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 13 01:37:18 PDT 2020
DavidSpickett marked 2 inline comments as done.
DavidSpickett 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
----------------
stevewan wrote:
> 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?
Honestly it slipped my mind that [ ] was the same as test. Updated to test && move || true which you're right is clearer.
(one will always fail if the two triples are the same but at least we're only hiding the error we expect, rather than all errors mv could have)
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