From d07f1c1729a14a6789c063ec56dedff2a4ac447a Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 24 Jan 2024 12:29:57 +0000 Subject: [PATCH] [CTS] Fix uninitialized variables --- test/conformance/device/urDevicePartition.cpp | 6 +++--- test/conformance/device/urDeviceRelease.cpp | 2 +- test/conformance/device/urDeviceRetain.cpp | 2 +- test/conformance/event/urEventWait.cpp | 2 +- test/conformance/memory/urMemImageGetInfo.cpp | 2 +- test/conformance/source/environment.cpp | 4 ++-- test/conformance/testing/include/uur/environment.h | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/conformance/device/urDevicePartition.cpp b/test/conformance/device/urDevicePartition.cpp index 380c4f1952..c4c992e06a 100644 --- a/test/conformance/device/urDevicePartition.cpp +++ b/test/conformance/device/urDevicePartition.cpp @@ -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); @@ -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()); @@ -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); diff --git a/test/conformance/device/urDeviceRelease.cpp b/test/conformance/device/urDeviceRelease.cpp index 3b5e74a575..e04928383d 100644 --- a/test/conformance/device/urDeviceRelease.cpp +++ b/test/conformance/device/urDeviceRelease.cpp @@ -42,7 +42,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)); diff --git a/test/conformance/device/urDeviceRetain.cpp b/test/conformance/device/urDeviceRetain.cpp index 77a9c58b79..7976c3d66e 100644 --- a/test/conformance/device/urDeviceRetain.cpp +++ b/test/conformance/device/urDeviceRetain.cpp @@ -42,7 +42,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)); diff --git a/test/conformance/event/urEventWait.cpp b/test/conformance/event/urEventWait.cpp index ec858aff2e..c226c497a4 100644 --- a/test/conformance/event/urEventWait.cpp +++ b/test/conformance/event/urEventWait.cpp @@ -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)); } diff --git a/test/conformance/memory/urMemImageGetInfo.cpp b/test/conformance/memory/urMemImageGetInfo.cpp index 48e6d6274f..ae85720220 100644 --- a/test/conformance/memory/urMemImageGetInfo.cpp +++ b/test/conformance/memory/urMemImageGetInfo.cpp @@ -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); diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 11a8b501a8..c72cded5ad 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -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"))) { @@ -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"))) { diff --git a/test/conformance/testing/include/uur/environment.h b/test/conformance/testing/include/uur/environment.h index 551be76e17..5f930fc62e 100644 --- a/test/conformance/testing/include/uur/environment.h +++ b/test/conformance/testing/include/uur/environment.h @@ -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); @@ -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);