Merge pull request #51 from fancycode/cmake_testsuite

Also build and run testsuite on cmake CI tests.
This commit is contained in:
Joachim Bauch
2016-09-20 23:38:38 +02:00
committed by GitHub
6 changed files with 40 additions and 5 deletions
+3 -1
View File
@@ -30,7 +30,7 @@ addons:
- wine
before_script:
- if [ ! -z "$CMAKE" ]; then cmake -DPLATFORM=$PLATFORM -D UNICODE=$UNICODE -H. -B.; fi
- if [ ! -z "$CMAKE" ]; then cmake -DPLATFORM=$PLATFORM -DUNICODE=$UNICODE -DTESTSUITE=ON -H. -B.; fi
script:
- if [ -z "$CMAKE" ]; then make PLATFORM=$PLATFORM UNICODE=$UNICODE; fi
@@ -39,3 +39,5 @@ script:
- cd example/DllLoader
- ../../tests/runwine.sh $PLATFORM ./DllLoader.exe
- ../../tests/runwine.sh $PLATFORM ./DllLoaderLoader.exe
- cd ../../tests
- ./runwine.sh $PLATFORM ./TestSuite.exe
+9
View File
@@ -40,11 +40,20 @@ else ()
message (STATUS "Compile without UNICODE support")
endif ()
option(TESTSUITE "Compile with TESTSUITE support" OFF)
if (TESTSUITE)
message (STATUS "Compile with TESTSUITE support")
add_definitions ("-DTESTSUITE")
else ()
message (STATUS "Compile without TESTSUITE support")
endif ()
add_library (MemoryModule STATIC MemoryModule.c MemoryModule.h)
if (NOT MSVC)
set_target_properties ("MemoryModule" PROPERTIES PREFIX "")
endif ()
add_subdirectory (example)
add_subdirectory (tests)
enable_language (RC)
+3 -3
View File
@@ -1028,7 +1028,6 @@ MemoryLoadStringEx(HMEMORYMODULE module, UINT id, LPTSTR buffer, int maxsize, WO
#ifdef TESTSUITE
#include <stdio.h>
#include <inttypes.h>
#ifndef PRIxPTR
#ifdef _WIN64
@@ -1064,7 +1063,8 @@ static const uintptr_t AlignValueUpTests[][3] = {
BOOL MemoryModuleTestsuite() {
BOOL success = TRUE;
for (size_t idx = 0; AlignValueDownTests[idx][0]; ++idx) {
size_t idx;
for (idx = 0; AlignValueDownTests[idx][0]; ++idx) {
const uintptr_t* tests = AlignValueDownTests[idx];
uintptr_t value = AlignValueDown(tests[0], tests[1]);
if (value != tests[2]) {
@@ -1073,7 +1073,7 @@ BOOL MemoryModuleTestsuite() {
success = FALSE;
}
}
for (size_t idx = 0; AlignValueDownTests[idx][0]; ++idx) {
for (idx = 0; AlignValueDownTests[idx][0]; ++idx) {
const uintptr_t* tests = AlignValueUpTests[idx];
uintptr_t value = AlignValueUp(tests[0], tests[1]);
if (value != tests[2]) {
+9 -1
View File
@@ -13,7 +13,7 @@ if /I "%PLATFORM%" == "x64" (
echo.
echo Preparing %CONFIGURATION% build environment for %GENERATOR%%CMAKE_GEN_SUFFIX% ...
cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DPLATFORM=%PLATFORM% -DUNICODE=%UNICODE% -H. -Bbuild
cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DPLATFORM=%PLATFORM% -DUNICODE=%UNICODE% -DTESTSUITE=ON -H. -Bbuild
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
@@ -26,6 +26,7 @@ echo Copying generated files ...
copy /y build\example\DllLoader\%CONFIGURATION%\DllLoader.exe build\example\DllLoader\ > NUL
copy /y build\example\DllLoader\%CONFIGURATION%\DllLoaderLoader.exe build\example\DllLoader\ > NUL
copy /y build\example\SampleDLL\%CONFIGURATION%\SampleDLL.dll build\example\SampleDLL\ > NUL
copy /y build\tests\%CONFIGURATION%\TestSuite.exe build\tests\ > NUL
cd build\example\DllLoader
@@ -38,3 +39,10 @@ echo.
echo Running DllLoaderLoader.exe ...
DllLoaderLoader.exe
if %errorlevel% neq 0 exit /b %errorlevel%
cd ..\..\tests
echo.
echo Running TestSuite.exe ...
TestSuite.exe
if %errorlevel% neq 0 exit /b %errorlevel%
+14
View File
@@ -0,0 +1,14 @@
set (sources_testsuite
TestSuite.c
)
if (NOT MSVC)
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-static")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-static")
endif ()
add_executable (TestSuite ${sources_testsuite})
target_link_libraries ("TestSuite" "MemoryModule")
if (NOT MSVC)
set_target_properties ("TestSuite" PROPERTIES SUFFIX ".exe")
endif ()
+2
View File
@@ -9,6 +9,8 @@ extern BOOL MemoryModuleTestsuite();
int main(int argc, char* argv[])
{
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
if (!MemoryModuleTestsuite()) {
return 1;
}