Renames the POSIX wrappers (by Zhanyong Wan) and adds more targets to SConscript (by Vlad Losev).
This commit is contained in:
		@@ -106,7 +106,7 @@ class TestForDeathTest : public testing::Test {
 | 
			
		||||
  TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
 | 
			
		||||
 | 
			
		||||
  virtual ~TestForDeathTest() {
 | 
			
		||||
    posix::chdir(original_dir_.c_str());
 | 
			
		||||
    posix::ChDir(original_dir_.c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // A static member function that's expected to die.
 | 
			
		||||
@@ -345,7 +345,7 @@ TEST_F(TestForDeathTest, MemberFunctionFastStyle) {
 | 
			
		||||
  EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ChangeToRootDir() { posix::chdir(GTEST_PATH_SEP_); }
 | 
			
		||||
void ChangeToRootDir() { posix::ChDir(GTEST_PATH_SEP_); }
 | 
			
		||||
 | 
			
		||||
// Tests that death tests work even if the current directory has been
 | 
			
		||||
// changed.
 | 
			
		||||
 
 | 
			
		||||
@@ -86,9 +86,9 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
 | 
			
		||||
  const FilePath original_dir = FilePath::GetCurrentDir();
 | 
			
		||||
  EXPECT_FALSE(original_dir.IsEmpty());
 | 
			
		||||
 | 
			
		||||
  posix::chdir(GTEST_PATH_SEP_);
 | 
			
		||||
  posix::ChDir(GTEST_PATH_SEP_);
 | 
			
		||||
  const FilePath cwd = FilePath::GetCurrentDir();
 | 
			
		||||
  posix::chdir(original_dir.c_str());
 | 
			
		||||
  posix::ChDir(original_dir.c_str());
 | 
			
		||||
 | 
			
		||||
#if GTEST_OS_WINDOWS
 | 
			
		||||
  // Skips the ":".
 | 
			
		||||
@@ -435,14 +435,14 @@ class DirectoryCreationTest : public Test {
 | 
			
		||||
    remove(testdata_file_.c_str());
 | 
			
		||||
    remove(unique_file0_.c_str());
 | 
			
		||||
    remove(unique_file1_.c_str());
 | 
			
		||||
    posix::rmdir(testdata_path_.c_str());
 | 
			
		||||
    posix::RmDir(testdata_path_.c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual void TearDown() {
 | 
			
		||||
    remove(testdata_file_.c_str());
 | 
			
		||||
    remove(unique_file0_.c_str());
 | 
			
		||||
    remove(unique_file1_.c_str());
 | 
			
		||||
    posix::rmdir(testdata_path_.c_str());
 | 
			
		||||
    posix::RmDir(testdata_path_.c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  String TempDir() const {
 | 
			
		||||
@@ -450,7 +450,7 @@ class DirectoryCreationTest : public Test {
 | 
			
		||||
    return String("\\temp\\");
 | 
			
		||||
 | 
			
		||||
#elif GTEST_OS_WINDOWS
 | 
			
		||||
    const char* temp_dir = posix::getenv("TEMP");
 | 
			
		||||
    const char* temp_dir = posix::GetEnv("TEMP");
 | 
			
		||||
    if (temp_dir == NULL || temp_dir[0] == '\0')
 | 
			
		||||
      return String("\\temp\\");
 | 
			
		||||
    else if (String(temp_dir).EndsWith("\\"))
 | 
			
		||||
@@ -463,7 +463,7 @@ class DirectoryCreationTest : public Test {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void CreateTextFile(const char* filename) {
 | 
			
		||||
    FILE* f = posix::fopen(filename, "w");
 | 
			
		||||
    FILE* f = posix::FOpen(filename, "w");
 | 
			
		||||
    fprintf(f, "text\n");
 | 
			
		||||
    fclose(f);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -150,14 +150,14 @@ class XmlOutputChangeDirTest : public Test {
 | 
			
		||||
 protected:
 | 
			
		||||
  virtual void SetUp() {
 | 
			
		||||
    original_working_dir_ = FilePath::GetCurrentDir();
 | 
			
		||||
    posix::chdir("..");
 | 
			
		||||
    posix::ChDir("..");
 | 
			
		||||
    // This will make the test fail if run from the root directory.
 | 
			
		||||
    EXPECT_STRNE(original_working_dir_.c_str(),
 | 
			
		||||
                 FilePath::GetCurrentDir().c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual void TearDown() {
 | 
			
		||||
    posix::chdir(original_working_dir_.c_str());
 | 
			
		||||
    posix::ChDir(original_working_dir_.c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  FilePath original_working_dir_;
 | 
			
		||||
 
 | 
			
		||||
@@ -991,9 +991,9 @@ int main(int argc, char **argv) {
 | 
			
		||||
    // Skip the usual output capturing if we're running as the child
 | 
			
		||||
    // process of an threadsafe-style death test.
 | 
			
		||||
#if GTEST_OS_WINDOWS
 | 
			
		||||
    posix::freopen("nul:", "w", stdout);
 | 
			
		||||
    posix::FReopen("nul:", "w", stdout);
 | 
			
		||||
#else
 | 
			
		||||
    posix::freopen("/dev/null", "w", stdout);
 | 
			
		||||
    posix::FReopen("/dev/null", "w", stdout);
 | 
			
		||||
#endif  // GTEST_OS_WINDOWS
 | 
			
		||||
    return RUN_ALL_TESTS();
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,8 @@ def Run(command):
 | 
			
		||||
  """Runs a command; returns True/False if its exit code is/isn't 0."""
 | 
			
		||||
 | 
			
		||||
  print 'Running "%s". . .' % ' '.join(command)
 | 
			
		||||
  return gtest_test_utils.Subprocess(command).exit_code == 0
 | 
			
		||||
  p = gtest_test_utils.Subprocess(command)
 | 
			
		||||
  return p.exited and p.exit_code == 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# The tests.  TODO(wan@google.com): refactor the class to share common
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user