Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[core] Improve clean blobs on test end (#33274)

Pawel Raaszf897b876d5b4
diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp
index 32669f40d46..7c480c71a49 100644
--- a/src/inference/tests/functional/caching_test.cpp
+++ b/src/inference/tests/functional/caching_test.cpp
@@ -128,8 +128,8 @@ public:
~MkDirGuard() {
if (!m_dir.empty()) {
- ov::test::utils::removeFilesWithExt(m_dir, "blob");
- ov::test::utils::removeDir(m_dir);
+ ov::test::utils::removeFilesWithExt<ov::test::opt::FORCE>(m_dir, "blob");
+ std::filesystem::remove_all(m_dir);
}
}
};
@@ -255,6 +255,10 @@ public:
EXPECT_TRUE(Mock::VerifyAndClearExpectations(model.get()));
}
EXPECT_TRUE(Mock::VerifyAndClearExpectations(mockPlugin.get()));
+ comp_models.clear();
+ m_models.clear();
+ m_model.reset();
+ mockPlugin.reset();
ov::test::utils::removeIRFiles(modelName, weightsName);
}
@@ -1396,9 +1400,8 @@ TEST_P(CachingTest, TestCacheDirCreateRecursive) {
EXPECT_NO_THROW(m_testFunction(core));
});
}
- ov::test::utils::removeFilesWithExt(newCacheDir2, "blob");
- ov::test::utils::removeDir(newCacheDir2);
- ov::test::utils::removeDir(newCacheDir1);
+ std::filesystem::remove_all(newCacheDir2);
+ std::filesystem::remove_all(newCacheDir1);
}
TEST_P(CachingTest, TestDeviceArchitecture) {
diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp
index 247cd4bbe29..745bc834a6e 100644
--- a/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp
+++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/file_utils.hpp
@@ -77,11 +77,11 @@ inline void removeFile(const std::string& path) {
inline void removeIRFiles(const std::string& xmlFilePath, const std::string& binFileName) {
if (fileExists(xmlFilePath)) {
- std::remove(xmlFilePath.c_str());
+ std::filesystem::remove(ov::util::make_path(xmlFilePath));
}
if (fileExists(binFileName)) {
- std::remove(binFileName.c_str());
+ std::filesystem::remove(ov::util::make_path(binFileName));
}
}