Skip to content

Commit

Permalink
[CTS] Don't segfault when failing to load a kernel
Browse files Browse the repository at this point in the history
If LoadSource fails, we don't exit immediately and continue running
the test. This then attempts to dereference a null shared pointer
and segfaults.

This by itself won't fix buggy test environments, but will make it
so that they fail the test with a sensible message rather than
crashing everything.
  • Loading branch information
RossBrunton committed Mar 12, 2024
1 parent 1f6cbe6 commit 5fc57c1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/conformance/testing/include/uur/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ struct urQueueTest : urContextTest {
struct urHostPipeTest : urQueueTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
uur::KernelsEnvironment::instance->LoadSource("foo", 0, il_binary);
UUR_RETURN_ON_FATAL_FAILURE(
uur::KernelsEnvironment::instance->LoadSource("foo", 0, il_binary));
ASSERT_SUCCESS(uur::KernelsEnvironment::instance->CreateProgram(
platform, context, device, *il_binary, &program));

Expand Down Expand Up @@ -1050,8 +1051,9 @@ std::string deviceTestWithParamPrinter<BoolTestParam>(
struct urProgramTest : urQueueTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
uur::KernelsEnvironment::instance->LoadSource(program_name, 0,
il_binary);
UUR_RETURN_ON_FATAL_FAILURE(
uur::KernelsEnvironment::instance->LoadSource(program_name, 0,
il_binary));
ASSERT_SUCCESS(uur::KernelsEnvironment::instance->CreateProgram(
platform, context, device, *il_binary, &program));
}
Expand All @@ -1071,8 +1073,9 @@ struct urProgramTest : urQueueTest {
template <class T> struct urProgramTestWithParam : urContextTestWithParam<T> {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urContextTestWithParam<T>::SetUp());
uur::KernelsEnvironment::instance->LoadSource(program_name, 0,
il_binary);
UUR_RETURN_ON_FATAL_FAILURE(
uur::KernelsEnvironment::instance->LoadSource(program_name, 0,
il_binary));
ASSERT_SUCCESS(uur::KernelsEnvironment::instance->CreateProgram(
this->platform, this->context, this->device, *il_binary, &program));
}
Expand Down

0 comments on commit 5fc57c1

Please sign in to comment.