gprof test/CI integration

Signed-off-by: lns <matzeton@googlemail.com>
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
lns
2022-07-03 17:38:43 +02:00
committed by Ivan Nardi
parent 1a01e8dc68
commit f2d1edbedf
3 changed files with 42 additions and 2 deletions
+26 -1
View File
@@ -91,7 +91,7 @@ jobs:
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison doxygen
- name: Configure nDPI library
run: |
./autogen.sh --with-only-libndpi
./autogen.sh --with-only-libndpi --enable-option-checking=fatal
- name: Generate Documentation
run: |
pip install --upgrade pip
@@ -105,6 +105,31 @@ jobs:
path: doc/_build/ndpi-documentation-upload
retention-days: 7
performance:
name: Performance (ubuntu-latest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Ubuntu Prerequisites
run: |
sudo apt-get update
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison libpcap-dev
sudo apt-get install golang-1.16-go libgoogle-perftools-dev
env GO111MODULE=on go install github.com/google/pprof@latest
sudo ln -s ${HOME}/go/bin/pprof /usr/bin/pprof
pprof -h
- name: Configure nDPI library
run: |
./autogen.sh --enable-gprof --enable-option-checking=fatal ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }}
- name: Build nDPI library
run: |
make
- name: Performance Profiling
run: |
env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libprofiler.so ./tests/do.sh
test-scripts:
name: Test Utils (ubuntu-latest)
runs-on: ubuntu-latest
+3
View File
@@ -277,6 +277,7 @@ return 0;
])
AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
GPROF_ENABLED=0
AS_IF([test "x$enable_gprof" = "xyes"], [
PKG_CHECK_MODULES([PROFILER], [libprofiler],,[
AC_MSG_ERROR([libprofiler not available. Required for profiling support.])
@@ -284,6 +285,7 @@ AS_IF([test "x$enable_gprof" = "xyes"], [
PKG_CHECK_MODULES([TCMALLOC], [libtcmalloc],,[
AC_MSG_ERROR([libtcmalloc not available. Required for profiling support.])
])
GPROF_ENABLED=1
GPROF_LIBS="${pkg_cv_PROFILER_LIBS} ${pkg_cv_TCMALLOC_LIBS}"
GPROF_CFLAGS="${pkg_cv_PROFILER_CFLAGS} ${pkg_cv_TCMALLOC_CFLAGS}"
])
@@ -356,6 +358,7 @@ AC_SUBST(JSONC_CFLAGS)
AC_SUBST(JSONC_LIBS)
AC_SUBST(GPROF_CFLAGS)
AC_SUBST(GPROF_LIBS)
AC_SUBST(GPROF_ENABLED)
AC_SUBST(USE_HOST_LIBGCRYPT)
AC_SUBST(PCRE_ENABLED)
AC_SUBST(HANDLE_TLS_SIGS)
+13 -1
View File
@@ -20,6 +20,7 @@ CMD_WDIFF="$(which wdiff)"
CMD_COLORDIFF="$(which colordiff)"
EXE_SUFFIX=@EXE_SUFFIX@
GPROF_ENABLED=@GPROF_ENABLED@
PCRE_ENABLED=@PCRE_ENABLED@
PCRE_PCAPS="WebattackRCE.pcap"
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.pcapng 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 os_detected.pcapng quic_frags_ch_out_of_order_same_packet_craziness.pcapng quic_frags_ch_in_multiple_packets.pcapng quic-v2-00.pcapng"
@@ -34,6 +35,12 @@ if [ ! -x "../example/ndpiReader${EXE_SUFFIX}" ]; then
exit 1
fi
if [ ${GPROF_ENABLED} -eq 1 ]; then
GPROF="$(which pprof)"
else
GPROF=false
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/
@@ -74,7 +81,7 @@ check_results() {
if [ -f result/$f.out ]; then
CMD="$READER -q -K JSON -k /dev/null -t -i pcap/$f -w /tmp/reader.out -v 2"
$CMD
CPUPROFILE=result/$f.cprof HEAPPROFILE=result/$f $CMD
CMD_RET=$?
if [ $CMD_RET -eq 0 ]; then
NUM_DIFF=`${CMD_DIFF} result/$f.out /tmp/reader.out | wc -l`
@@ -99,6 +106,11 @@ check_results() {
/bin/rm -f /tmp/reader.out
fi
done
if [ ${GPROF_ENABLED} -eq 1 ]; then
${GPROF} -top -nodecount 100 -nodefraction 0 -show '^(ndpi)' ../example/ndpiReader${EXE_SUFFIX} ./result/*.cprof || RC=$(( RC + 1 ))
${GPROF} -top -nodecount 100 -nodefraction 0 -show '^(ndpi)' ../example/ndpiReader${EXE_SUFFIX} ./result/*.heap || RC=$(( RC + 1 ))
fi
}
if [ $FUZZY_TESTING_ENABLED -eq 1 ]; then