ENH: fixes for RUN_TESTS from visual studio IDE, fprintf does not print right away, so std::cerr had to be used. Also, allow .\ to start the config type

This commit is contained in:
Bill Hoffman 2004-08-11 16:37:21 -04:00
parent a1b94f4c5c
commit d2087dfe99
1 changed files with 30 additions and 15 deletions

View File

@ -2156,13 +2156,27 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
if ( m_ShowOnly ) if ( m_ShowOnly )
{ {
fprintf(stderr,"%3d/%3d Testing %-30s\n", cnt, (int)tmsize, testname.c_str()); std::cerr.width(3);
} std::cerr.setf(std::ios_base::right);
std::cerr << cnt << "/";
std::cerr.width(3);
std::cerr << tmsize << " Testing ";
std::string outname = testname;
outname.resize(30, ' ');
std::cerr << outname.c_str() << "\n";
}
else else
{ {
fprintf(stderr,"%3d/%3d Testing %-30s ", cnt, (int)tmsize, testname.c_str()); std::cerr.width(3);
fflush(stderr); std::cerr << cnt << "/";
std::cerr.width(3);
std::cerr << tmsize << " Testing ";
std::string outname = testname;
outname.resize(30, ' ');
std::cerr << outname.c_str();
std::cerr.flush();
} }
//std::cerr << "Testing " << args[0] << " ... "; //std::cerr << "Testing " << args[0] << " ... ";
// find the test executable // find the test executable
std::string actualCommand = this->FindTheExecutable(args[1].Value.c_str()); std::string actualCommand = this->FindTheExecutable(args[1].Value.c_str());
@ -2279,7 +2293,7 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
{ {
if (res == cmsysProcess_State_Exited && retVal == 0) if (res == cmsysProcess_State_Exited && retVal == 0)
{ {
fprintf(stderr," Passed\n"); std::cerr << " Passed\n";
passed.push_back(testname); passed.push_back(testname);
cres.m_Status = cmCTest::COMPLETED; cres.m_Status = cmCTest::COMPLETED;
} }
@ -2288,44 +2302,44 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
cres.m_Status = cmCTest::FAILED; cres.m_Status = cmCTest::FAILED;
if ( res == cmsysProcess_State_Expired ) if ( res == cmsysProcess_State_Expired )
{ {
fprintf(stderr,"***Timeout\n"); std::cerr << "***Timeout\n";
cres.m_Status = cmCTest::TIMEOUT; cres.m_Status = cmCTest::TIMEOUT;
} }
else if ( res == cmsysProcess_State_Exception ) else if ( res == cmsysProcess_State_Exception )
{ {
fprintf(stderr,"***Exception: "); std::cerr << "***Exception: ";
switch ( retVal ) switch ( retVal )
{ {
case cmsysProcess_Exception_Fault: case cmsysProcess_Exception_Fault:
fprintf(stderr,"SegFault"); std::cerr << "SegFault";
cres.m_Status = cmCTest::SEGFAULT; cres.m_Status = cmCTest::SEGFAULT;
break; break;
case cmsysProcess_Exception_Illegal: case cmsysProcess_Exception_Illegal:
fprintf(stderr,"Illegal"); std::cerr << "Illegal";
cres.m_Status = cmCTest::ILLEGAL; cres.m_Status = cmCTest::ILLEGAL;
break; break;
case cmsysProcess_Exception_Interrupt: case cmsysProcess_Exception_Interrupt:
fprintf(stderr,"Interrupt"); std::cerr << "Interrupt";
cres.m_Status = cmCTest::INTERRUPT; cres.m_Status = cmCTest::INTERRUPT;
break; break;
case cmsysProcess_Exception_Numerical: case cmsysProcess_Exception_Numerical:
fprintf(stderr,"Numerical"); std::cerr << "Numerical";
cres.m_Status = cmCTest::NUMERICAL; cres.m_Status = cmCTest::NUMERICAL;
break; break;
default: default:
fprintf(stderr,"Other"); std::cerr << "Other";
cres.m_Status = cmCTest::OTHER_FAULT; cres.m_Status = cmCTest::OTHER_FAULT;
} }
fprintf(stderr,"\n"); std::cerr << "\n";
} }
else if ( res == cmsysProcess_State_Error ) else if ( res == cmsysProcess_State_Error )
{ {
fprintf(stderr,"***Bad command %d\n", res); std::cerr << "***Bad command " << res << "\n";
cres.m_Status = cmCTest::BAD_COMMAND; cres.m_Status = cmCTest::BAD_COMMAND;
} }
else else
{ {
fprintf(stderr,"***Failed\n"); std::cerr << "***Failed\n";
} }
failed.push_back(testname); failed.push_back(testname);
} }
@ -4269,6 +4283,7 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
{ {
i++; i++;
this->m_ConfigType = args[i]; this->m_ConfigType = args[i];
cmSystemTools::ReplaceString(this->m_ConfigType, ".\\", "");
} }
if( arg.find("-V",0) == 0 || arg.find("--verbose",0) == 0 ) if( arg.find("-V",0) == 0 || arg.find("--verbose",0) == 0 )