ENH: Also fail when make failsSource/cmaketest.cxx
This commit is contained in:
parent
36e6b85f70
commit
cd94e07884
@ -1,6 +1,7 @@
|
|||||||
INCLUDE (${CMAKE_ROOT}/Modules/FindwxWindows.cmake)
|
INCLUDE (${CMAKE_ROOT}/Modules/FindwxWindows.cmake)
|
||||||
|
|
||||||
IF ( CMAKE_WX_CAN_COMPILE )
|
IF ( WXWINDOWS_FOUND )
|
||||||
|
INCLUDE(${CMAKE_ROOT}/Modules/Use_wxWindows.cmake)
|
||||||
|
|
||||||
SET( WX_SRCS
|
SET( WX_SRCS
|
||||||
cmWXCacheProperty.cxx
|
cmWXCacheProperty.cxx
|
||||||
@ -65,8 +66,8 @@ IF ( CMAKE_WX_CAN_COMPILE )
|
|||||||
-Q -A:ON -B:${CMake_BINARY_DIR}/Tests/Simple
|
-Q -A:ON -B:${CMake_BINARY_DIR}/Tests/Simple
|
||||||
-H:${CMake_SOURCE_DIR}/Tests/Simple)
|
-H:${CMake_SOURCE_DIR}/Tests/Simple)
|
||||||
ENDIF(BUILD_TESTING)
|
ENDIF(BUILD_TESTING)
|
||||||
ELSE ( CMAKE_WX_CAN_COMPILE )
|
ELSE ( WXWINDOWS_FOUND )
|
||||||
|
|
||||||
MESSAGE("Cannot find wxWindows libraries and/or header files")
|
MESSAGE("Cannot find wxWindows libraries and/or header files")
|
||||||
|
|
||||||
ENDIF ( CMAKE_WX_CAN_COMPILE )
|
ENDIF ( WXWINDOWS_FOUND )
|
||||||
|
@ -170,6 +170,11 @@ int do_cmaketest (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
std::cerr << "Error: cmaketest does not have a valid MAKEPROGRAM\n";
|
std::cerr << "Error: cmaketest does not have a valid MAKEPROGRAM\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return value for run command;
|
||||||
|
int retVal = 0;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
|
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
|
||||||
std::string lowerCaseCommand = cmSystemTools::LowerCase(makeCommand);
|
std::string lowerCaseCommand = cmSystemTools::LowerCase(makeCommand);
|
||||||
// if msdev is the make program then do the following
|
// if msdev is the make program then do the following
|
||||||
@ -212,12 +217,14 @@ int do_cmaketest (int argc, char **argv)
|
|||||||
std::string cleanCommand = makeCommand;
|
std::string cleanCommand = makeCommand;
|
||||||
cleanCommand += " clean";
|
cleanCommand += " clean";
|
||||||
std::cout << "Running make clean command: " << cleanCommand.c_str() << " ...\n";
|
std::cout << "Running make clean command: " << cleanCommand.c_str() << " ...\n";
|
||||||
if (!cmSystemTools::RunCommand(cleanCommand.c_str(), output))
|
retVal = 0;
|
||||||
|
if (!cmSystemTools::RunCommand(cleanCommand.c_str(), output, retVal) || retVal)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << cleanCommand.c_str() << " execution failed\n";
|
std::cerr << "Error: " << cleanCommand.c_str() << " execution failed\n";
|
||||||
std::cerr << output.c_str() << "\n";
|
std::cerr << output.c_str() << "\n";
|
||||||
// return to the original directory
|
// return to the original directory
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
|
std::cerr << "Return value: " << retVal << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +232,8 @@ int do_cmaketest (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Running make command: " << makeCommand.c_str() << " ...\n";
|
std::cout << "Running make command: " << makeCommand.c_str() << " ...\n";
|
||||||
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output))
|
retVal = 0;
|
||||||
|
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << makeCommand.c_str() << " execution failed\n";
|
std::cerr << "Error: " << makeCommand.c_str() << " execution failed\n";
|
||||||
std::cerr << output.c_str() << "\n";
|
std::cerr << output.c_str() << "\n";
|
||||||
@ -233,6 +241,14 @@ int do_cmaketest (int argc, char **argv)
|
|||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if ( retVal )
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Building of project failed\n");
|
||||||
|
std::cerr << output.c_str() << "\n";
|
||||||
|
// return to the original directory
|
||||||
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// now run the compiled test if we can find it
|
// now run the compiled test if we can find it
|
||||||
// See if the executable exists as written.
|
// See if the executable exists as written.
|
||||||
@ -293,8 +309,8 @@ int do_cmaketest (int argc, char **argv)
|
|||||||
fullPath += *p;
|
fullPath += *p;
|
||||||
}
|
}
|
||||||
std::cout << "Running test executable: " << fullPath.c_str() << "\n";
|
std::cout << "Running test executable: " << fullPath.c_str() << "\n";
|
||||||
int ret = 0;
|
retVal = 0;
|
||||||
if (!cmSystemTools::RunCommand(fullPath.c_str(), output, ret, 0, true))
|
if (!cmSystemTools::RunCommand(fullPath.c_str(), output, retVal, 0, true))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << fullPath.c_str() << " execution failed\n";
|
std::cerr << "Error: " << fullPath.c_str() << " execution failed\n";
|
||||||
// return to the original directory
|
// return to the original directory
|
||||||
@ -304,10 +320,15 @@ int do_cmaketest (int argc, char **argv)
|
|||||||
std::cout << output << "\n";
|
std::cout << output << "\n";
|
||||||
// return to the original directory
|
// return to the original directory
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
if(ret)
|
if(retVal)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("test executable ", fullPath.c_str(),
|
cmSystemTools::Error("test executable ", fullPath.c_str(),
|
||||||
"returned a non-zero value");
|
"returned a non-zero value");
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
if ( ret )
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Test failed");
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user