src/tests/utils.cpp
/**
 * Create and clean up the work directory for a given test, and cd into it,
 * given the test's test case name and test name.
 * Test directories are placed in
 * <mesosBuildDir>/test_output/<testCase>/<testName>.
 */
Create and clean up the work directory for a given test, and cd into it,
given the test's test case name and test name.
Test directories are placed in
/test_output//.
Create and clean up the work directory for a given test and cd into it given the test ' s test case name and test name . Test directories are placed in / test_output // .
void test::enterTestDirectory(const char* testCase, const char* testName)
{
  if (strncmp(testName, "DISABLED_", strlen("DISABLED_")) == 0)
    testName += strlen("DISABLED_");
  if (!isValidTestName(testCase) || !isValidTestName(testName)) {
    FAIL() << "Invalid test name for external test (name should " 
           << "only contain alphanumeric and underscore characters)";
  }
  string workDir = mesosBuildDirectory + "/test_output/" + testCase + "/"
    + testName;
  string command = "rm -fr '" + workDir + "'";
  ASSERT_EQ(0, system(command.c_str())) << "Command failed: " << command;
  command = "mkdir -p '" + workDir + "'";
  ASSERT_EQ(0, system(command.c_str())) << "Command failed: " << command;
  if (chdir(workDir.c_str()) != 0)
    FAIL() << "Could not chdir into " << workDir;
}
void test :: enterTestDirectory ( const char * testCase , const char * testName ) { if ( strncmp ( testName , " " , strlen ( " " ) ) == 0 ) testName += strlen ( " " ) ; if ( ! isValidTestName ( testCase ) || ! isValidTestName ( testName ) ) { FAIL ( ) << " " << " " ; } string workDir = mesosBuildDirectory + " " + testCase + " " + testName ; string command = " " + workDir + " " ; ASSERT_EQ ( 0 , system ( command . c_str ( ) ) ) << " " << command ; command = " " + workDir + " " ; ASSERT_EQ ( 0 , system ( command . c_str ( ) ) ) << " " << command ; if ( chdir ( workDir . c_str ( ) ) != 0 ) FAIL ( ) << " " << workDir ; }
Create and clean up the work directory for a given test, and cd into it,
 given the test's test case name and test name.
Create and clean up the work directory for a given test and cd into it given the test ' s test case name and test name .
// Remove DISABLED_ prefix from test name if this is a disabled test // Check that the test name is valid // Make the work directory for this test // Change dir into it