When testing clang that has been compiled with -DDEFAULT_SYSROOT set to some path,
some tests would fail. Override sysroot to be empty string for the tests to succeed when clang is configured with DEFAULT_SYSROOT.
Details
- Reviewers
rsmith sfantao sepavloff compnerd - Commits
- rG4bc056271992: Driver tests: set `--sysroot=""` to support clang with `DEFAULT_SYSROOT`
rC373147: Driver tests: set `--sysroot=""` to support clang with `DEFAULT_SYSROOT`
rL373147: Driver tests: set `--sysroot=""` to support clang with `DEFAULT_SYSROOT`
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 37544 Build 37543: arc lint + arc unit
Event Timeline
Add --sysroot="" to some driver regression tests
These tests otherwise fail if clang is configured with DEFAULT_SYSROOT.
I think that this is pretty easy to forget. Fortunately, last argument wins. Why not sink this into the %clang substitution in lit? That ensures that we run with an empty sysroot and then when the test needs to adjust the sysroot, it can do so explicitly.
This totally makes sense.
I've just tried to do it, but unfortunately some tests are failing, for example, Driver/cc1-response-files.c. The problem is that %clang is expanded to /path/to/clang --sysroot=, but the succeeding flags (such as -cc1) may be incompatible with --sysroot.
Or am I missing something?
Does the issue manifests itself with -cc1 only? We usually use %clang_cc1 in such cases, so probably those tests require update.
Some Driver tests take a list of arguments from a file (for example clang/test/Driver/cc1-response-files.c), so we probably cannot use %clang_cc1 there
The obvious solution in this case is to implement support of an environment variable, say SYSROOT or CLANG_SYSROOT, which would override hard-coded path (but not that specified by --sysroot option). Unfortunately some developers don't like use of environment variables, as it creates 'secret' control channel, and such patch would have high chance to be rejected. So probably this is all we can do here.
This patch looks good for me.