Skip to content

Commit

Permalink
build with test on Windows
Browse files Browse the repository at this point in the history
* install libcheck
  • Loading branch information
matkonnerth authored Jun 4, 2021
1 parent e36ba49 commit 23344f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 35 deletions.
34 changes: 9 additions & 25 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,19 @@ jobs:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2

- name: install conan
run: pip install conan

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- uses: actions/checkout@v2
with:
path: ./nodesetLoader

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

#- name: Test
# working-directory: ${{runner.workspace}}/build
# shell: bash
- name: Test
shell: cmd
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C $BUILD_TYPE
run: cd ./nodesetLoader && ctest -C Debug --verbose
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ if(${ENABLE_ASAN})
endif()

if(ENABLE_TESTING)
if(MSVC)
set(CHECK_INSTALL_DIR "C:/Program Files (x86)/Check")
endif()
find_package(Check REQUIRED)
include(CTest)
enable_testing()
Expand Down
5 changes: 4 additions & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ cmake_paths
[requires]
libxml2/2.9.9
open62541/1.1.6
libcheck/0.15.2

[options]
libxml2:shared=True
libxml2:shared=False
libcheck:with_subunit=False


12 changes: 7 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ target_include_directories(value PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SO
target_link_libraries(value PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
add_test(NAME value_Test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND value ${CMAKE_CURRENT_LIST_DIR})

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

add_executable(parser parser.c)
target_link_libraries(parser PRIVATE NodesetLoader ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
target_include_directories(parser PRIVATE ${CHECK_INCLUDE_DIR})
add_test(NAME parser_Test
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND parser ${CMAKE_CURRENT_SOURCE_DIR}/basicNodeClasses.xml)
Expand All @@ -26,13 +32,9 @@ add_test(NAME parser_Test
add_test(NAME import_testNodeset WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/testNodeset100nodes.xml)
add_test(NAME import_Nodeset2 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml)
add_test(NAME import_DI WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.Di.NodeSet2.xml)
COMMAND parserDemo ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.NodeSet2.xml ${PROJECT_SOURCE_DIR}/nodesets/Opc.Ua.Di.NodeSet2.xml)

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

add_executable(allocator allocator.c ${CMAKE_CURRENT_SOURCE_DIR}/../src/CharAllocator.c)
target_include_directories(allocator PRIVATE ${CHECK_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../src)
target_link_libraries(allocator PRIVATE ${CHECK_LIBRARIES} ${PTHREAD_LIB} coverageLib)
add_test(NAME allocatorTest WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND allocator ${CMAKE_CURRENT_LIST_DIR})
2 changes: 1 addition & 1 deletion tests/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "check.h"
#include <check.h>
#include <NodesetLoader/NodesetLoader.h>
#include <stdlib.h>

Expand Down

0 comments on commit 23344f1

Please sign in to comment.