11/*
2- * Copyright (C) 2020 Intel Corporation
2+ * Copyright (C) 2020-2021 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
@@ -189,37 +189,37 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhileReadingNonExist
189189 EXPECT_EQ (ZE_RESULT_ERROR_NOT_AVAILABLE, pSysfsAccess->scanDirEntries (" clients/7/busy" , engineEntries));
190190}
191191
192- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingGetDeviceStatewhenDeviceIsWedged ) {
192+ TEST_F (SysmanGlobalOperationsFixture, GivenDeviceIsWedgedWhenCallingGetDeviceStateThenZesResetReasonFlagWedgedIsReturned ) {
193193 ON_CALL (*pFsAccess.get (), read (_, Matcher<uint32_t &>(_)))
194194 .WillByDefault (::testing::Invoke (pFsAccess.get (), &Mock<GlobalOperationsFsAccess>::getValWedgedFileTrue));
195195 zes_device_state_t deviceState;
196196 EXPECT_EQ (ZE_RESULT_SUCCESS, zesDeviceGetState (device, &deviceState));
197197 EXPECT_EQ (ZES_RESET_REASON_FLAG_WEDGED, deviceState.reset );
198198}
199199
200- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingGetDeviceStatewhenDeviceIsNotWedged ) {
200+ TEST_F (SysmanGlobalOperationsFixture, GivenDeviceIsNotWedgedWhenCallingGetDeviceStateThenZeroIsReturned ) {
201201 ON_CALL (*pFsAccess.get (), read (_, Matcher<uint32_t &>(_)))
202202 .WillByDefault (::testing::Invoke (pFsAccess.get (), &Mock<GlobalOperationsFsAccess>::getValWedgedFileFalse));
203203 zes_device_state_t deviceState;
204204 EXPECT_EQ (ZE_RESULT_SUCCESS, zesDeviceGetState (device, &deviceState));
205205 EXPECT_EQ (0u , deviceState.reset );
206206}
207207
208- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingGetDeviceStatewhenDeviceWdegedFileIsNotFound ) {
208+ TEST_F (SysmanGlobalOperationsFixture, GivenWedgedFileNotFoundWhenCallingGetDeviceStateThenZeResultErrorUnsupportedFeatureIsReturned ) {
209209 ON_CALL (*pFsAccess.get (), read (_, Matcher<uint32_t &>(_)))
210210 .WillByDefault (::testing::Invoke (pFsAccess.get (), &Mock<GlobalOperationsFsAccess>::getValWedgedFileNotFound));
211211 zes_device_state_t deviceState;
212212 EXPECT_EQ (ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceGetState (device, &deviceState));
213213}
214214
215- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingGetDeviceStatewhenDeviceWdegedFileHasInsufficientPermissions ) {
215+ TEST_F (SysmanGlobalOperationsFixture, GivenWedgedFileInsufficientPermissionsWhenCallingGetDeviceStateThenZeResultErrorInsufficientPermissionsIsReturned ) {
216216 ON_CALL (*pFsAccess.get (), read (_, Matcher<uint32_t &>(_)))
217217 .WillByDefault (::testing::Invoke (pFsAccess.get (), &Mock<GlobalOperationsFsAccess>::getValWedgedFileInsufficientPermissions));
218218 zes_device_state_t deviceState;
219219 EXPECT_EQ (ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, zesDeviceGetState (device, &deviceState));
220220}
221221
222- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingResetVerifyPermissionDenied ) {
222+ TEST_F (SysmanGlobalOperationsFixture, GivenPermissionDeniedWhenCallingGetDeviceStateThenZeResultErrorInsufficientPermissionsIsReturned ) {
223223 ON_CALL (*pSysfsAccess.get (), getRealPath (_, Matcher<std::string &>(_)))
224224 .WillByDefault (::testing::Invoke (pSysfsAccess.get (), &Mock<GlobalOperationsSysfsAccess>::getRealPathVal));
225225 ON_CALL (*pFsAccess.get (), canWrite (Matcher<std::string>(mockFunctionResetPath)))
@@ -229,7 +229,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingResetVeri
229229 EXPECT_EQ (ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, result);
230230}
231231
232- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceFalseCallingAndInUseResetVerifyInUseError ) {
232+ TEST_F (SysmanGlobalOperationsFixture, GivenDeviceInUseWhenCallingResetThenZeResultErrorHandleObjectInUseIsReturned ) {
233233 pProcfsAccess->ourDevicePid = pProcfsAccess->extraPid ;
234234 pProcfsAccess->ourDeviceFd = pProcfsAccess->extraFd ;
235235 ON_CALL (*pSysfsAccess.get (), getRealPath (_, Matcher<std::string &>(_)))
@@ -249,7 +249,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceFalseCallin
249249 EXPECT_EQ (ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE, result);
250250}
251251
252- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceFalseAndNotInUseCallingResetVerifySuccess ) {
252+ TEST_F (SysmanGlobalOperationsFixture, GivenDeviceNotInUseWhenCallingResetThenSuccessIsReturned ) {
253253 // Pretend we have the device open
254254 pProcfsAccess->ourDevicePid = getpid ();
255255 pProcfsAccess->ourDeviceFd = ::open (" /dev/null" , 0 );
@@ -287,7 +287,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceFalseAndNot
287287 EXPECT_EQ (errno, EBADF);
288288}
289289
290- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceTrueAndInUseCallingResetVerifySuccessAndKillProcess ) {
290+ TEST_F (SysmanGlobalOperationsFixture, GivenForceTrueAndDeviceInUseWhenCallingResetThenSuccessIsReturned ) {
291291 // Pretend another process has the device open
292292 pProcfsAccess->ourDevicePid = getpid () + 1 ; // make sure it isn't our process id
293293 pProcfsAccess->ourDeviceFd = pProcfsAccess->extraFd ;
@@ -321,7 +321,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceTrueAndInUs
321321 EXPECT_EQ (ZE_RESULT_SUCCESS, result);
322322}
323323
324- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceFalseAndProcessStartsMidResetCallingResetVerifySuccessAndProcessKilled ) {
324+ TEST_F (SysmanGlobalOperationsFixture, GivenProcessStartsMidResetWhenCallingResetThenSuccessIsReturned ) {
325325 // Pretend another process has the device open
326326 pProcfsAccess->ourDevicePid = getpid () + 1 ; // make sure it isn't our process id
327327 pProcfsAccess->ourDeviceFd = pProcfsAccess->extraFd ;
@@ -357,7 +357,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceFalseAndPro
357357 EXPECT_EQ (ZE_RESULT_SUCCESS, result);
358358}
359359
360- TEST_F (SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenForceTrueAndInUseButProcessWontDieCallingResetVerifyFailureInUse ) {
360+ TEST_F (SysmanGlobalOperationsFixture, GivenProcessWontDieWhenCallingResetThenZeResultErrorHandleObjectInUseErrorIsReturned ) {
361361 // Pretend another process has the device open
362362 pProcfsAccess->ourDevicePid = getpid () + 1 ; // make sure it isn't our process id
363363 pProcfsAccess->ourDeviceFd = pProcfsAccess->extraFd ;
0 commit comments