Skip to content

Commit d07f1c1

Browse files
committed
[CTS] Fix uninitialized variables
1 parent 5b3750d commit d07f1c1

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

test/conformance/device/urDevicePartition.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TEST_F(urDevicePartitionTest, PartitionEquallySuccess) {
4242
};
4343

4444
// Get the number of devices that will be created
45-
uint32_t n_devices;
45+
uint32_t n_devices = 0;
4646
ASSERT_SUCCESS(
4747
urDevicePartition(device, &properties, 0, nullptr, &n_devices));
4848
ASSERT_NE(n_devices, 0);
@@ -125,7 +125,7 @@ TEST_F(urDevicePartitionTest, PartitionByCounts) {
125125
};
126126

127127
// Get the number of devices that will be created
128-
uint32_t n_devices;
128+
uint32_t n_devices = 0;
129129
ASSERT_SUCCESS(
130130
urDevicePartition(device, &properties, 0, nullptr, &n_devices));
131131
ASSERT_EQ(n_devices, property_list.size());
@@ -267,7 +267,7 @@ TEST_F(urDevicePartitionTest, SuccessSubSet) {
267267
};
268268

269269
// Get the number of devices that will be created
270-
uint32_t n_devices;
270+
uint32_t n_devices = 0;
271271
ASSERT_SUCCESS(
272272
urDevicePartition(device, &properties, 0, nullptr, &n_devices));
273273
ASSERT_NE(n_devices, 0);

test/conformance/device/urDeviceRelease.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TEST_F(urDeviceReleaseTest, SuccessSubdevices) {
4242
1,
4343
};
4444

45-
ur_device_handle_t sub_device;
45+
ur_device_handle_t sub_device = nullptr;
4646
ASSERT_SUCCESS(
4747
urDevicePartition(device, &properties, 1, &sub_device, nullptr));
4848

test/conformance/device/urDeviceRetain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TEST_F(urDeviceRetainTest, SuccessSubdevices) {
4242
1,
4343
};
4444

45-
ur_device_handle_t sub_device;
45+
ur_device_handle_t sub_device = nullptr;
4646
ASSERT_SUCCESS(
4747
urDevicePartition(device, &properties, 1, &sub_device, nullptr));
4848

test/conformance/event/urEventWait.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ using urEventWaitNegativeTest = uur::urQueueTest;
6464
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEventWaitNegativeTest);
6565

6666
TEST_P(urEventWaitNegativeTest, ZeroSize) {
67-
ur_event_handle_t event;
67+
ur_event_handle_t event = nullptr;
6868
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_VALUE, urEventWait(0, &event));
6969
}
7070

test/conformance/memory/urMemImageGetInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ UUR_TEST_SUITE_P(urMemImageGetInfoTest,
2727

2828
TEST_P(urMemImageGetInfoTest, Success) {
2929
ur_image_info_t info = getParam();
30-
size_t size;
30+
size_t size = 0;
3131
ASSERT_SUCCESS(urMemImageGetInfo(image, info, 0, nullptr, &size));
3232
ASSERT_NE(size, 0);
3333

test/conformance/source/environment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void uur::PlatformEnvironment::TearDown() {
188188

189189
PlatformEnvironment::PlatformOptions
190190
PlatformEnvironment::parsePlatformOptions(int argc, char **argv) {
191-
PlatformOptions options;
191+
PlatformOptions options{};
192192
for (int argi = 1; argi < argc; ++argi) {
193193
const char *arg = argv[argi];
194194
if (!(std::strcmp(arg, "-h") && std::strcmp(arg, "--help"))) {
@@ -219,7 +219,7 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) {
219219

220220
DevicesEnvironment::DeviceOptions
221221
DevicesEnvironment::parseDeviceOptions(int argc, char **argv) {
222-
DeviceOptions options;
222+
DeviceOptions options{};
223223
for (int argi = 1; argi < argc; ++argi) {
224224
const char *arg = argv[argi];
225225
if (!(std::strcmp(arg, "-h") && std::strcmp(arg, "--help"))) {

test/conformance/testing/include/uur/environment.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct PlatformEnvironment : ::testing::Environment {
1717

1818
struct PlatformOptions {
1919
std::string platform_name;
20-
unsigned long platforms_count;
20+
unsigned long platforms_count = 0;
2121
};
2222

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

4040
struct DeviceOptions {
4141
std::string device_name;
42-
unsigned long devices_count;
42+
unsigned long devices_count = 0;
4343
};
4444

4545
DevicesEnvironment(int argc, char **argv);

0 commit comments

Comments
 (0)