Disable tests that require libgcrypt if --disable-gcrypt set. (#1121)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2021-01-21 08:59:06 +01:00
committed by GitHub
parent 53415c8855
commit 399755607d
7 changed files with 114 additions and 49 deletions
+16
View File
@@ -20,6 +20,21 @@ matrix:
- libjson-c-dev
- autogen
- os: linux
env: DISABLE_GCRYPT=y
compiler: gcc
dist: bionic
addons:
apt:
packages:
- fakeroot
- debhelper
- dpkg-dev
- libpcap-dev
- libgcrypt20-dev
- libjson-c-dev
- autogen
- os: linux
compiler: clang
dist: bionic
@@ -197,6 +212,7 @@ script:
./configure ; fi
- if [ -n "$BUILD_DPKG_PACKAGE" ]; then cd ./packages/ubuntu ;
./configure && dpkg-buildpackage -b -us -uc ; cd ../.. ; fi
- if [ -n "$DISABLE_GCRYPT" ]; then ./configure --disable-gcrypt ; fi
- make
- make -C example ndpiSimpleIntegration
- make dist
+1
View File
@@ -57,6 +57,7 @@ autoreconf -ivf
cat configure | sed "s/#define PACKAGE/#define NDPI_PACKAGE/g" | sed "s/#define VERSION/#define NDPI_VERSION/g" > configure.tmp
cat configure.tmp > configure
echo "./configure $@"
chmod +x configure
./configure $@
+16 -12
View File
@@ -189,23 +189,24 @@ AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
if ! test "${with_mipsel+set}" = set; then :
dnl> GCRYPT
GCRYPT_ENABLED=1
AC_ARG_ENABLE([gcrypt],
[AS_HELP_STRING([--disable-gcrypt], [Avoid compiling with libgcrypt/libgpg-error, even if they are present. QUIC sub-classification may be missing])],
[:],
[GCRYPT_ENABLED=0],
[AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)])
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes; then :
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt"
else
$as_unset ac_cv_lib_gcrypt_gcry_cipher_checktag
AC_CHECK_LIB(gpg-error, gpg_strerror_r)
AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes -a "x$ac_cv_lib_gpg_error_gpg_strerror_r" = xyes; then :
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt -lgpg-error"
AS_IF([test "x$enable_gcrypt" = "xyes"], [
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes; then :
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt"
else
$as_unset ac_cv_lib_gcrypt_gcry_cipher_checktag
AC_CHECK_LIB(gpg-error, gpg_strerror_r)
AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes -a "x$ac_cv_lib_gpg_error_gpg_strerror_r" = xyes; then :
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt -lgpg-error"
fi
fi
fi
fi
])
dnl> PCRE
AC_ARG_WITH(pcre, [ --with-pcre Enable nDPI build with libpcre])
@@ -218,6 +219,8 @@ fi
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile tests/unit/Makefile tests/dga/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile python/Makefile fuzz/Makefile src/include/ndpi_api.h])
AC_CONFIG_FILES([tests/do.sh], [chmod +x tests/do.sh])
AC_CONFIG_FILES([tests/do_valgrind.sh], [chmod +x tests/do_valgrind.sh])
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
AC_SUBST(GIT_RELEASE)
AC_SUBST(NDPI_MAJOR)
@@ -236,5 +239,6 @@ AC_SUBST(EXTRA_TARGETS)
AC_SUBST(BUILD_MINGW)
AC_SUBST(JSONC_CFLAGS)
AC_SUBST(JSONC_LIBS)
AC_SUBST(GCRYPT_ENABLED)
AC_SUBST(GNU_PREFIX)
AC_OUTPUT
+1 -1
View File
@@ -1,6 +1,6 @@
TESTS = do.sh
EXTRA_DIST = do.sh vagrind_test.sh ossfuzz.sh pcap result
EXTRA_DIST = ossfuzz.sh pcap result
all:
@echo -n ""
+23 -1
View File
@@ -2,11 +2,19 @@
cd "$(dirname "${0}")"
GCRYPT_ENABLED=@GCRYPT_ENABLED@
GCRYPT_PCAPS="gquic.pcap quic-23.pcap quic-24.pcap quic-27.pcap quic-28.pcap quic-29.pcap quic-mvfst-22.pcap quic-mvfst-27.pcap quic-mvfst-exp.pcap quic_q50.pcap quic_t50.pcap quic_t51.pcap quic_0RTT.pcap quic_interop_V.pcapng quic-33.pcapng doq.pcapng doq_adguard.pcapng dlt_ppp.pcap"
READER="../example/ndpiReader -p ../example/protos.txt -c ../example/categories.txt"
RC=0
PCAPS=`cd pcap; /bin/ls *.pcap *.pcapng`
if [ ! -x "../example/ndpiReader" ]; then
echo "$0: Missing $(realpath ../example/ndpiReader)"
echo "$0: Run ./configure and make first"
exit 1
fi
fuzzy_testing() {
if [ -f ../fuzz/fuzz_ndpi_reader ]; then
../fuzz/fuzz_ndpi_reader -max_total_time="${MAX_TOTAL_TIME:-592}" -print_pcs=1 -workers="${FUZZY_WORKERS:-0}" -jobs="${FUZZY_JOBS:-0}" pcap/
@@ -25,7 +33,21 @@ build_results() {
}
check_results() {
for f in $PCAPS; do
for f in $PCAPS; do
SKIP_PCAP=0
if [ $GCRYPT_ENABLED -eq 0 ]; then
for g in $GCRYPT_PCAPS; do
if [ $f = $g ]; then
SKIP_PCAP=1
break
fi
done
fi
if [ $SKIP_PCAP -eq 1 ]; then
printf "%-32s\tSKIPPED\n" "$f"
continue
fi
if [ -f result/$f.out ]; then
CMD="$READER -q -t -i pcap/$f -w /tmp/reader.out -v 2"
$CMD
+57
View File
@@ -0,0 +1,57 @@
#!/bin/sh
cd "$(dirname "${0}")"
GCRYPT_ENABLED=@GCRYPT_ENABLED@
GCRYPT_PCAPS="gquic.pcap quic-23.pcap quic-24.pcap quic-27.pcap quic-28.pcap quic-29.pcap quic-mvfst-22.pcap quic-mvfst-27.pcap quic-mvfst-exp.pcap quic_q50.pcap quic_t50.pcap quic_t51.pcap quic_0RTT.pcap quic_interop_V.pcapng quic-33.pcapng doq.pcapng doq_adguard.pcapng dlt_ppp.pcap"
READER="valgrind -q --leak-check=full ../example/ndpiReader -p ../example/protos.txt -c ../example/categories.txt"
RC=0
PCAPS=`cd pcap; /bin/ls *.pcap`
if [ ! -x "../example/ndpiReader" ]; then
echo "$0: Missing $(realpath ../example/ndpiReader)"
echo "$0: Run ./configure and make first"
exit 1
fi
check_results() {
for f in $PCAPS; do
SKIP_PCAP=0
if [ $GCRYPT_ENABLED -eq 0 ]; then
for g in $GCRYPT_PCAPS; do
if [ $f = $g ]; then
SKIP_PCAP=1
break
fi
done
fi
if [ $SKIP_PCAP -eq 1 ]; then
printf "%-32s\tSKIPPED\n" "$f"
continue
fi
CMD="$READER -q -i pcap/$f > /tmp/reader.out"
$CMD
NUM_DIFF=0
if [ -f /tmp/reader.out ]; then
NUM_DIFF=`wc -l /tmp/reader.out`
fi
if [ $NUM_DIFF -eq 0 ]; then
printf "%-32s\tOK\n" "$f"
else
printf "%-32s\tERROR\n" "$f"
echo "$CMD"
cat /tmp/reader.out
RC=1
fi
/bin/rm -f /tmp/reader.out
done
}
check_results
exit $RC
-35
View File
@@ -1,35 +0,0 @@
#!/bin/sh
cd "$(dirname "${0}")"
READER="valgrind -q --leak-check=full ../example/ndpiReader -p ../example/protos.txt -c ../example/categories.txt"
RC=0
PCAPS=`cd pcap; /bin/ls *.pcap`
check_results() {
for f in $PCAPS; do
CMD="$READER -q -i pcap/$f > /tmp/reader.out"
$CMD
NUM_DIFF=0
if [ -f /tmp/reader.out ]; then
NUM_DIFF=`wc -l /tmp/reader.out`
fi
if [ $NUM_DIFF -eq 0 ]; then
printf "%-32s\tOK\n" "$f"
else
printf "%-32s\tERROR\n" "$f"
echo "$CMD"
cat /tmp/reader.out
RC=1
fi
/bin/rm -f /tmp/reader.out
done
}
check_results
exit $RC