Debian Codegraph @

offload/unittests/OffloadAPI/program/olCreateProgram.cpp

raw
1 //===------- Offload API tests - olCreateProgram --------------------------===//
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 #include "../common/Fixtures.hpp"
10 #include <OffloadAPI.h>
11 #include <gtest/gtest.h>
12
13 using olCreateProgramTest = OffloadDeviceTest;
14 OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olCreateProgramTest);
15
16 TEST_P(olCreateProgramTest, Success) {
17
18 std::unique_ptr<llvm::MemoryBuffer> DeviceBin;
19 ASSERT_TRUE(TestEnvironment::loadDeviceBinary("foo", Device, DeviceBin));
20 ASSERT_GE(DeviceBin->getBufferSize(), 0lu);
21
22 ol_program_handle_t Program;
23 ASSERT_SUCCESS(olCreateProgram(Device, DeviceBin->getBufferStart(),
24 DeviceBin->getBufferSize(), &Program));
25 ASSERT_NE(Program, nullptr);
26
27 ASSERT_SUCCESS(olDestroyProgram(Program));
28 }