From e26c14e5d3bac5541d3e4662845030b7aaa3c161 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 25 Oct 2004 12:15:37 -0400 Subject: ENH: add test back for single char exe --- Tests/Complex/Executable/complex.cxx | 28 +++++++++++++++++++++++ Tests/ComplexOneConfig/Executable/complex.cxx | 28 +++++++++++++++++++++++ Tests/ComplexRelativePaths/Executable/complex.cxx | 28 +++++++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index adf99d7..441a291 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -111,7 +111,35 @@ int main() lib += CMAKE_INTDIR; lib += "/"; #endif + std::string exe = lib; + // Test a single character executable to test a: in makefiles + exe += "A"; + exe += cmSystemTools::GetExecutableExtension(); + int ret; + std::string errorMessage; + if(cmSystemTools::RunSingleCommand(exe.c_str(), 0, &ret)) + { + if(ret != 10) + { + errorMessage += exe; + errorMessage += " did not return 10"; + } + } + else + { + errorMessage += exe; + errorMessage += ": failed to run."; + } + if(errorMessage.size()) + { + cmFailed(errorMessage.c_str()); + } + else + { + cmPassed("run Single Character executable A returned 10 as expected."); + } + lib += cmDynamicLoader::LibPrefix(); lib += "CMakeTestModule"; lib += cmDynamicLoader::LibExtension(); diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index adf99d7..441a291 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -111,7 +111,35 @@ int main() lib += CMAKE_INTDIR; lib += "/"; #endif + std::string exe = lib; + // Test a single character executable to test a: in makefiles + exe += "A"; + exe += cmSystemTools::GetExecutableExtension(); + int ret; + std::string errorMessage; + if(cmSystemTools::RunSingleCommand(exe.c_str(), 0, &ret)) + { + if(ret != 10) + { + errorMessage += exe; + errorMessage += " did not return 10"; + } + } + else + { + errorMessage += exe; + errorMessage += ": failed to run."; + } + if(errorMessage.size()) + { + cmFailed(errorMessage.c_str()); + } + else + { + cmPassed("run Single Character executable A returned 10 as expected."); + } + lib += cmDynamicLoader::LibPrefix(); lib += "CMakeTestModule"; lib += cmDynamicLoader::LibExtension(); diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index adf99d7..441a291 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -111,7 +111,35 @@ int main() lib += CMAKE_INTDIR; lib += "/"; #endif + std::string exe = lib; + // Test a single character executable to test a: in makefiles + exe += "A"; + exe += cmSystemTools::GetExecutableExtension(); + int ret; + std::string errorMessage; + if(cmSystemTools::RunSingleCommand(exe.c_str(), 0, &ret)) + { + if(ret != 10) + { + errorMessage += exe; + errorMessage += " did not return 10"; + } + } + else + { + errorMessage += exe; + errorMessage += ": failed to run."; + } + if(errorMessage.size()) + { + cmFailed(errorMessage.c_str()); + } + else + { + cmPassed("run Single Character executable A returned 10 as expected."); + } + lib += cmDynamicLoader::LibPrefix(); lib += "CMakeTestModule"; lib += cmDynamicLoader::LibExtension(); -- cgit v0.12