| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,7 @@ addons: | |||
| 30 | 30 | - wine | |
| 31 | 31 | ||
| 32 | 32 | before_script: | |
| 33 | - - if [ ! -z "$CMAKE" ]; then cmake -DPLATFORM=$PLATFORM -D UNICODE=$UNICODE -H. -B.; fi | ||
| 33 | + - if [ ! -z "$CMAKE" ]; then cmake -DPLATFORM=$PLATFORM -DUNICODE=$UNICODE -DTESTSUITE=ON -H. -B.; fi | ||
| 34 | 34 | ||
| 35 | 35 | script: | |
| 36 | 36 | - if [ -z "$CMAKE" ]; then make PLATFORM=$PLATFORM UNICODE=$UNICODE; fi | |
@@ -39,3 +39,5 @@ script: | |||
| 39 | 39 | - cd example/DllLoader | |
| 40 | 40 | - ../../tests/runwine.sh $PLATFORM ./DllLoader.exe | |
| 41 | 41 | - ../../tests/runwine.sh $PLATFORM ./DllLoaderLoader.exe | |
| 42 | + - cd ../../tests | ||
| 43 | + - ./runwine.sh $PLATFORM ./TestSuite.exe | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,11 +40,20 @@ else () | |||
| 40 | 40 | message (STATUS "Compile without UNICODE support") | |
| 41 | 41 | endif () | |
| 42 | 42 | ||
| 43 | + option(TESTSUITE "Compile with TESTSUITE support" OFF) | ||
| 44 | + if (TESTSUITE) | ||
| 45 | + message (STATUS "Compile with TESTSUITE support") | ||
| 46 | + add_definitions ("-DTESTSUITE") | ||
| 47 | + else () | ||
| 48 | + message (STATUS "Compile without TESTSUITE support") | ||
| 49 | + endif () | ||
| 50 | + | ||
| 43 | 51 | add_library (MemoryModule STATIC MemoryModule.c MemoryModule.h) | |
| 44 | 52 | if (NOT MSVC) | |
| 45 | 53 | set_target_properties ("MemoryModule" PROPERTIES PREFIX "") | |
| 46 | 54 | endif () | |
| 47 | 55 | ||
| 48 | 56 | add_subdirectory (example) | |
| 57 | + add_subdirectory (tests) | ||
| 49 | 58 | ||
| 50 | 59 | enable_language (RC) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1028,7 +1028,6 @@ MemoryLoadStringEx(HMEMORYMODULE module, UINT id, LPTSTR buffer, int maxsize, WO | |||
| 1028 | 1028 | ||
| 1029 | 1029 | #ifdef TESTSUITE | |
| 1030 | 1030 | #include <stdio.h> | |
| 1031 | - #include <inttypes.h> | ||
| 1032 | 1031 | ||
| 1033 | 1032 | #ifndef PRIxPTR | |
| 1034 | 1033 | #ifdef _WIN64 | |
@@ -1064,7 +1063,8 @@ static const uintptr_t AlignValueUpTests[][3] = { | |||
| 1064 | 1063 | ||
| 1065 | 1064 | BOOL MemoryModuleTestsuite() { | |
| 1066 | 1065 | BOOL success = TRUE; | |
| 1067 | - for (size_t idx = 0; AlignValueDownTests[idx][0]; ++idx) { | ||
| 1066 | + size_t idx; | ||
| 1067 | + for (idx = 0; AlignValueDownTests[idx][0]; ++idx) { | ||
| 1068 | 1068 | const uintptr_t* tests = AlignValueDownTests[idx]; | |
| 1069 | 1069 | uintptr_t value = AlignValueDown(tests[0], tests[1]); | |
| 1070 | 1070 | if (value != tests[2]) { | |
@@ -1073,7 +1073,7 @@ BOOL MemoryModuleTestsuite() { | |||
| 1073 | 1073 | success = FALSE; | |
| 1074 | 1074 | } | |
| 1075 | 1075 | } | |
| 1076 | - for (size_t idx = 0; AlignValueDownTests[idx][0]; ++idx) { | ||
| 1076 | + for (idx = 0; AlignValueDownTests[idx][0]; ++idx) { | ||
| 1077 | 1077 | const uintptr_t* tests = AlignValueUpTests[idx]; | |
| 1078 | 1078 | uintptr_t value = AlignValueUp(tests[0], tests[1]); | |
| 1079 | 1079 | if (value != tests[2]) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ if /I "%PLATFORM%" == "x64" ( | |||
| 13 | 13 | ||
| 14 | 14 | echo. | |
| 15 | 15 | echo Preparing %CONFIGURATION% build environment for %GENERATOR%%CMAKE_GEN_SUFFIX% ... | |
| 16 | - cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DPLATFORM=%PLATFORM% -DUNICODE=%UNICODE% -H. -Bbuild | ||
| 16 | + cmake "-G%GENERATOR%%CMAKE_GEN_SUFFIX%" -DPLATFORM=%PLATFORM% -DUNICODE=%UNICODE% -DTESTSUITE=ON -H. -Bbuild | ||
| 17 | 17 | if %errorlevel% neq 0 exit /b %errorlevel% | |
| 18 | 18 | ||
| 19 | 19 | echo. | |
@@ -26,6 +26,7 @@ echo Copying generated files ... | |||
| 26 | 26 | copy /y build\example\DllLoader\%CONFIGURATION%\DllLoader.exe build\example\DllLoader\ > NUL | |
| 27 | 27 | copy /y build\example\DllLoader\%CONFIGURATION%\DllLoaderLoader.exe build\example\DllLoader\ > NUL | |
| 28 | 28 | copy /y build\example\SampleDLL\%CONFIGURATION%\SampleDLL.dll build\example\SampleDLL\ > NUL | |
| 29 | + copy /y build\tests\%CONFIGURATION%\TestSuite.exe build\tests\ > NUL | ||
| 29 | 30 | ||
| 30 | 31 | cd build\example\DllLoader | |
| 31 | 32 | ||
@@ -38,3 +39,10 @@ echo. | |||
| 38 | 39 | echo Running DllLoaderLoader.exe ... | |
| 39 | 40 | DllLoaderLoader.exe | |
| 40 | 41 | if %errorlevel% neq 0 exit /b %errorlevel% | |
| 42 | + | ||
| 43 | + cd ..\..\tests | ||
| 44 | + | ||
| 45 | + echo. | ||
| 46 | + echo Running TestSuite.exe ... | ||
| 47 | + TestSuite.exe | ||
| 48 | + if %errorlevel% neq 0 exit /b %errorlevel% | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,14 @@ | |||
| 1 | + set (sources_testsuite | ||
| 2 | + TestSuite.c | ||
| 3 | + ) | ||
| 4 | + | ||
| 5 | + if (NOT MSVC) | ||
| 6 | + set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-static") | ||
| 7 | + set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-static") | ||
| 8 | + endif () | ||
| 9 | + | ||
| 10 | + add_executable (TestSuite ${sources_testsuite}) | ||
| 11 | + target_link_libraries ("TestSuite" "MemoryModule") | ||
| 12 | + if (NOT MSVC) | ||
| 13 | + set_target_properties ("TestSuite" PROPERTIES SUFFIX ".exe") | ||
| 14 | + endif () | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,8 @@ extern BOOL MemoryModuleTestsuite(); | |||
| 9 | 9 | ||
| 10 | 10 | int main(int argc, char* argv[]) | |
| 11 | 11 | { | |
| 12 | + UNREFERENCED_PARAMETER(argc); | ||
| 13 | + UNREFERENCED_PARAMETER(argv); | ||
| 12 | 14 | if (!MemoryModuleTestsuite()) { | |
| 13 | 15 | return 1; | |
| 14 | 16 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments