Use GetDataDependencyFilepath and JoinPath to find data files.

This enables proper windows path support.

PiperOrigin-RevId: 295821454
Change-Id: I9a9163d0d3b5a12d2bc944cbb338e99cd6a86142
This commit is contained in:
Brian Atkinson 2020-02-18 14:22:17 -08:00 committed by TensorFlower Gardener
parent e47e4bfb9e
commit 79fdda5ead
2 changed files with 9 additions and 6 deletions

View File

@ -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",
],
)

View File

@ -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