@@ -19,7 +19,6 @@ namespace {
1919TEST (SysmanInitTests,
2020 GivenSuccessfulSysmanInitWhenzesDeviceGetReturnsValidDevicesThenSurvivabilityModeIsOffIsDetected) {
2121
22- // Initialize Sysman and get devices
2322 ze_result_t result = zesInit (0 );
2423 ASSERT_EQ (result, ZE_RESULT_SUCCESS);
2524 uint32_t zes_driver_count = 0 ;
@@ -41,7 +40,6 @@ TEST(SysmanInitTests,
4140 ASSERT_EQ (result, ZE_RESULT_SUCCESS);
4241
4342 for (auto device : devices) {
44- // Check that zesDeviceGetProperties is successful for all device handles
4543 zes_device_properties_t properties = {ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES
4644 , nullptr };
4745 result = zesDeviceGetProperties (device, &properties);
@@ -50,4 +48,59 @@ TEST(SysmanInitTests,
5048 }
5149}
5250
51+ TEST (SysmanInitTests,
52+ GivenSysmanInitWhenzesDeviceGetPropertiesReturnsSurvivabilityDetectedErrorThenOnlyFormwareAPIsSucceed) {
53+
54+ ze_result_t result = zesInit (0 );
55+ ASSERT_EQ (result, ZE_RESULT_SUCCESS);
56+ uint32_t zes_driver_count = 0 ;
57+ EXPECT_EQ (ZE_RESULT_SUCCESS, zesDriverGet (&zes_driver_count, nullptr ));
58+ EXPECT_GT (zes_driver_count, 0 );
59+ std::vector<zes_driver_handle_t > drivers (zes_driver_count);
60+ result = zesDriverGet (&zes_driver_count, drivers.data ());
61+ ASSERT_EQ (result, ZE_RESULT_SUCCESS);
62+
63+ for (auto driver : drivers) {
64+ uint32_t device_count = 0 ;
65+ result = zesDeviceGet (driver, &device_count, nullptr );
66+ ASSERT_EQ (result, ZE_RESULT_SUCCESS);
67+ ASSERT_GT (device_count, 0 );
68+ std::vector<zes_device_handle_t > devices (device_count);
69+ result = zesDeviceGet (driver, &device_count, devices.data ());
70+ ASSERT_EQ (result, ZE_RESULT_SUCCESS);
71+
72+ for (auto device : devices) {
73+ zes_device_properties_t properties = {ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES, nullptr };
74+ result = zesDeviceGetProperties (device, &properties);
75+ EXPECT_EQ (result, ZE_RESULT_SUCCESS);
76+
77+ uint32_t temp_count = 0 ;
78+ temp_count = lzt::get_temp_handle_count (device);
79+ if (temp_count == 0 ) {
80+ FAIL () << " No handles found: "
81+ << _ze_result_t (ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
82+ }
83+
84+ uint32_t standby_count = 0 ;
85+ auto p_standby_handles = lzt::get_standby_handles (device, standby_count);
86+ for (auto p_standby_handle : p_standby_handles) {
87+ EXPECT_NE (nullptr , p_standby_handle);
88+ }
89+
90+ uint32_t count = 0 ;
91+ count = lzt::get_firmware_handle_count (device);
92+ if (count == 0 ) {
93+ FAIL () << " No handles found: "
94+ <<_ze_result_t (ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
95+ }
96+
97+ auto firmware_handles = lzt::get_firmware_handles (device, count);
98+ if (count == 0 ) {
99+ FAIL () << " No handles found: "
100+ << _ze_result_t (ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
101+ }
102+ }
103+ }
104+ }
105+
53106} // namespace
0 commit comments