From 5fc57c113338d63e4174837d314a86bf27747430 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Tue, 12 Mar 2024 11:34:56 +0000 Subject: [PATCH] [CTS] Don't segfault when failing to load a kernel 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. --- test/conformance/testing/include/uur/fixtures.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index cf01015eb4..18768c8419 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -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)); @@ -1050,8 +1051,9 @@ std::string deviceTestWithParamPrinter( 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)); } @@ -1071,8 +1073,9 @@ struct urProgramTest : urQueueTest { template struct urProgramTestWithParam : urContextTestWithParam { void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE(urContextTestWithParam::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)); }