Skip to content

Commit

Permalink
[GTest] For CPU_Dump_* tests try to write temporary file into temp fo…
Browse files Browse the repository at this point in the history
…lder instead of into current directory (#3432)

* Write temporary files into temporary folder instead of using current directory
  • Loading branch information
Vsevolod Golovko authored Dec 18, 2024
1 parent 9b4cf56 commit eaf49ab
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test/gtest/dumpTensorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,27 @@ void testDumpWithNan(const std::string& test_file_name)
fs::remove(test_file_name);
}

TEST(CPU_Dump_FP32, testDump) { testDump<float>(test_file_name_prefix + "float.bin"); }

TEST(CPU_Dump_NAN_FP32, testDump)
namespace {
std::string GetFullFileName(const std::string& filename)
{
testDumpWithNan<float>(test_file_name_prefix + "nan_float.bin");
return fs::temp_directory_path().append(test_file_name_prefix + filename).string();
}
} // namespace

TEST(CPU_Dump_FP16, testDump)
{
testDump<half_float::half>(test_file_name_prefix + "half_float.bin");
}
TEST(CPU_Dump_FP32, testDump) { testDump<float>(GetFullFileName("float.bin")); }

TEST(CPU_Dump_NAN_FP32, testDump) { testDumpWithNan<float>(GetFullFileName("nan_float.bin")); }

TEST(CPU_Dump_FP16, testDump) { testDump<half_float::half>(GetFullFileName("half_float.bin")); }

TEST(CPU_Dump_NAN_FP16, testDump)
{
testDumpWithNan<half_float::half>(test_file_name_prefix + "nan_half_float.bin");
testDumpWithNan<half_float::half>(GetFullFileName("nan_half_float.bin"));
}

TEST(CPU_Dump_BFP16, testDump) { testDump<bfloat16>(test_file_name_prefix + "bfloat16.bin"); }
TEST(CPU_Dump_BFP16, testDump) { testDump<bfloat16>(GetFullFileName("bfloat16.bin")); }

TEST(CPU_Dump_NAN_BFP16, testDump)
{
testDumpWithNan<bfloat16>(test_file_name_prefix + "nan_bfloat16.bin");
testDumpWithNan<bfloat16>(GetFullFileName("nan_bfloat16.bin"));
}

0 comments on commit eaf49ab

Please sign in to comment.