[libclc] [libclc] Add initial LIT tests (PR #87989)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 17 08:05:00 PDT 2024
================
@@ -1,3 +1,6 @@
-__kernel void foo(int *i) {
+// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s
----------------
frasercrmck wrote:
I wasn't so much thinking that it would pretend to be generic, but rather that it'd use a custom test format (something like [analyzer_test.py](https://github.com/llvm/llvm-project/blob/main/clang/test/Analysis/analyzer_test.py)) to run the test once for each target we build/test, substituting in the target triple and target-specific check prefix each time.
That way we could test all or a subset of all targets without worrying about the test failing on a target we haven't built.
In that sense these are a little different to clang codegen tests - aren't they? clang can always compile for any of its supported targets. With libclc, however, the user is allowed to build only a handful of the targets, and each of those targets can have drastically different builtin implementations through specialization.
We don't want the tests to fail if the user hasn't built certain targets, so I think we need some kind of configuration that allows tests to be skipped. But `update_cc_test_checks` doesn't handle features or `%if` or anything dynamic like that. It's really only suitable for the simplest of clang tests. So if we wanted to have each test file run on multiple targets, I think `update_cc_test_checks` could only be used if the user built all libclc targets, and each test had one `RUN` line for each target. I think we have ten targets so it might get a bit unwieldy, is all I'm saying. I do want us to be able to use that script as it's by far the best way of maintaining tests that we've got.
https://github.com/llvm/llvm-project/pull/87989
More information about the cfe-commits
mailing list