Skip to content

Commit

Permalink
Fix fuzz test failing to create a device
Browse files Browse the repository at this point in the history
Changes from #019551c in urDeviceGet validation resulted in a failure to create devices successfully in fuzz tests.
  • Loading branch information
PatKamin committed Feb 15, 2024
1 parent f11823e commit 918b0aa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/fuzz/urFuzz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ int ur_device_get(TestState &state) {
return -1;
}

ur_result_t res = urDeviceGet(state.platforms[state.platform_num],
state.device_type, state.num_entries,
state.devices.data(), &state.num_devices);
ur_result_t res = UR_RESULT_SUCCESS;
if (state.devices.size() == 0) {
res = urDeviceGet(state.platforms[state.platform_num],
state.device_type, 0, nullptr, &state.num_devices);
state.devices.resize(state.num_devices);
} else {
res =
urDeviceGet(state.platforms[state.platform_num], state.device_type,
state.num_entries, state.devices.data(), nullptr);
}
if (res != UR_RESULT_SUCCESS) {
return -1;
}
if (state.devices.size() != state.num_devices) {
state.devices.resize(state.num_devices);
}

return 0;
}
Expand Down

0 comments on commit 918b0aa

Please sign in to comment.