Skip to content

Commit

Permalink
test: log network traffic generated while running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vasild committed Nov 22, 2024
1 parent 22ef95d commit 93bc0f9
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ci/test/00_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out}
# The folder for previous release binaries.
# This folder exists only on the ci guest, and on the ci host as a volume.
export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/prev_releases}
export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential pkg-config curl ca-certificates ccache python3 rsync git procps bison e2fsprogs cmake}
export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-bison build-essential ca-certificates ccache cmake curl e2fsprogs git iptables iputils-ping inetutils-telnet net-tools pkg-config procps python3 rsync tcpdump}
export GOAL=${GOAL:-install}
export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets}
export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry --"}
80 changes: 79 additions & 1 deletion ci/test/03_test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,53 @@ fi
echo "Free disk space:"
df -h

echo "CCCCCCCCCCCCCC"
id
ifconfig || :
interfaces=$(ifconfig -s |grep -v ^Iface |cut -f 1 -d ' ')
for ifname in $interfaces ; do
tcpdump -n -i $ifname -w /tmp/dump_$ifname &
done
if iptables -L ; then
iptables -A OUTPUT -m addrtype \! --dst-type LOCAL -j LOG --log-prefix "eeeee1" --log-level emerg || :
ip6tables -A OUTPUT -m addrtype \! --dst-type LOCAL -j LOG --log-prefix "eeeee1" --log-level emerg || :
iptables -A OUTPUT -j LOG --log-prefix "eeeee2" --log-level emerg || :
ip6tables -A OUTPUT -j LOG --log-prefix "eeeee2" --log-level emerg || :
logger -p user.emerg "eeeee3" || :
fi
telnet 50.6.7.8 9999 || :
telnet 127.0.0.1 1111 || :
ping -c 2 60.5.4.3 || :
ping -c 2 127.0.0.1 || :
telnet 2001:71ab:2d:b4::1 9999 || :
telnet ::1 1111 || :
ping6 -c 2 2001:71ab:2d:b4::1 || :
ping6 -c 2 ::1 || :
#DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
if iptables -v -x -n -L ; then
#iptables -D OUTPUT -j LOG
echo "dmesg"
dmesg |grep eeeee || :
dmesg || :
echo "/var/log"
ls -l /var/log/ || :
grep -r eeeee /var/log/ || :
ps ax || :
kill -SIGUSR2 $(jobs -p) || :
sleep 5
kill -SIGKILL $(jobs -p) || :
sleep 5
ps ax || :
ls -l /tmp/dump_* || :
for ifname in $interfaces ; do
echo "tcpdump reading $ifname"
chown root:root /tmp/dump_$ifname || :
tcpdump -n -r /tmp/dump_$ifname || :
done
find /etc -name "*syslog*" || :
fi
exit 34

# What host to compile for. See also ./depends/README.md
# Tests that need cross-compilation export the appropriate HOST.
# Tests that run natively guess the host
Expand Down Expand Up @@ -145,17 +192,44 @@ if [ "$RUN_CHECK_DEPS" = "true" ]; then
fi

if [ "$RUN_UNIT_TESTS" = "true" ]; then
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
echo "AAAAAAAAAAAAAA"
echo "BBBBBBBBBBBBBB" >&2
ifconfig || :
if iptables -L ; then
iptables -A OUTPUT -m addrtype \! --dst-type LOCAL -j LOG --log-prefix "RUN_UNIT_TESTS" || :
ip6tables -A OUTPUT -m addrtype \! --dst-type LOCAL -j LOG --log-prefix "RUN_UNIT_TESTS" || :
fi
telnet 50.6.7.8 9999 || :
telnet 127.0.0.1 1111 || :
ping -c 2 60.5.4.3 || :
ping -c 2 127.0.0.1 || :
telnet6 2001:71ab:2d:b4::1 9999 || :
telnet6 ::1 1111 || :
ping6 -c 2 2001:71ab:2d:b4::1 || :
ping6 -c 2 ::1 || :
#DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
if iptables -L ; then
#iptables -D OUTPUT -j LOG
echo "dmesg"
dmesg |grep RUN_UNIT_TESTS || :
echo "/var/log"
grep -r RUN_UNIT_TESTS /var/log/ || :
fi
exit 23
fi

if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
#
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${BASE_OUTDIR}"/bin/test_bitcoin --catch_system_errors=no -l test_suite
#
fi

if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
# parses TEST_RUNNER_EXTRA as an array which allows for multiple arguments such as TEST_RUNNER_EXTRA='--exclude "rpc_bind.py --ipv6"'
eval "TEST_RUNNER_EXTRA=($TEST_RUNNER_EXTRA)"
#
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/functional/test_runner.py --ci "${MAKEJOBS}" --tmpdirprefix "${BASE_SCRATCH_DIR}"/test_runner/ --ansi --combinedlogslen=99999999 --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" "${TEST_RUNNER_EXTRA[@]}" --quiet --failfast
#
fi

if [ "${RUN_TIDY}" = "true" ]; then
Expand Down Expand Up @@ -187,5 +261,9 @@ fi

if [ "$RUN_FUZZ_TESTS" = "true" ]; then
# shellcheck disable=SC2086
#
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} "${MAKEJOBS}" -l DEBUG "${DIR_FUZZ_IN}" --empty_min_time=60
#
fi

exit 1

0 comments on commit 93bc0f9

Please sign in to comment.