提交 818644c2 编写于 作者: D Derek Murray 提交者: TensorFlower Gardener

Changed testing::SrcDir() to testing::TensorFlowSourceRoot() and fixed it.

Also fixed some compiler warnings.
Change: 115582482
上级 13d7f520
......@@ -45,7 +45,7 @@ class PosixSubProcess : public SubProcess {
// We are in the child process.
const char* path = argv_[0].c_str();
const char** argv = new const char*[argv_.size()];
for (int i = 1; i < argv_.size(); ++i) {
for (size_t i = 1; i < argv_.size(); ++i) {
argv[i - 1] = argv_[i].c_str();
}
argv[argv_.size() - 1] = nullptr;
......@@ -177,5 +177,17 @@ int PickUnusedPortOrDie() {
return 0;
}
string TensorFlowSrcRoot() {
// 'bazel test' sets TEST_SRCDIR
const char* env = getenv("TEST_SRCDIR");
if (env && env[0] != '\0') {
return strings::StrCat(env, "/tensorflow");
} else {
LOG(WARNING) << "TEST_SRCDIR environment variable not set: "
<< "using $PWD/tensorflow as TensorFlowSrcRoot() for tests.";
return "tensorflow";
}
}
} // namespace testing
} // namespace tensorflow
......@@ -25,7 +25,6 @@ namespace testing {
#if defined(PLATFORM_GOOGLE) || defined(__ANDROID__)
string TmpDir() { return FLAGS_test_tmpdir; }
string SrcDir() { return FLAGS_test_srcdir; }
int RandomSeed() { return FLAGS_test_random_seed; }
#else
string TmpDir() {
......
......@@ -35,8 +35,9 @@ namespace testing {
// Return a temporary directory suitable for temporary testing files.
string TmpDir();
// Returns the source directory containing data dependencies.
string SrcDir();
// Returns the path to TensorFlow in the directory containing data
// dependencies.
string TensorFlowSrcRoot();
// Return a random number generator seed to use in randomized tests.
// Returns the same value for the lifetime of the process.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册