From 3c280ea1dc8f56c89c9eee02534aa08743d10010 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 29 Feb 2024 12:40:54 -0800 Subject: [PATCH] Automated Code Change PiperOrigin-RevId: 611562592 --- tensorflow_lite_support/scann_ondevice/cc/test/BUILD | 4 ++-- .../scann_ondevice/cc/test/index_builder_test.cc | 10 +++++----- .../scann_ondevice/cc/test/index_test.cc | 8 +++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tensorflow_lite_support/scann_ondevice/cc/test/BUILD b/tensorflow_lite_support/scann_ondevice/cc/test/BUILD index e83c51ab8..b116ff052 100644 --- a/tensorflow_lite_support/scann_ondevice/cc/test/BUILD +++ b/tensorflow_lite_support/scann_ondevice/cc/test/BUILD @@ -30,7 +30,7 @@ cc_test( "//tensorflow_lite_support/scann_ondevice/cc:index", "//tensorflow_lite_support/scann_ondevice/cc/core:serialized_searcher_cc_proto", "//tensorflow_lite_support/scann_ondevice/proto:index_config_cc_proto", - "@com_google_absl//absl/flags:flag", + "//testing/base/public:gunit", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@org_tensorflow//tensorflow/lite:test_util", @@ -54,7 +54,7 @@ cc_test( "//tensorflow_lite_support/cc/test:test_utils", "//tensorflow_lite_support/scann_ondevice/cc:index_builder", "//tensorflow_lite_support/scann_ondevice/proto:index_config_cc_proto", - "@com_google_absl//absl/flags:flag", + "//testing/base/public:gunit", "@com_google_absl//absl/memory", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", diff --git a/tensorflow_lite_support/scann_ondevice/cc/test/index_builder_test.cc b/tensorflow_lite_support/scann_ondevice/cc/test/index_builder_test.cc index 07da739f4..79cc1b94d 100644 --- a/tensorflow_lite_support/scann_ondevice/cc/test/index_builder_test.cc +++ b/tensorflow_lite_support/scann_ondevice/cc/test/index_builder_test.cc @@ -18,7 +18,7 @@ limitations under the License. #include #include -#include "absl/flags/flag.h" // from @com_google_absl +#include #include "absl/memory/memory.h" // from @com_google_absl #include "absl/status/status.h" // from @com_google_absl #include "absl/strings/str_format.h" // from @com_google_absl @@ -132,7 +132,7 @@ class PopulateIndexFileTest : public TestWithParam {}; TEST_P(PopulateIndexFileTest, WritesHashedDatabaseWithPartitioner) { const std::string db_path = - tflite::task::JoinPath(getenv("TEST_TMPDIR"), "hashed"); + tflite::task::JoinPath(::testing::TempDir(), "hashed"); const bool compression = GetParam(); { @@ -248,7 +248,7 @@ TEST_P(PopulateIndexFileTest, WritesHashedDatabaseWithPartitioner) { TEST_P(PopulateIndexFileTest, WritesHashedDatabaseWithoutPartitioner) { const std::string db_path = - tflite::task::JoinPath(getenv("TEST_TMPDIR"), "float"); + tflite::task::JoinPath(::testing::TempDir(), "float"); const bool compression = GetParam(); { @@ -337,7 +337,7 @@ TEST_P(PopulateIndexFileTest, WritesHashedDatabaseWithoutPartitioner) { TEST_P(PopulateIndexFileTest, WritesFloatDatabaseWithPartitioner) { const std::string db_path = - tflite::task::JoinPath(getenv("TEST_TMPDIR"), "float"); + tflite::task::JoinPath(::testing::TempDir(), "float"); const bool compression = GetParam(); { @@ -456,7 +456,7 @@ TEST_P(PopulateIndexFileTest, WritesFloatDatabaseWithPartitioner) { TEST_P(PopulateIndexFileTest, WritesFloatDatabaseWithoutPartitioner) { const std::string db_path = - tflite::task::JoinPath(getenv("TEST_TMPDIR"), "float"); + tflite::task::JoinPath(::testing::TempDir(), "float"); const bool compression = GetParam(); { diff --git a/tensorflow_lite_support/scann_ondevice/cc/test/index_test.cc b/tensorflow_lite_support/scann_ondevice/cc/test/index_test.cc index 390b03787..112d457c9 100644 --- a/tensorflow_lite_support/scann_ondevice/cc/test/index_test.cc +++ b/tensorflow_lite_support/scann_ondevice/cc/test/index_test.cc @@ -19,7 +19,7 @@ limitations under the License. #include #include "tensorflow_lite_support/scann_ondevice/cc/core/serialized_searcher.pb.h" -#include "absl/flags/flag.h" // from @com_google_absl +#include #include "absl/status/status.h" // from @com_google_absl #include "absl/strings/string_view.h" // from @com_google_absl #include "tensorflow/lite/test_util.h" @@ -47,8 +47,7 @@ constexpr char kDummyIndexPath[] = TEST(CreateFromOptionsTest, Succeeds) { // Load file in memory using ExternalFile. ExternalFile file; - file.set_file_name( - JoinPath("./" /*test src dir*/, kDummyIndexPath)); + file.set_file_name(JoinPath(::testing::SrcDir(), kDummyIndexPath)); SUPPORT_ASSERT_OK_AND_ASSIGN(std::unique_ptr handler, ExternalFileHandler::CreateFromExternalFile(&file)); absl::string_view file_contents = handler->GetFileContent(); @@ -62,8 +61,7 @@ class IndexTest : public tflite::testing::Test { IndexTest() { // Load file in memory using ExternalFile. ExternalFile file; - file.set_file_name( - JoinPath("./" /*test src dir*/, kDummyIndexPath)); + file.set_file_name(JoinPath(::testing::SrcDir(), kDummyIndexPath)); handler_ = ExternalFileHandler::CreateFromExternalFile(&file).value(); absl::string_view file_contents = handler_->GetFileContent(); // Build index.