diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e159b4819c60665c500d7cd20ce7d99d468d347..c67216a23f7122bc7bab8aa5998e59b5a337167b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,3 @@ -# This file is a template, and might need editing before it works on your project. -# use the official gcc image, based on debian -# can use verions as well, like gcc:5.2 -# see https://hub.docker.com/_/gcc/ - variables: GIT_SUBMODULE_STRATEGY: normal @@ -11,352 +6,544 @@ stages: - test - deploy -# Install dependencies for GCC builds -before_script: - - apt-get update && - apt-get install -y - libboost-system-dev - libboost-filesystem-dev - libboost-program-options-dev - libboost-thread-dev - libboost-regex-dev - libprotobuf-dev - protobuf-compiler - libprotobuf-c0-dev - protobuf-c-compiler - libyaml-cpp-dev - libyaml-dev - libarchive-dev - cmake - - - pushd . && - git clone https://github.com/ofiwg/libfabric.git && - cd libfabric && - ./autogen.sh && - mkdir build && - cd build && - ../configure && - make -j $(nproc) && - make install && - popd - - - pushd . && - git clone https://github.com/mercury-hpc/mercury.git && - cd mercury && - mkdir build && - cd build && - cmake - -DCMAKE_BUILD_TYPE:STRING=Debug - -DBUILD_TESTING:BOOL=OFF - -DMERCURY_USE_SM_ROUTING:BOOL=OFF - -DMERCURY_USE_SELF_FORWARD:BOOL=OFF - -DMERCURY_USE_CHECKSUMS:BOOL=OFF - -DMERCURY_USE_BOOST_PP:BOOL=ON - -DMERCURY_USE_EAGER_BULK:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=ON - -DNA_USE_OFI:BOOL=ON - .. && - make -j $(nproc) && - make install && - popd - - -### GCC 5 -build:gcc:5: - image: gcc:5 + +################################################################################ +# Build jobs +################################################################################ + +################################################################################ +######################### GCC ######################################### +################################################################################ + +### GCC 4.8 with libfabric1.7.1, mercury 1.0.1 +build:gcc_4.8:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc4.8-libfabric1.7.1-mercury1.0.1 stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + artifacts: + paths: + - build + +### GCC 4.9 with libfabric1.7.1, mercury 1.0.1 +build:gcc:4.9: + image: bscstorage/norns-build-deps:gcc4.9-libfabric1.7.1-mercury1.0.1 + stage: build script: - - ./bootstrap.sh - - mkdir build && cd build - - ../configure - --enable-tests - - make -j$(nproc) CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" - - cd tests - - make -j$(nproc) CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" core - - make -j$(nproc) CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" api - - -### GCC 6 -build:gcc:6: - image: gcc:6 + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + + +### GCC 5.4 with libfabric1.7.1, mercury 1.0.1 +build:gcc_5.4:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc5.4-libfabric1.7.1-mercury1.0.1 stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### GCC 6.5 with libfabric1.7.1, mercury 1.0.1 +build:gcc_6.5:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc6.5-libfabric1.7.1-mercury1.0.1 + stage: build script: - - ./bootstrap.sh - - mkdir build && cd build - - ../configure - --enable-tests - - make -j$(nproc) CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" - - cd tests - - make -j$(nproc) CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" core - - make -j$(nproc) CPPFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" api - - -### GCC 7 -build:gcc:7: - image: gcc:7 + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + + +### GCC 7.4 with libfabric1.7.1, mercury 1.0.1 +build:gcc_7.4:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc7.4-libfabric1.7.1-mercury1.0.1 stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### GCC 8.1 with libfabric1.7.1, mercury 1.0.1 +build:gcc_8.1:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc8.1-libfabric1.7.1-mercury1.0.1 + stage: build script: - - ./bootstrap.sh - - mkdir build && cd build - - ../configure - --enable-tests - - make -j$(nproc) - - cd tests - - make -j$(nproc) - - make -j$(nproc) - - -### GCC 8 -build:gcc:8: - image: gcc:8 + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + + +### GCC 9.1 with libfabric1.7.1, mercury 1.0.1 +build:gcc_9.1:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc9.1-libfabric1.7.1-mercury1.0.1 stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + - find "${CI_PROJECT_DIR}/build" \( -name "*.o" -or -name "*.lo" \) -delete + - du -h "${CI_PROJECT_DIR}/build" + artifacts: + paths: + - "${CI_PROJECT_DIR}/build" + expire_in: 12 hours +# This one should always run +# only: +# - tags +# - triggers +# - schedules + +################################################################################ +######################### LLVM/Clang ######################################### +################################################################################ + +### Clang 3.6 with libfabric1.7.1, mercury 1.0.1 +build:clang_3.6:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang3.6-libfabric1.7.1-mercury1.0.1 + stage: build script: - - ./bootstrap.sh - - mkdir build && cd build - - ../configure - --enable-tests - - make -j$(nproc) - - cd tests - - make -j$(nproc) - - make -j$(nproc) + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 3.8 with libfabric1.7.1, mercury 1.0.1 +build:clang_3.8:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang3.8-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 3.9 with libfabric1.7.1, mercury 1.0.1 +build:clang_3.9:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang3.9-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 4.0 with libfabric1.7.1, mercury 1.0.1 +build:clang_4.0:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang4.0-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 5.0 with libfabric1.7.1, mercury 1.0.1 +build:clang_5.0:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang5.0-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 6.0 with libfabric1.7.1, mercury 1.0.1 +build:clang_6.0:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang6.0-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 7.1 with libfabric1.7.1, mercury 1.0.1 +build:clang_7.1:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang7.1-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 8.0 with libfabric1.7.1, mercury 1.0.1 +build:clang_8.0:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang8.0-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) + only: + - tags + - triggers + - schedules + +### Clang 9.0 with libfabric1.7.1, mercury 1.0.1 +build:clang_9.0:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:clang9.0-libfabric1.7.1-mercury1.0.1 + stage: build + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + make -j$(nproc) api_interactive + ) +# This one should always run +# only: +# - tags +# - triggers +# - schedules ################################################################################ -# test scripts +# Test jobs ################################################################################ + +### GCC 9.1 with libfabric1.7.1, mercury 1.0.1 +test:gcc_9.1:libfabric_1.7.1:mercury_1.0.1: + image: bscstorage/norns-build-deps:gcc9.1-libfabric1.7.1-mercury1.0.1 + stage: test + dependencies: + - build:gcc_9.1:libfabric_1.7.1:mercury_1.0.1 + variables: + NORNS_DEBUG_CONFIG_FILE_OVERRIDE: 1 + script: + - | + ( + set -Eeuo pipefail + set -x + cd build/tests + ./core -as + ./api -as "[api::NORNS_TASK]" + ./api -as "[api::norns_error]" + ./api -as "[api::norns_iotask_init]" + ./api -as "[api::norns_resource_init]" + ./api -as "[api::norns_submit]" + ./api -as "[api::norns_submit_copy_buffer_to_file]" + ./api -as "[api::norns_submit_copy_local_posix_files]" + ./api -as "[api::norns_submit_pull_errors]" + ./api -as "[api::norns_submit_pull_links]" + ./api -as "[api::norns_submit_pull_to_posix_file]" + ./api -as "[api::norns_submit_pull_to_posix_subdir]" + ./api -as "[api::norns_submit_push_errors]" + ./api -as "[api::norns_submit_push_links]" + ./api -as "[api::norns_submit_push_memory_to_posix_file]" + ./api -as "[api::norns_submit_push_memory_to_posix_file_errors]" + ./api -as "[api::norns_submit_push_to_posix_file]" + ./api -as "[api::norns_submit_push_to_posix_subdir]" + ./api -as "[api::norns_submit_remove_local_posix_files]" + ./api -as "[api::nornsctl_add_process]" + ./api -as "[api::nornsctl_register_job]" + ./api -as "[api::nornsctl_register_namespace]" + ./api -as "[api::nornsctl_remove_process]" + ./api -as "[api::nornsctl_send_command]" + ./api -as "[api::nornsctl_status]" + ./api -as "[api::nornsctl_unregister_job]" + ./api -as "[api::nornsctl_unregister_namespace]" + ./api -as "[api::nornsctl_update_job]" + ) + artifacts: + paths: + - "${CI_PROJECT_DIR}/build/tests" + when: on_failure + expire_in: 1 week + + +################################################################################ +# Coverage jobs +################################################################################ + +### +build:coverage: + image: bscstorage/norns-build-deps:gcc8.1-libfabric1.7.1-mercury1.0.1 + stage: build + variables: + CFLAGS: "-O0 --coverage" + CXXFLAGS: "-O0 --coverage" + LDFLAGS: "--coverage" + script: + - | + ( + set -Eeuo pipefail + set -x + ./bootstrap.sh + mkdir build && cd build + ../configure --enable-tests + make -j$(nproc) + cd tests + make -j$(nproc) core + make -j$(nproc) api + ) + - find "${CI_PROJECT_DIR}/build" \( -name "*.o" -or -name "*.lo" \) -delete + - du -h "${CI_PROJECT_DIR}/build" + artifacts: + paths: + - "${CI_PROJECT_DIR}/build" + expire_in: 1 day + +### test:coverage: - image: ubuntu:latest - stage: test - - # Install dependencies - before_script: - - apt-get update && - apt-get upgrade -y && - apt-get install -y - git - build-essential - autotools-dev - automake - autoconf - libtool - pkg-config - libboost-system-dev - libboost-filesystem-dev - libboost-program-options-dev - libboost-thread-dev - libboost-regex-dev - libprotobuf-dev - protobuf-compiler - libprotobuf-c-dev - protobuf-c-compiler - libyaml-cpp-dev - libyaml-dev - libarchive-dev - libcap2-bin - valgrind - cmake - lcov - - - pushd . && - git clone https://github.com/ofiwg/libfabric.git && - cd libfabric && - ./autogen.sh && - mkdir build && - cd build && - ../configure && - make -j $(nproc) && - make install && - popd && - ldconfig - - - pushd . && - git clone https://github.com/mercury-hpc/mercury.git && - cd mercury && - mkdir build && - cd build && - cmake - -DCMAKE_BUILD_TYPE:STRING=Debug - -DBUILD_TESTING:BOOL=OFF - -DMERCURY_USE_SM_ROUTING:BOOL=OFF - -DMERCURY_USE_SELF_FORWARD:BOOL=OFF - -DMERCURY_USE_CHECKSUMS:BOOL=OFF - -DMERCURY_USE_BOOST_PP:BOOL=ON - -DMERCURY_USE_EAGER_BULK:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=ON - -DNA_USE_OFI:BOOL=ON - .. && - make -j $(nproc) && - make install && - popd && - ldconfig - - # Build and test - script: - - ./bootstrap.sh - - mkdir build && cd build - - ../configure - --enable-tests - CFLAGS="-O0 --coverage" - CXXFLAGS="-O0 --coverage" - LDFLAGS="--coverage" - - make -j$(nproc) - - cd tests - - make -j$(nproc) core - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./core -as - - make -j$(nproc) api - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::NORNS_TASK]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_error]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_iotask_init]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_resource_init]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_buffer_to_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_local_posix_files]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_errors]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_links]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_to_posix_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_to_posix_subdir]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_errors]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_links]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_memory_to_posix_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_memory_to_posix_file_errors]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_to_posix_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_to_posix_subdir]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_remove_local_posix_files]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_add_process]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_register_job]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_register_namespace]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_remove_process]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_send_command]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_status]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_unregister_job]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_unregister_namespace]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_update_job]" - - after_script: - - (cd build && ../gencov.sh) - - genhtml -o build/html/coverage build/norns.info - - if [[ -e build/tests.log ]]; - then - cat $(tail -1 build/tests.log)/config/urd.log; - fi - - artifacts: - paths: - - build/html/coverage/ - -test:optimized: - image: ubuntu:latest - stage: test - - # Install dependencies - before_script: - - apt-get update && - apt-get upgrade -y && - apt-get install -y - git - build-essential - autotools-dev - automake - autoconf - libtool - pkg-config - libboost-system-dev - libboost-filesystem-dev - libboost-program-options-dev - libboost-thread-dev - libboost-regex-dev - libprotobuf-dev - protobuf-compiler - libprotobuf-c-dev - protobuf-c-compiler - libyaml-cpp-dev - libyaml-dev - libarchive-dev - libcap2-bin - valgrind - cmake - - - pushd . && - git clone https://github.com/ofiwg/libfabric.git && - cd libfabric && - ./autogen.sh && - mkdir build && - cd build && - ../configure && - make -j $(nproc) && - make install && - popd && - ldconfig - - - pushd . && - git clone https://github.com/mercury-hpc/mercury.git && - cd mercury && - mkdir build && - cd build && - cmake - -DCMAKE_BUILD_TYPE:STRING=Debug - -DBUILD_TESTING:BOOL=OFF - -DMERCURY_USE_SM_ROUTING:BOOL=OFF - -DMERCURY_USE_SELF_FORWARD:BOOL=OFF - -DMERCURY_USE_CHECKSUMS:BOOL=OFF - -DMERCURY_USE_BOOST_PP:BOOL=ON - -DMERCURY_USE_EAGER_BULK:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=ON - -DNA_USE_OFI:BOOL=ON - .. && - make -j $(nproc) && - make install && - popd && - ldconfig - - # Build and test - script: - - ./bootstrap.sh - - mkdir build && cd build - - ../configure - --enable-tests - - make -j$(nproc) - - cd tests - - make -j$(nproc) core - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./core -as - - make -j$(nproc) api - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::NORNS_TASK]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_error]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_iotask_init]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_resource_init]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_buffer_to_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_local_posix_files]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_errors]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_links]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_to_posix_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_pull_to_posix_subdir]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_errors]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_links]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_memory_to_posix_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_memory_to_posix_file_errors]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_to_posix_file]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_push_to_posix_subdir]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_remove_local_posix_files]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_add_process]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_register_job]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_register_namespace]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_remove_process]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_send_command]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_status]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_unregister_job]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_unregister_namespace]" - - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::nornsctl_update_job]" - - after_script: - - if [[ -e build/tests.log ]]; - then - cat $(tail -1 build/tests.log)/config/urd.log; - fi + image: bscstorage/norns-build-deps:gcc8.1-libfabric1.7.1-mercury1.0.1 + stage: test + dependencies: + - build:coverage + variables: + NORNS_DEBUG_CONFIG_FILE_OVERRIDE: 1 + script: + - | + ( + set -Eeuo pipefail + set -x + cd build/tests + ./core -as + ./api -as "[api::NORNS_TASK]" + ./api -as "[api::norns_error]" + ./api -as "[api::norns_iotask_init]" + ./api -as "[api::norns_resource_init]" + ./api -as "[api::norns_submit]" + ./api -as "[api::norns_submit_copy_buffer_to_file]" + ./api -as "[api::norns_submit_copy_local_posix_files]" + ./api -as "[api::norns_submit_pull_errors]" + ./api -as "[api::norns_submit_pull_links]" + ./api -as "[api::norns_submit_pull_to_posix_file]" + ./api -as "[api::norns_submit_pull_to_posix_subdir]" + ./api -as "[api::norns_submit_push_errors]" + ./api -as "[api::norns_submit_push_links]" + ./api -as "[api::norns_submit_push_memory_to_posix_file]" + ./api -as "[api::norns_submit_push_memory_to_posix_file_errors]" + ./api -as "[api::norns_submit_push_to_posix_file]" + ./api -as "[api::norns_submit_push_to_posix_subdir]" + ./api -as "[api::norns_submit_remove_local_posix_files]" + ./api -as "[api::nornsctl_add_process]" + ./api -as "[api::nornsctl_register_job]" + ./api -as "[api::nornsctl_register_namespace]" + ./api -as "[api::nornsctl_remove_process]" + ./api -as "[api::nornsctl_send_command]" + ./api -as "[api::nornsctl_status]" + ./api -as "[api::nornsctl_unregister_job]" + ./api -as "[api::nornsctl_unregister_namespace]" + ./api -as "[api::nornsctl_update_job]" + cd ${CI_PROJECT_DIR}/build + ${CI_PROJECT_DIR}/gencov.sh + genhtml -o html/coverage norns.info + ) + + artifacts: + paths: + - build/html/coverage/ + expire_in: 1 week + pages: image: alpine:latest @@ -371,5 +558,5 @@ pages: paths: - public expire_in: 30 days - only: - - master +# only: +# - master diff --git a/configure.ac b/configure.ac index 320d1e8aa63cd49a21230d2c62d1bce778d44905..24a93e71bdaf7fe9d30e967a1afc91ab5cb17f65 100644 --- a/configure.ac +++ b/configure.ac @@ -125,11 +125,20 @@ AX_BOOST_ASIO AX_BOOST_PROGRAM_OPTIONS AX_BOOST_THREAD -# only check for boost_regex if we are building tests -AS_IF([test "x$is_enabled_build_tests" = "xyes"], - [ AX_BOOST_REGEX - AC_CONFIG_FILES(tests/Makefile) +# check whether the compiler has a functional std::regex +AX_GCC_WORKING_STD_REGEX +AS_IF([test "x$gcc_has_working_std_regex" = xno], + [ + # fallback to boost::regex + AC_MSG_WARN([falling back to boost::regex because std::regex is not functional]) + AX_BOOST_REGEX ], []) +AM_CONDITIONAL([HAVE_WORKING_STD_REGEX], + test x$GCC_HAS_WORKING_STD_REGEX = xyes) + +# only check for std::regex/boost::regex if we are building tests +AS_IF([test "x$is_enabled_build_tests" = "xyes"], + [ AC_CONFIG_FILES(tests/Makefile) ], []) # check for mercury PKG_CHECK_MODULES([MERCURY], [mercury >= 0.26]) diff --git a/m4/ax_gcc_working_std_regex.m4 b/m4/ax_gcc_working_std_regex.m4 new file mode 100644 index 0000000000000000000000000000000000000000..b0cf1a297fc79e4bd763ad7c5ad610aaff5c87c1 --- /dev/null +++ b/m4/ax_gcc_working_std_regex.m4 @@ -0,0 +1,67 @@ +# SYNOPSIS +# +# AX_GCC_WORKING_STD_REGEX +# +# DESCRIPTION +# +# This macro checks if GCC has a working implementation of std::regex, since +# GCC 4.7/4.8 provided only valid headers and function stubs. Further +# information is available: +# . +# +# If the std::regex implementation is functional, the macro will set the +# variable 'gcc_has_working_std_regex' to 'yes' and AC_DEFINE the C preprocessor +# variable HAVE_WORKING_STD_REGEX. +# +# An automake conditional can be subsequently defined as +# AM_CONDITIONAL([HAVE_WORKING_STD_REGEX], +# [test x$gcc_has_working_std_regex = xyes]) +# +# LICENSE +# +# Copyright (c) 2019 Alberto Miranda +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 10 + +AC_DEFUN([AX_GCC_WORKING_STD_REGEX], +[ + gcc_has_working_std_regex=no + AC_CACHE_CHECK( + [whether GCC has a working std::regex implementation], + ax_cv_gcc_working_regex, + [ + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ @%:@include ]], + [[ + @%:@if __cplusplus >= 201103L && \ + (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \ + (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \ + defined(_GLIBCXX_REGEX_STATE_LIMIT) || \ + (defined(_GLIBCXX_RELEASE) && \ + _GLIBCXX_RELEASE > 4))) + @%:@define HAVE_WORKING_REGEX 1 + @%:@else + @%:@define HAVE_WORKING_REGEX 0 + @%:@error std::regex does not work + @%:@endif + ]] + )], + ax_cv_gcc_working_regex=yes, + ax_cv_gcc_working_regex=no) + AC_LANG_POP([C++]) + ] + ) + + if test "x$ax_cv_gcc_working_regex" = "xyes"; then + gcc_has_working_std_regex=yes + AC_DEFINE([HAVE_WORKING_STD_REGEX], [1], + [define if the std::regex implementation works as expected]) + fi +]) diff --git a/src/rpcs.hpp b/src/rpcs.hpp index f13cef8f39a99db2ca9488fa5443cb514a55aaf9..7bb0efdec4600a2adc34958095deed7158c8cb5b 100644 --- a/src/rpcs.hpp +++ b/src/rpcs.hpp @@ -51,7 +51,7 @@ #ifndef HG_GEN_PROC_NAME #define HG_GEN_PROC_NAME(struct_type_name) \ - hermes::detail::hg_proc_ ## struct_type_name + &hermes::detail::hg_proc_ ## struct_type_name #endif // forward declarations diff --git a/tests/Makefile.am b/tests/Makefile.am index 483232f0fdabb538c8bbe33b1f952f07bc470e48..bb24660628a1505bc8d4deb6008ba7b3946ae9a6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -100,7 +100,6 @@ api_LDFLAGS = \ @BOOST_PROGRAM_OPTIONS_LIB@ \ @BOOST_SYSTEM_LIB@ \ @BOOST_THREAD_LIB@ \ - @BOOST_REGEX_LIB@ \ @PROTOBUF_LIBS@ \ -no-install \ -Wl,-rpath,$(top_builddir)/lib/.libs \ @@ -109,6 +108,10 @@ api_LDFLAGS = \ $(top_builddir)/lib/libnornsctl_debug.la \ $(END) +if !HAVE_WORKING_STD_REGEX +api_LDFLAGS += @BOOST_REGEX_LIB@ +endif + EXTRA_api_DEPENDENCIES = \ $(top_builddir)/src/liburd_aux.la \ $(top_builddir)/lib/libnorns_debug.la \ @@ -178,13 +181,16 @@ core_LDFLAGS = \ @BOOST_PROGRAM_OPTIONS_LIB@ \ @BOOST_SYSTEM_LIB@ \ @BOOST_THREAD_LIB@ \ - @BOOST_REGEX_LIB@ \ @PROTOBUF_LIBS@ \ $(top_builddir)/src/liburd_aux.la \ $(top_builddir)/lib/libnorns_debug.la \ $(top_builddir)/lib/libnornsctl_debug.la \ $(END) +if !HAVE_WORKING_STD_REGEX +core_LDFLAGS += @BOOST_REGEX_LIB@ +endif + EXTRA_core_DEPENDENCIES = \ $(top_builddir)/src/liburd_aux.la \ $(top_builddir)/lib/libnorns_debug.la \ diff --git a/tests/test-env.cpp b/tests/test-env.cpp index f12fdc07a8baca7f23c78ef132578c5dec68b0d6..3aca4d32fa9d760e2898d6aa23b9bfefb5cdbd24 100644 --- a/tests/test-env.cpp +++ b/tests/test-env.cpp @@ -35,12 +35,27 @@ * SOFTWARE. * *************************************************************************/ + #include #include #include #include #include + +#include + +#ifdef HAVE_WORKING_STD_REGEX + +#include +namespace RE = std; + +#else // !HAVE_WORKING_STD_REGEX + #include +namespace RE = boost; + +#endif // HAVE_WORKING_STD_REGEX + #include #include "catch.hpp" @@ -93,16 +108,16 @@ create_config_file(const bfs::path& basedir, const bfs::path config_file = cfgdir / name; - auto outstr = boost::regex_replace(config_file::cftemplate, - boost::regex("@localstatedir@"), - cfgdir.string()); + auto outstr = RE::regex_replace(config_file::cftemplate, + RE::regex("@localstatedir@"), + cfgdir.string()); - outstr = boost::regex_replace(outstr, - boost::regex("(staging_directory:)\\s*?\".*?\"(,?)$"), - "\\1 \"" + stdir.string() + "\"\\2"); + outstr = RE::regex_replace(outstr, + RE::regex(R"((staging_directory:)\s*?".*?"(,?)(?=\n|$))"), + R"($1 ")" + stdir.string() + R"("$2)"); for(const auto& r : reps) { - outstr = boost::regex_replace(outstr, boost::regex(r.first), r.second); + outstr = RE::regex_replace(outstr, RE::regex(r.first), r.second); } bfs::ofstream outf(config_file);