Use GetTestUndeclaredOutputsDir to access TEST_UNDECLARED_OUTPUTS_DIR.
On Windows, Bazel populates environment variables with `/`s only. Changing path manipulation logic to use `\` properly on Windows will conflict with this behavior, requiring a layer of indirection to deal with Bazel. PiperOrigin-RevId: 296104352 Change-Id: Ibaa19d0c4d231a15811232c63bcefc9d4931f88b
This commit is contained in:
parent
1612c983e5
commit
9aac700d02
@ -18,6 +18,7 @@ limitations under the License.
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "tensorflow/compiler/xla/literal_comparison.h"
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
#include "tensorflow/core/platform/path.h"
|
||||
#include "tensorflow/core/platform/test.h"
|
||||
|
||||
namespace xla {
|
||||
@ -30,10 +31,7 @@ void WriteLiteralToTempFile(const LiteralSlice& literal, const string& name) {
|
||||
// TEST_UNDECLARED_OUTPUTS_DIR. This plays well with tools that inspect test
|
||||
// results, especially when they're run on remote machines.
|
||||
string outdir;
|
||||
const char* undeclared_outputs_dir = getenv("TEST_UNDECLARED_OUTPUTS_DIR");
|
||||
if (undeclared_outputs_dir != nullptr) {
|
||||
outdir = undeclared_outputs_dir;
|
||||
} else {
|
||||
if (!tensorflow::io::GetTestUndeclaredOutputsDir(&outdir)) {
|
||||
outdir = tensorflow::testing::TmpDir();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
#include "tensorflow/core/platform/env.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/path.h"
|
||||
#include "tensorflow/core/platform/test.h"
|
||||
|
||||
namespace xla {
|
||||
@ -129,10 +130,7 @@ TEST(LiteralTestUtilTest, ExpectNearFailurePlacesResultsInTemporaryDirectory) {
|
||||
tensorflow::Env* env = tensorflow::Env::Default();
|
||||
|
||||
string outdir;
|
||||
const char* undeclared_outputs_dir = getenv("TEST_UNDECLARED_OUTPUTS_DIR");
|
||||
if (undeclared_outputs_dir != nullptr) {
|
||||
outdir = undeclared_outputs_dir;
|
||||
} else {
|
||||
if (!tensorflow::io::GetTestUndeclaredOutputsDir(&outdir)) {
|
||||
outdir = tensorflow::testing::TmpDir();
|
||||
}
|
||||
string pattern = tensorflow::io::JoinPath(outdir, "tempfile-*.pb");
|
||||
|
Loading…
x
Reference in New Issue
Block a user