Skip to content

Commit 23344f1

Browse files
authored
build with test on Windows
* install libcheck
1 parent e36ba49 commit 23344f1

File tree

5 files changed

+21
-35
lines changed

5 files changed

+21
-35
lines changed

.github/workflows/windows.yml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,19 @@ jobs:
2020
runs-on: windows-2019
2121

2222
steps:
23-
- uses: actions/checkout@v2
24-
2523
- name: install conan
2624
run: pip install conan
2725

28-
- name: Create Build Environment
29-
# Some projects don't allow in-source building, so create a separate build directory
30-
# We'll use this as our working directory for all subsequent commands
31-
run: cmake -E make_directory ${{runner.workspace}}/build
32-
33-
- name: Configure CMake
34-
# Use a bash shell so we can use the same syntax for environment variable
35-
# access regardless of the host operating system
36-
shell: bash
37-
working-directory: ${{runner.workspace}}/build
38-
# Note the current convention is to use the -S and -B options here to specify source
39-
# and build directories, but this is only available with CMake 3.13 and higher.
40-
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
41-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
26+
- uses: actions/checkout@v2
27+
with:
28+
path: ./nodesetLoader
4229

43-
- name: Build
44-
working-directory: ${{runner.workspace}}/build
45-
shell: bash
46-
# Execute the build. You can specify a specific target with "--target <NAME>"
47-
run: cmake --build . --config $BUILD_TYPE
30+
- uses: ilammy/msvc-dev-cmd@v1
31+
- name: Build nodesetLoader
32+
run: cd ./nodesetLoader && cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON . && cmake --build .
4833

49-
#- name: Test
50-
# working-directory: ${{runner.workspace}}/build
51-
# shell: bash
34+
- name: Test
35+
shell: cmd
5236
# Execute tests defined by the CMake configuration.
5337
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
54-
# run: ctest -C $BUILD_TYPE
38+
run: cd ./nodesetLoader && ctest -C Debug --verbose

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ if(${ENABLE_ASAN})
123123
endif()
124124

125125
if(ENABLE_TESTING)
126-
if(MSVC)
127-
set(CHECK_INSTALL_DIR "C:/Program Files (x86)/Check")
128-
endif()
129126
find_package(Check REQUIRED)
130127
include(CTest)
131128
enable_testing()

conanfile.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ cmake_paths
55
[requires]
66
libxml2/2.9.9
77
open62541/1.1.6
8+
libcheck/0.15.2
89

910
[options]
10-
libxml2:shared=True
11+
libxml2:shared=False
12+
libcheck:with_subunit=False
13+
1114

tests/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ target_include_directories(value PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SO
1616
target_link_libraries(value PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
1717
add_test(NAME value_Test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND value ${CMAKE_CURRENT_LIST_DIR})
1818

19+
add_executable(allocator allocator.c ${CMAKE_CURRENT_SOURCE_DIR}/../src/CharAllocator.c)
20+
target_include_directories(allocator PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../src)
21+
target_link_libraries(allocator PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
22+
add_test(NAME allocatorTest WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND allocator ${CMAKE_CURRENT_LIST_DIR})
23+
1924
add_executable(parser parser.c)
2025
target_link_libraries(parser PRIVATE NodesetLoader ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
26+
target_include_directories(parser PRIVATE ${CHECK_INCLUDE_DIR})
2127
add_test(NAME parser_Test
2228
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
2329
COMMAND parser ${CMAKE_CURRENT_SOURCE_DIR}/basicNodeClasses.xml)
@@ -26,13 +32,9 @@ add_test(NAME parser_Test
2632
add_test(NAME import_testNodeset WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/testNodeset100nodes.xml)
2733
add_test(NAME import_Nodeset2 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml)
2834
add_test(NAME import_DI WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
29-
COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.Di.NodeSet2.xml)
35+
COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.Di.NodeSet2.xml)
3036

3137
#add_test(NAME import_PLCOpen WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml
3238
# ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.Di.NodeSet2.xml
3339
# ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.Plc.NodeSet2.xml)
3440

35-
add_executable(allocator allocator.c ${CMAKE_CURRENT_SOURCE_DIR}/../src/CharAllocator.c)
36-
target_include_directories(allocator PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../src)
37-
target_link_libraries(allocator PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
38-
add_test(NAME allocatorTest WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND allocator ${CMAKE_CURRENT_LIST_DIR})

tests/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
#include "check.h"
5+
#include <check.h>
66
#include <NodesetLoader/NodesetLoader.h>
77
#include <stdlib.h>
88

0 commit comments

Comments
 (0)