Clean up generated files in QNN UTs (#19127)

### Description
Clean up generated files in QNN UTs
This commit is contained in:
Hector Li 2024-01-16 16:36:28 -08:00 committed by GitHub
parent c935c8fbd2
commit e61861b0a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -815,7 +815,8 @@ TEST_F(QnnHTPBackendTests, ContextBinaryCacheNonEmbedModeTest) {
// Check the Onnx skeleton file is generated
EXPECT_TRUE(std::filesystem::exists(context_binary_file.c_str()));
// Check the Qnn context cache binary file is generated
EXPECT_TRUE(std::filesystem::exists("qnn_context_cache_non_embed.onnx_QNNExecutionProvider_QNN_8283143575221199085_1_0.bin"));
std::string qnn_ctx_bin = "qnn_context_cache_non_embed.onnx_QNNExecutionProvider_QNN_8283143575221199085_1_0.bin";
EXPECT_TRUE(std::filesystem::exists(qnn_ctx_bin));
// 2nd run loads and run from QDQ model + Onnx skeleton file + Qnn context cache binary file
TestQDQModelAccuracy(BuildOpTestCase<float>(op_type, {input_def}, {}, {}),
@ -837,6 +838,10 @@ TEST_F(QnnHTPBackendTests, ContextBinaryCacheNonEmbedModeTest) {
QDQTolerance(),
logging::Severity::kERROR,
context_binary_file);
// Clean up
ASSERT_EQ(std::remove(context_binary_file.c_str()), 0);
ASSERT_EQ(std::remove(qnn_ctx_bin.c_str()), 0);
}
// Run QDQ model on HTP 2 times
@ -898,6 +903,9 @@ TEST_F(QnnHTPBackendTests, ContextBinaryCache_InvalidGraph) {
ASSERT_STATUS_OK(session_object.Load(qnn_ctx_model_data.data(), static_cast<int>(qnn_ctx_model_data.size())));
// Verify the return status with code INVALID_GRAPH
ASSERT_TRUE(session_object.Initialize().Code() == common::StatusCode::INVALID_GRAPH);
// Clean up
ASSERT_EQ(std::remove(context_binary_file.c_str()), 0);
}
// Run QDQ model on HTP with 2 inputs
@ -955,6 +963,8 @@ TEST_F(QnnHTPBackendTests, ContextBinary2InputsTest) {
QDQTolerance(),
logging::Severity::kERROR,
context_binary_file);
// Clean up
ASSERT_EQ(std::remove(context_binary_file.c_str()), 0);
}
TEST_F(QnnHTPBackendTests, QuantAccuracyTest) {