diff options
-rw-r--r-- | .github/workflows/build.yml | 23 | ||||
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | test/run_tests.sh | 5 |
4 files changed, 33 insertions, 12 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e235b261..6d9cab8d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: fail-fast: true matrix: os: ["ubuntu-latest", "ubuntu-18.04"] - ndpid_gcrypt: ["-DNDPI_WITH_GCRYPT=OFF", ""] + ndpid_gcrypt: ["-DNDPI_WITH_GCRYPT=OFF", "-DNDPI_WITH_GCRYPT=ON"] steps: - uses: actions/checkout@v2 @@ -27,7 +27,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get update - sudo apt-get install autoconf automake cmake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev + sudo apt-get install autoconf automake cmake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev zlib1g-dev sudo apt-get install gcc-arm-linux-gnueabihf gcc-mingw-w64 libc6-dev - name: Install Ubuntu Prerequisites (libgcrypt) if: startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.ndpid_gcrypt, '-DNDPI_WITH_GCRYPT=OFF') @@ -36,7 +36,22 @@ jobs: - name: Configure nDPI run: | mkdir build && cd build - env CMAKE_C_FLAGS='-Werror' cmake .. -DBUILD_EXAMPLES=ON -DBUILD_NDPI=ON -DENABLE_SANITIZER=ON ${{ matrix.ndpid_gcrypt }} + env CMAKE_C_FLAGS='-Werror' cmake .. -DBUILD_EXAMPLES=ON -DBUILD_NDPI=ON -DENABLE_SANITIZER=ON -DENABLE_ZLIB=ON ${{ matrix.ndpid_gcrypt }} - name: Build nDPI run: | - make -C build all + make -C build all VERBOSE=1 + - name: Test EXEC + run: | + ./build/nDPId-test || test $? -eq 1 + ./build/nDPId -h || test $? -eq 1 + - name: Test DIFF + if: startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.ndpid_gcrypt, '-DNDPI_WITH_GCRYPT=OFF') + run: | + ./test/run_tests.sh ./libnDPI ./build/nDPId-test + - name: Daemon + run: | + make -C ./build daemon VERBOSE=1 + make -C ./build daemon VERBOSE=1 + - name: Dist + run: | + ./scripts/make-dist.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a61af0a8..8952708b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,11 @@ option(ENABLE_ZLIB "Enable zlib support for nDPId (experimental)." OFF) option(BUILD_EXAMPLES "Build C examples." ON) option(BUILD_NDPI "Clone and build nDPI from github." OFF) option(NDPI_NO_PKGCONFIG "Do not use pkgconfig to search for libnDPI." OFF) +if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI OR NDPI_NO_PKGCONFIG) + option(NDPI_WITH_GCRYPT "Link static libndpi library against libgcrypt." ON) + option(NDPI_WITH_PCRE "Link static libndpi library against libpcre." OFF) + option(NDPI_WITH_MAXMINDDB "Link static libndpi library against libmaxminddb." OFF) +endif() set(STATIC_LIBNDPI_INSTALLDIR "" CACHE STRING "Path to a installation directory of libnDPI e.g. /opt/libnDPI/usr") set(CROSS_COMPILE_TRIPLET "" CACHE STRING "Host triplet used to enable cross compiling.") @@ -55,7 +60,7 @@ if(NOT CROSS_COMPILE_TRIPLET STREQUAL "") set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) endif() -if(BUILD_NDPI) +if(BUILD_NDPI AND NDPI_WITH_GCRYPT) enable_testing() add_test(NAME run_tests COMMAND "${CMAKE_SOURCE_DIR}/test/run_tests.sh" @@ -140,10 +145,6 @@ if(STATIC_LIBNDPI_INSTALLDIR STREQUAL "" AND BUILD_NDPI) endif() if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI OR NDPI_NO_PKGCONFIG) - option(NDPI_WITH_GCRYPT "Link static libndpi library against libgcrypt." ON) - option(NDPI_WITH_PCRE "Link static libndpi library against libpcre." OFF) - option(NDPI_WITH_MAXMINDDB "Link static libndpi library against libmaxminddb." OFF) - if(NDPI_WITH_GCRYPT) find_package(GCRYPT "1.4.2" REQUIRED) endif() @@ -221,7 +222,7 @@ if(BUILD_EXAMPLES) "${CMAKE_SOURCE_DIR}/dependencies/uthash/src") add_executable(nDPIsrvd-captured examples/c-captured/c-captured.c utils.c) - if(STATIC_LIBNDPI_INSTALLDIR STREQUAL "" AND BUILD_NDPI) + if(BUILD_NDPI) add_dependencies(nDPIsrvd-captured libnDPI) endif() target_compile_definitions(nDPIsrvd-captured PRIVATE ${NDPID_DEFS}) @@ -1,5 +1,5 @@ - - +[](https://github.com/lnslbrty/nDPId/actions/workflows/build.yml) +[](https://gitlab.com/lnslbrty/nDPId/-/pipelines) # abstract diff --git a/test/run_tests.sh b/test/run_tests.sh index f5acfb4a5..df6fdd277 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -31,6 +31,11 @@ else nDPI_SOURCE_ROOT="$(realpath "${1}")" fi +if [ ! -x "${nDPI_SOURCE_ROOT}/tests/pcap" ]; then + printf 'PCAP directory %s does not exist or you do not have the permission to access it.\n' "${nDPI_SOURCE_ROOT}/tests/pcap" >&2 + exit 2 +fi + LOCKFILE="$(realpath "${0}").lock" touch "${LOCKFILE}" |