From ad118104f0892e53a5bdabaf1ffdcd597bf1b476 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Sat, 5 Mar 2011 13:31:46 -0800 Subject: chdir into a temp dir before disk tests --- src/ninja_test.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ninja_test.cc b/src/ninja_test.cc index 7ec77fd..646b4a9 100644 --- a/src/ninja_test.cc +++ b/src/ninja_test.cc @@ -197,6 +197,11 @@ public: ASSERT_TRUE(getcwd(buf, sizeof(buf))); start_dir_ = buf; + const char* tempdir = getenv("TMPDIR"); + if (!tempdir) + tempdir = "/tmp"; + ASSERT_EQ(0, chdir(tempdir)); + char name_template[] = "DiskInterfaceTest-XXXXXX"; char* name = mkdtemp(name_template); temp_dir_name_ = name; -- cgit v0.12