complex: Remove dynamic loader tests

Everything covered by these tests is now covered by the KWSys
DynamicLoader test and the Plugin test.
This commit is contained in:
Brad King 2011-12-23 14:50:21 -05:00
parent 63379207e1
commit 137e5974bc
8 changed files with 2 additions and 160 deletions

View File

@ -11,10 +11,8 @@ extern "C" {
#ifdef COMPLEX_TEST_CMAKELIB
#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
#include "cmDynamicLoader.h"
#include "cmSystemTools.h"
#include "cmGeneratedFileStream.h"
#include <cmsys/DynamicLoader.hxx>
#else
#include <vector>
#include <string>
@ -232,12 +230,6 @@ extern "C" int NameConflictTest2();
int main()
{
std::string lib = BINARY_DIR;
lib += "/lib/";
#ifdef CMAKE_INTDIR
lib += CMAKE_INTDIR;
lib += "/";
#endif
std::string exe = BINARY_DIR;
exe += "/bin/";
#ifdef CMAKE_INTDIR
@ -274,58 +266,6 @@ int main()
cmPassed("run Single Character executable A returned 10 as expected.");
}
lib += CMAKE_SHARED_MODULE_PREFIX;
lib += "CMakeTestModule";
lib += CMAKE_SHARED_MODULE_SUFFIX;
cmsys::DynamicLoader::LibraryHandle handle = cmDynamicLoader::OpenLibrary(lib.c_str());
if(!handle)
{
std::string err = "Can not open CMakeTestModule:\n";
err += lib;
cmFailed(err.c_str());
}
else
{
cmsys::DynamicLoader::SymbolPointer fun =
cmsys::DynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
if(!fun)
{
fun = cmsys::DynamicLoader::GetSymbolAddress(handle, "_ModuleFunction");
}
typedef int (*TEST_FUNCTION)();
TEST_FUNCTION testFun = (TEST_FUNCTION)fun;
if(!testFun)
{
cmFailed("Could not find symbol ModuleFunction in library ");
}
else
{
int ret = (*testFun)();
if(!ret)
{
cmFailed("ModuleFunction call did not return valid return.");
}
cmPassed("Module loaded and ModuleFunction called correctly.");
}
}
cmDynamicLoader::FlushCache(); // fix memory leaks
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
}
else
{
cmPassed("Call to sharedFunction from shared library worked.");
}
if(CsharedFunction() != 1)
{
cmFailed("Call to C sharedFunction from shared library failed.");
}
else
{
cmPassed("Call to C sharedFunction from shared library worked.");
}
// ----------------------------------------------------------------------
// Test cmSystemTools::UpperCase
std::string str = "abc";

View File

@ -43,7 +43,6 @@ ENDIF(WIN32)
#
SET(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
ADD_LIBRARY(CMakeTestModule MODULE moduleFile.c)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
DEFINE_PROPERTY(

View File

@ -1,6 +0,0 @@
#include "moduleFile.h"
int ModuleFunction()
{
return 1;
}

View File

@ -1,12 +0,0 @@
#if defined(_WIN32) || defined(WIN32) /* Win32 version */
#ifdef CMakeTestModule_EXPORTS
# define CMakeTest_EXPORT __declspec(dllexport)
#else
# define CMakeTest_EXPORT __declspec(dllimport)
#endif
#else
/* unix needs nothing */
#define CMakeTest_EXPORT
#endif
CMakeTest_EXPORT int ModuleFunction();

View File

@ -11,10 +11,8 @@ extern "C" {
#ifdef COMPLEX_TEST_CMAKELIB
#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
#include "cmDynamicLoader.h"
#include "cmSystemTools.h"
#include "cmGeneratedFileStream.h"
#include <cmsys/DynamicLoader.hxx>
#else
#include <vector>
#include <string>
@ -232,12 +230,6 @@ extern "C" int NameConflictTest2();
int main()
{
std::string lib = BINARY_DIR;
lib += "/lib/";
#ifdef CMAKE_INTDIR
lib += CMAKE_INTDIR;
lib += "/";
#endif
std::string exe = BINARY_DIR;
exe += "/bin/";
#ifdef CMAKE_INTDIR
@ -274,58 +266,6 @@ int main()
cmPassed("run Single Character executable A returned 10 as expected.");
}
lib += CMAKE_SHARED_MODULE_PREFIX;
lib += "CMakeTestModule";
lib += CMAKE_SHARED_MODULE_SUFFIX;
cmsys::DynamicLoader::LibraryHandle handle = cmDynamicLoader::OpenLibrary(lib.c_str());
if(!handle)
{
std::string err = "Can not open CMakeTestModule:\n";
err += lib;
cmFailed(err.c_str());
}
else
{
cmsys::DynamicLoader::SymbolPointer fun =
cmsys::DynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
if(!fun)
{
fun = cmsys::DynamicLoader::GetSymbolAddress(handle, "_ModuleFunction");
}
typedef int (*TEST_FUNCTION)();
TEST_FUNCTION testFun = (TEST_FUNCTION)fun;
if(!testFun)
{
cmFailed("Could not find symbol ModuleFunction in library ");
}
else
{
int ret = (*testFun)();
if(!ret)
{
cmFailed("ModuleFunction call did not return valid return.");
}
cmPassed("Module loaded and ModuleFunction called correctly.");
}
}
cmDynamicLoader::FlushCache(); // fix memory leaks
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
}
else
{
cmPassed("Call to sharedFunction from shared library worked.");
}
if(CsharedFunction() != 1)
{
cmFailed("Call to C sharedFunction from shared library failed.");
}
else
{
cmPassed("Call to C sharedFunction from shared library worked.");
}
// ----------------------------------------------------------------------
// Test cmSystemTools::UpperCase
std::string str = "abc";

View File

@ -43,7 +43,6 @@ ENDIF(WIN32)
#
SET(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
ADD_LIBRARY(CMakeTestModule MODULE moduleFile.c)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
DEFINE_PROPERTY(

View File

@ -1,6 +0,0 @@
#include "moduleFile.h"
int ModuleFunction()
{
return 1;
}

View File

@ -1,12 +0,0 @@
#if defined(_WIN32) || defined(WIN32) /* Win32 version */
#ifdef CMakeTestModule_EXPORTS
# define CMakeTest_EXPORT __declspec(dllexport)
#else
# define CMakeTest_EXPORT __declspec(dllimport)
#endif
#else
/* unix needs nothing */
#define CMakeTest_EXPORT
#endif
CMakeTest_EXPORT int ModuleFunction();