Skip to content

Commit

Permalink
Address feedback: CTS environment error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig committed Jul 18, 2023
1 parent f8d6182 commit 7e1c90b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions test/conformance/source/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,21 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv)
instance = this;

ur_loader_config_handle_t config;
urLoaderConfigCreate(&config);
urLoaderConfigEnableLayer(config, "UR_LAYER_FULL_VALIDATION");
if (urLoaderConfigCreate(&config) == UR_RESULT_SUCCESS) {
if (urLoaderConfigEnableLayer(config, "UR_LAYER_FULL_VALIDATION")) {
urLoaderConfigRelease(config);
error = "Failed to enable validation layer";
return;
}
} else {
error = "Failed to create loader config handle";
return;
}

ur_device_init_flags_t device_flags = 0;
switch (urInit(device_flags, config)) {
auto initResult = urInit(device_flags, config);
auto configReleaseResult = urLoaderConfigRelease(config);
switch (initResult) {
case UR_RESULT_SUCCESS:
break;
case UR_RESULT_ERROR_UNINITIALIZED:
Expand All @@ -59,7 +69,11 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv)
error = "urInit() failed";
return;
}
urLoaderConfigRelease(config);

if (configReleaseResult) {
error = "Failed to destroy loader config handle";
return;
}

uint32_t count = 0;
if (urPlatformGet(0, nullptr, &count)) {
Expand Down

0 comments on commit 7e1c90b

Please sign in to comment.