Skip to content

Commit

Permalink
Merge pull request #1278 from kbenzie/benie/cts-fix-uninit
Browse files Browse the repository at this point in the history
[CTS] Fix uninitialized variables
  • Loading branch information
kbenzie authored Jan 30, 2024
2 parents 3225b82 + d07f1c1 commit 96cc58d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions test/conformance/device/urDevicePartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST_F(urDevicePartitionTest, PartitionEquallySuccess) {
};

// Get the number of devices that will be created
uint32_t n_devices;
uint32_t n_devices = 0;
ASSERT_SUCCESS(
urDevicePartition(device, &properties, 0, nullptr, &n_devices));
ASSERT_NE(n_devices, 0);
Expand Down Expand Up @@ -125,7 +125,7 @@ TEST_F(urDevicePartitionTest, PartitionByCounts) {
};

// Get the number of devices that will be created
uint32_t n_devices;
uint32_t n_devices = 0;
ASSERT_SUCCESS(
urDevicePartition(device, &properties, 0, nullptr, &n_devices));
ASSERT_EQ(n_devices, property_list.size());
Expand Down Expand Up @@ -267,7 +267,7 @@ TEST_F(urDevicePartitionTest, SuccessSubSet) {
};

// Get the number of devices that will be created
uint32_t n_devices;
uint32_t n_devices = 0;
ASSERT_SUCCESS(
urDevicePartition(device, &properties, 0, nullptr, &n_devices));
ASSERT_NE(n_devices, 0);
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/device/urDeviceRelease.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST_F(urDeviceReleaseTest, SuccessSubdevices) {
1,
};

ur_device_handle_t sub_device;
ur_device_handle_t sub_device = nullptr;
ASSERT_SUCCESS(
urDevicePartition(device, &properties, 1, &sub_device, nullptr));

Expand Down
2 changes: 1 addition & 1 deletion test/conformance/device/urDeviceRetain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST_F(urDeviceRetainTest, SuccessSubdevices) {
1,
};

ur_device_handle_t sub_device;
ur_device_handle_t sub_device = nullptr;
ASSERT_SUCCESS(
urDevicePartition(device, &properties, 1, &sub_device, nullptr));

Expand Down
2 changes: 1 addition & 1 deletion test/conformance/event/urEventWait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ using urEventWaitNegativeTest = uur::urQueueTest;
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEventWaitNegativeTest);

TEST_P(urEventWaitNegativeTest, ZeroSize) {
ur_event_handle_t event;
ur_event_handle_t event = nullptr;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_VALUE, urEventWait(0, &event));
}

Expand Down
2 changes: 1 addition & 1 deletion test/conformance/memory/urMemImageGetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ UUR_TEST_SUITE_P(urMemImageGetInfoTest,

TEST_P(urMemImageGetInfoTest, Success) {
ur_image_info_t info = getParam();
size_t size;
size_t size = 0;
ASSERT_SUCCESS(urMemImageGetInfo(image, info, 0, nullptr, &size));
ASSERT_NE(size, 0);

Expand Down
4 changes: 2 additions & 2 deletions test/conformance/source/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void uur::PlatformEnvironment::TearDown() {

PlatformEnvironment::PlatformOptions
PlatformEnvironment::parsePlatformOptions(int argc, char **argv) {
PlatformOptions options;
PlatformOptions options{};
for (int argi = 1; argi < argc; ++argi) {
const char *arg = argv[argi];
if (!(std::strcmp(arg, "-h") && std::strcmp(arg, "--help"))) {
Expand Down Expand Up @@ -219,7 +219,7 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) {

DevicesEnvironment::DeviceOptions
DevicesEnvironment::parseDeviceOptions(int argc, char **argv) {
DeviceOptions options;
DeviceOptions options{};
for (int argi = 1; argi < argc; ++argi) {
const char *arg = argv[argi];
if (!(std::strcmp(arg, "-h") && std::strcmp(arg, "--help"))) {
Expand Down
4 changes: 2 additions & 2 deletions test/conformance/testing/include/uur/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct PlatformEnvironment : ::testing::Environment {

struct PlatformOptions {
std::string platform_name;
unsigned long platforms_count;
unsigned long platforms_count = 0;
};

PlatformEnvironment(int argc, char **argv);
Expand All @@ -39,7 +39,7 @@ struct DevicesEnvironment : PlatformEnvironment {

struct DeviceOptions {
std::string device_name;
unsigned long devices_count;
unsigned long devices_count = 0;
};

DevicesEnvironment(int argc, char **argv);
Expand Down

0 comments on commit 96cc58d

Please sign in to comment.