mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
test: ensure driver teardown function is not called if driver not initialized
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3a51d68c5d
commit
554ffb91c6
@@ -88,6 +88,18 @@ TEST(GlobalTearDownTests, givenInitializedDriverAndTeardownFunctionIsAvailableWh
|
||||
EXPECT_EQ(1u, teardownCalled);
|
||||
}
|
||||
|
||||
TEST(GlobalTearDownTests, givenNotInitializedDriverAndTeardownFunctionIsAvailableWhenCallGlobalTeardownThenDontCallTeardownFunc) {
|
||||
VariableBackup<bool> initializedBackup{&levelZeroDriverInitialized};
|
||||
VariableBackup<decltype(setDriverTeardownFunc)> teardownFuncBackup{&setDriverTeardownFunc};
|
||||
|
||||
levelZeroDriverInitialized = false;
|
||||
setDriverTeardownFunc = []() -> ze_result_t {
|
||||
EXPECT_TRUE(false);
|
||||
return ZE_RESULT_SUCCESS;
|
||||
};
|
||||
EXPECT_NO_THROW(globalDriverTeardown());
|
||||
}
|
||||
|
||||
TEST(GlobalTearDownTests, givenInitializedDriverAndTeardownFunctionFailsWhenCallGlobalTeardownThenDontCrash) {
|
||||
VariableBackup<bool> initializedBackup{&levelZeroDriverInitialized};
|
||||
VariableBackup<decltype(setDriverTeardownFunc)> teardownFuncBackup{&setDriverTeardownFunc};
|
||||
|
||||
Reference in New Issue
Block a user