[clang] [Clang][Driver][Test] Created test for unsupported driver options (PR #120900)

Mészáros Gergely via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 26 03:45:42 PST 2025


Maetveis wrote:

> Hi @Maetveis . This is ready for review.
> 
> There are a few things that I came across while making the script that I should highlight :
> 
>     1. clang -cc1 test directory
> 
> 
> [test/Driver/lit.local.cfg](https://github.com/llvm/llvm-project/blob/e10d551aa482ee185a80216b2670a2947a8bdeb0/clang/test/Driver/lit.local.cfg#L27) says, '_("%clang_cc1", """*** Do not use 'clang -cc1' in Driver tests. ***""")_', yet I see various tests in that directory that do so, like [linker-wrapper.c](https://github.com/llvm/llvm-project/blob/e10d551aa482ee185a80216b2670a2947a8bdeb0/clang/test/Driver/linker-wrapper.c#L10). If there's no opposition, I'll leave the cc1 tests in the main Lit test file, Driver/unsupported_in_drivermode.c.

I think this should be fine, but we'll see if other reviewers disagree.

> 
>     2. flang vs flang -fc1
> 
> 
> As per [clang/test/Driver/flang/flang.f90](https://github.com/llvm/llvm-project/blob/e10d551aa482ee185a80216b2670a2947a8bdeb0/clang/test/Driver/flang/flang.f90#L1), "flang -fc1 is invoked when in --driver-mode=flang", so I disabled the plain flang tests since there's no distinction.

I don't think that comment means that `flang` and `flang -fc1` take the same options, the test is verifying that the driver (plain `flang`) calls the backend compiler (`flang -fc1`), but the supported options are not going to be the same between these two. 

> I disabled the tests on Windows given the following recursion error that occurs on Windows regression machines.

I think this might be caused by the sheer amount of `RUN:` lines in the generated test, I have an idea on how to fix it, that would also make the test faster to run. I'll post it as part of the review.


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


More information about the cfe-commits mailing list