Skip to content

Also build and run testsuite on cmake CI tests. #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 3 additions & 3 deletions MemoryModule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]) {
Expand All @@ -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]) {
Expand Down
10 changes: 9 additions & 1 deletion scripts/run-appveyor.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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 changes: 14 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions tests/TestSuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ extern BOOL MemoryModuleTestsuite();

int main(int argc, char* argv[])
{
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
if (!MemoryModuleTestsuite()) {
return 1;
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy