File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
offload/unittests/OffloadAPI Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ add_offload_unittest("event"
1212 event/olDestroyEvent.cpp
1313 event/olWaitEvent.cpp)
1414
15+ add_offload_unittest("init"
16+ init/olInit.cpp)
17+ target_compile_definitions ("init.unittests" PRIVATE DISABLE_WRAPPER)
18+
1519add_offload_unittest("kernel"
1620 kernel/olGetKernel.cpp
1721 kernel/olLaunchKernel.cpp)
Original file line number Diff line number Diff line change @@ -17,11 +17,13 @@ using namespace llvm;
1717
1818// Wrapper so we don't have to constantly init and shutdown Offload in every
1919// test, while having sensible lifetime for the platform environment
20+ #ifndef DISABLE_WRAPPER
2021struct OffloadInitWrapper {
2122 OffloadInitWrapper () { olInit (); }
2223 ~OffloadInitWrapper () { olShutDown (); }
2324};
2425static OffloadInitWrapper Wrapper{};
26+ #endif
2527
2628static cl::opt<std::string>
2729 SelectedPlatform (" platform" , cl::desc(" Only test the specified platform" ),
Original file line number Diff line number Diff line change 1+ // ===------- Offload API tests - olInit -----------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ // NOTE: For this test suite, the implicit olInit/olShutDown doesn't happen, so
10+ // tests have to do it themselves
11+
12+ #include " ../common/Fixtures.hpp"
13+ #include < OffloadAPI.h>
14+ #include < gtest/gtest.h>
15+
16+ struct olInitTest : ::testing::Test {};
17+
18+ TEST_F (olInitTest, Uninitialized) {
19+ ASSERT_ERROR (OL_ERRC_UNINITIALIZED,
20+ olIterateDevices (
21+ [](ol_device_handle_t , void *) { return false ; }, nullptr ));
22+ }
You can’t perform that action at this time.
0 commit comments