From 79fdda5ead75a16e7b44d5574e2708586adfcaf9 Mon Sep 17 00:00:00 2001 From: Brian Atkinson Date: Tue, 18 Feb 2020 14:22:17 -0800 Subject: [PATCH] Use GetDataDependencyFilepath and JoinPath to find data files. This enables proper windows path support. PiperOrigin-RevId: 295821454 Change-Id: I9a9163d0d3b5a12d2bc944cbb338e99cd6a86142 --- tensorflow/compiler/xla/tests/BUILD | 5 +++-- tensorflow/compiler/xla/tests/sample_file_test.cc | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tensorflow/compiler/xla/tests/BUILD b/tensorflow/compiler/xla/tests/BUILD index bf2a1d64476..68c5538b1db 100644 --- a/tensorflow/compiler/xla/tests/BUILD +++ b/tensorflow/compiler/xla/tests/BUILD @@ -2429,15 +2429,16 @@ tf_cc_test( tags = tf_cuda_tests_tags(), deps = [ ":hlo_test_base", + ":literal_test_util", + ":xla_internal_test_main", # fixdeps: keep "//tensorflow/compiler/xla:test", "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla/service:cpu_plugin", # reference backend "//tensorflow/compiler/xla/service:gpu_plugin", # test backend "//tensorflow/compiler/xla/service:platform_util", - "//tensorflow/compiler/xla/tests:literal_test_util", - "//tensorflow/compiler/xla/tests:xla_internal_test_main", # fixdeps: keep "//tensorflow/core:lib", "//tensorflow/core:test", + "//tensorflow/core/platform:resource_loader", ], ) diff --git a/tensorflow/compiler/xla/tests/sample_file_test.cc b/tensorflow/compiler/xla/tests/sample_file_test.cc index 31b104f4e37..d793dfc7960 100644 --- a/tensorflow/compiler/xla/tests/sample_file_test.cc +++ b/tensorflow/compiler/xla/tests/sample_file_test.cc @@ -25,6 +25,8 @@ limitations under the License. #include "tensorflow/compiler/xla/tests/literal_test_util.h" #include "tensorflow/compiler/xla/types.h" #include "tensorflow/core/lib/io/path.h" +#include "tensorflow/core/platform/path.h" +#include "tensorflow/core/platform/resource_loader.h" #include "tensorflow/core/platform/test.h" #include "tensorflow/core/platform/types.h" @@ -41,10 +43,10 @@ class SampleFileTest : public HloTestBase { }; TEST_F(SampleFileTest, Convolution) { - const string& filename = "compiler/xla/tests/isolated_convolution.hlo"; - string test_srcdir = tensorflow::testing::TensorFlowSrcRoot(); - EXPECT_TRUE(RunAndCompareFromFile( - tensorflow::io::JoinPath(test_srcdir, filename), ErrorSpec{0.01})); + const string& filename = tensorflow::GetDataDependencyFilepath( + tensorflow::io::JoinPath("tensorflow", "compiler", "xla", "tests", + "isolated_convolution.hlo")); + EXPECT_TRUE(RunAndCompareFromFile(filename, ErrorSpec{0.01})); } } // namespace