[Offload] Use new error code handling mechanism This removes the old ErrorCode-less error method and requires every user to provide a concrete error code. All calls have been updated. In addition, for consistency with error messages elsewhere in LLVM, all messages have been made to start lower case.
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
//===------- Offload API tests - olGetKernel ---------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "../common/Fixtures.hpp"
|
|
#include <OffloadAPI.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
using olGetKernelTest = OffloadProgramTest;
|
|
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olGetKernelTest);
|
|
|
|
TEST_P(olGetKernelTest, Success) {
|
|
ol_kernel_handle_t Kernel = nullptr;
|
|
ASSERT_SUCCESS(olGetKernel(Program, "foo", &Kernel));
|
|
ASSERT_NE(Kernel, nullptr);
|
|
}
|
|
|
|
TEST_P(olGetKernelTest, InvalidNullProgram) {
|
|
ol_kernel_handle_t Kernel = nullptr;
|
|
ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE,
|
|
olGetKernel(nullptr, "foo", &Kernel));
|
|
}
|
|
|
|
TEST_P(olGetKernelTest, InvalidNullKernelPointer) {
|
|
ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER,
|
|
olGetKernel(Program, "foo", nullptr));
|
|
}
|
|
|
|
// Error code returning from plugin interface not yet supported
|
|
TEST_P(olGetKernelTest, InvalidKernelName) {
|
|
ol_kernel_handle_t Kernel = nullptr;
|
|
ASSERT_ERROR(OL_ERRC_NOT_FOUND,
|
|
olGetKernel(Program, "invalid_kernel_name", &Kernel));
|
|
}
|