@@ -789,10 +789,10 @@ class UndefinedTypeDynamicTypeSerializationTests : public ::testing::Test {
789789</net>
790790)V0G0N" ;
791791
792- std::string m_dynamic_type_out_xml_path;
793- std::string m_dynamic_type_out_bin_path;
794- std::string m_undefined_type_out_xml_path;
795- std::string m_undefined_type_out_bin_path;
792+ std::filesystem::path m_dynamic_type_out_xml_path;
793+ std::filesystem::path m_dynamic_type_out_bin_path;
794+ std::filesystem::path m_undefined_type_out_xml_path;
795+ std::filesystem::path m_undefined_type_out_bin_path;
796796
797797 void SetUp () override {
798798 std::string filePrefix = ov::test::utils::generateTestFilePrefix ();
@@ -803,15 +803,26 @@ class UndefinedTypeDynamicTypeSerializationTests : public ::testing::Test {
803803 }
804804
805805 void TearDown () override {
806- std::remove (m_undefined_type_out_xml_path.c_str ());
807- std::remove (m_undefined_type_out_bin_path.c_str ());
808- std::remove (m_dynamic_type_out_xml_path.c_str ());
809- std::remove (m_dynamic_type_out_bin_path.c_str ());
806+ if (std::filesystem::exists (m_undefined_type_out_xml_path)) {
807+ std::filesystem::remove (m_undefined_type_out_xml_path);
808+ }
809+
810+ if (std::filesystem::exists (m_undefined_type_out_bin_path)) {
811+ std::filesystem::remove (m_undefined_type_out_bin_path);
812+ }
813+
814+ if (std::filesystem::exists (m_dynamic_type_out_xml_path)) {
815+ std::filesystem::remove (m_dynamic_type_out_xml_path);
816+ }
817+
818+ if (std::filesystem::exists (m_dynamic_type_out_bin_path)) {
819+ std::filesystem::remove (m_dynamic_type_out_bin_path);
820+ }
810821 }
811822
812- bool files_equal (const std::string & file_path1, const std::string & file_path2) {
813- std::ifstream xml_dynamic (file_path1, std::ios::binary);
814- std::ifstream xml_undefined (file_path2, std::ios::binary);
823+ bool files_equal (const std::filesystem::path & file_path1, const std::filesystem::path & file_path2) {
824+ std::ifstream xml_dynamic (file_path1. string () , std::ios::binary);
825+ std::ifstream xml_undefined (file_path2. string () , std::ios::binary);
815826
816827 if (!xml_dynamic.good () || !xml_undefined.good ()) {
817828 return false ;
@@ -825,18 +836,18 @@ class UndefinedTypeDynamicTypeSerializationTests : public ::testing::Test {
825836
826837// check stringstream serialize
827838TEST_F (UndefinedTypeDynamicTypeSerializationTests, compare_dynamic_type_undefined_type_serialization_stringstream) {
828- std::stringstream dynamicTypeModelXmlStream, undefinedTypeModelXmlStream, dynamicTypeModelBinStream ,
829- undefinedTypeModelBinStream ;
839+ std::stringstream dynamicXmlStream, undefinedXmlStream, dynamicBinStream ,
840+ undefinedBinStream ;
830841
831842 // Test whether the serialization results of the two models are the same
832843 auto dynamicTypeModel = ov::test::readModel (dynamic_type_ir);
833844 auto undefinedTypeModel = ov::test::readModel (undefined_type_ir);
834845
835846 // compile the serialized models with stringstream type
836- ov::pass::Serialize (dynamicTypeModelXmlStream, dynamicTypeModelBinStream ).run_on_model (dynamicTypeModel);
837- ov::pass::Serialize (undefinedTypeModelXmlStream, undefinedTypeModelBinStream ).run_on_model (undefinedTypeModel);
847+ ov::pass::Serialize (dynamicXmlStream, dynamicBinStream ).run_on_model (dynamicTypeModel);
848+ ov::pass::Serialize (undefinedXmlStream, undefinedBinStream ).run_on_model (undefinedTypeModel);
838849
839- ASSERT_EQ (dynamicTypeModelXmlStream .str (), undefinedTypeModelXmlStream .str ())
850+ ASSERT_EQ (dynamicXmlStream .str (), undefinedXmlStream .str ())
840851 << " Serialized XML streams are different: dynamic type vs undefined type" ;
841852}
842853
0 commit comments