diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b865608 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: main +on: [push, pull_request] +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - uses: actions/checkout@v2 + - name: configure + run: cmake -B build -D CMAKE_BUILD_TYPE=Release + - name: build + run: cmake --build build --parallel 2 + # unfortunately the tests manipulate tap/tun drivers. This is not allowed in GA + # - name: test + # run: cd build && ctest -VV \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d00514..d9655f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # libtuntap CMakeLists.txt # ======================== -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(libtuntap) diff --git a/regress/CMakeLists.txt b/regress/CMakeLists.txt index 98f120e..ad74745 100644 --- a/regress/CMakeLists.txt +++ b/regress/CMakeLists.txt @@ -14,27 +14,29 @@ foreach(SOURCE_FILE ${ALL_C_TESTS}) COMMAND $) endforeach(SOURCE_FILE) -# Shell based tests +# Shell based tests (needs a posix shell) # ----------------- -file(GLOB ALL_SH_TESTS test*.sh) -foreach(SOURCE_FILE ${ALL_SH_TESTS}) - get_filename_component(TEST_NAME ${SOURCE_FILE} NAME_WE) - get_filename_component(TEST_SRC_PATH ${SOURCE_FILE} DIRECTORY) +if (UNIX) + file(GLOB ALL_SH_TESTS test*.sh) + foreach(SOURCE_FILE ${ALL_SH_TESTS}) + get_filename_component(TEST_NAME ${SOURCE_FILE} NAME_WE) + get_filename_component(TEST_SRC_PATH ${SOURCE_FILE} DIRECTORY) - string(REPLACE "test" "helper" HELPER_NAME ${TEST_NAME}) + string(REPLACE "test" "helper" HELPER_NAME ${TEST_NAME}) - if (EXISTS ${TEST_SRC_PATH}/${HELPER_NAME}.c) - add_executable(${HELPER_NAME} ${TEST_SRC_PATH}/${HELPER_NAME}.c) - target_link_libraries(${HELPER_NAME} tuntap) - endif() - add_test(NAME tuntap.${TEST_NAME} - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.sh) -endforeach(SOURCE_FILE) + if (EXISTS ${TEST_SRC_PATH}/${HELPER_NAME}.c) + add_executable(${HELPER_NAME} ${TEST_SRC_PATH}/${HELPER_NAME}.c) + target_link_libraries(${HELPER_NAME} tuntap) + endif() + add_test(NAME tuntap.${TEST_NAME} + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.sh) + endforeach(SOURCE_FILE) +endif() # "Will fail" tests # ----------------- -if(Darwin AND Windows) +if(Darwin OR Windows) set_tests_properties(tuntap.test39 PROPERTIES WILL_FAIL true) set_tests_properties(tuntap.test40 PROPERTIES WILL_FAIL true) endif() diff --git a/tuntap-windows.c b/tuntap-windows.c index dc2c0db..6cdfffd 100644 --- a/tuntap-windows.c +++ b/tuntap-windows.c @@ -53,7 +53,7 @@ formated_error(LPWSTR pMessage, DWORD m, ...) { LPWSTR pBuffer = NULL; va_list args = NULL; - va_start(args, pMessage); + va_start(args, m); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, diff --git a/tuntap.c b/tuntap.c index 6c4e677..c59e438 100644 --- a/tuntap.c +++ b/tuntap.c @@ -70,7 +70,6 @@ tuntap_set_ip(struct device *dev, const char *addr, int netmask) { t_tun_in_addr baddr4; t_tun_in6_addr baddr6; uint32_t mask; - int errval; /* Only accept started device */ if (dev->tun_fd == TUNFD_INVALID_VALUE) {