[llvm] [Offload] Add check-offload-unit for liboffload unittests (PR #137312)

Callum Fare via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 06:33:46 PDT 2025


================
@@ -65,6 +65,13 @@ ol_device_handle_t TestEnvironment::getDevice() {
   static ol_device_handle_t Device = nullptr;
 
   if (!Device) {
+    if (const char *EnvStr = getenv("OFFLOAD_UNITTEST_PLATFORM")) {
----------------
callumfare wrote:

It's definitely possible, it would require all tests being parameterized on the device, which wouldn't be a massive change.

One reason I added the explicit option was to avoid it auto selecting the host plugin, which is basically unsupported at this point. But I could make sure that the test environment filters it out of the device list, or even just filter it out at the liboffload implementation level since it's not really usable for anything just now.

Another reason was to allow the `check-offload-unit` tests to be broken down into a test suite config for each available platform (`check-offload-unit-cuda` etc), in the same way `check-offload`/`check-libomptarget` has sub-targets for every configuration. I feel like it's a little bit easier to parse what's actually being tested rather than one test suite that runs on a variable number of configurations.

I don't have strong feelings about it though so I'm happy to make the change if you want.

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


More information about the llvm-commits mailing list