[clang] [Clang] [Driver] add a Cygwin ToolChain (PR #135691)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 22 16:34:58 PDT 2025
jeremyd2019 wrote:
> > I don't have experience with llvm's test suite though, but if it's just a matter of adding additional cases to existing tests or maybe copying some existing tests I might be OK figuring it out.
>
> Yeah it's usually not that hard to figure out. A couple general pointers:
>
> * You can run all tests with `ninja check-clang` or so, but if working on one single test, it's much faster to run e.g. `bin/llvm-lit -a ../clang/test/Driver/mytest.c` to only run one single test, or `bin/llvm-lit -sv ../clang/test/Driver` to run one subdirectory
> * The general philosophy of tests within Clang and LLVM is to test the minimal scope at each level. Initially, it may feel more intuitive to test the driver by e.g. actually trying to compile something, but such a test only works if you actually have the full environment available. But in Clang/LLVM, as many tests as possible are desired to be runnable on any host, without any dependencies. So e.g. a Clang codegen test takes a minimal selfcontained `.c` input and produces LLVM IR (which can be done on any host), a Clang driver test mostly runs with `-###` to check which `-cc1` command flags would be prouduced for that. If necessary, it may set up a mock sysroot and try to make Clang use that; some such tests rely on symlinking (and such tests may only be usable on Unix or other systems where symlinks generally are usable) - some of the mingw driver tests do that.
> * As this is a new driver, I guess it'd be fine to just start out with some very minimal test, trying to compile, `clang -### -c ...` and link `clang -### foo.o -o foo.exe` and inspect some minimal detail in them.
> * As a general rule, in Clang/LLVM, every functional change must be accompanied by a test change/update to cover what is being changed. (As an exception, if the test relies on tricky environmental factors it may be ok to go without a testcase, but if possible to mock the environment, that's preferred.)
I figure I'll try starting with Hurd again, since I started with their ToolChain cpp :grin:. It looks like a pretty simple Inputs/basic_cygwin_tree and maybe Inputs/basic_cross_cygwin_tree would be in order.
https://github.com/llvm/llvm-project/pull/135691
More information about the cfe-commits
mailing list