diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2003-01-15 22:31:22 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2003-01-15 22:31:22 (GMT) |
commit | c6d2312619f008a691d9a313988b15c02e4f94cd (patch) | |
tree | 3dfde773b647d2739f97f0217dd1a40225f1c0ff /Tests/ComplexOneConfig/Executable | |
parent | 17d8775e82aafe373f25b6d6ce9a568ab78816f2 (diff) | |
download | CMake-c6d2312619f008a691d9a313988b15c02e4f94cd.zip CMake-c6d2312619f008a691d9a313988b15c02e4f94cd.tar.gz CMake-c6d2312619f008a691d9a313988b15c02e4f94cd.tar.bz2 |
ENH: add testing for modules and one two config modes for cmaketest
Diffstat (limited to 'Tests/ComplexOneConfig/Executable')
-rw-r--r-- | Tests/ComplexOneConfig/Executable/complex.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index d6d3839..730510d 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -10,6 +10,7 @@ extern "C" { } #include "cmStandardIncludes.h" #include "cmSystemTools.h" +#include "cmDynamicLoader.h" int cm_passed = 0; int cm_failed = 0; @@ -101,6 +102,31 @@ void TestDir(const char* filename) int main() { + std::string lib = BINARY_DIR; + lib += "/bin/"; + lib += cmDynamicLoader::LibPrefix(); + lib += "CMakeTestModule"; + lib += cmDynamicLoader::LibExtension(); + + cmLibHandle handle = cmDynamicLoader::OpenLibrary(lib.c_str()); + if(!handle) + { + cmFailed("Can not open CMakeTestModule"); + } + else + { + cmDynamicLoaderFunction fun = + cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction"); + typedef int (*TEST_FUNCTION)(); + TEST_FUNCTION testFun = (TEST_FUNCTION)fun; + int ret = (*testFun)(); + if(!ret) + { + cmFailed("ModuleFunction called from module did not return valid return"); + } + cmPassed("Module loaded and ModuleFunction called correctly"); + } + if(sharedFunction() != 1) { cmFailed("Call to sharedFunction from shared library failed."); |