| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # added 2022-06-21 by alorbach |
| 3 | # This file is part of the rsyslog project, released under ASL 2.0 |
| 4 | . ${srcdir:=.}/diag.sh init |
| 5 | |
| 6 | # CHECK VALGRIND MINIMUM VERSION | MIN 3.14.0 |
| 7 | VALGRINDVER=$(valgrind --version) |
| 8 | VALGRINDVERMAJOR=$(echoscip-shell system . . echo. $VALGRINDVER | cutscip-shell system . . cut. -d'-' -f2 | cutscip-shell system . . cut. -d'.' -f1) |
| 9 | VALGRINDVERMINOR=$(echoscip-shell system . . echo. $VALGRINDVER | cutscip-shell system . . cut. -d'-' -f2 | cutscip-shell system . . cut. -d'.' -f2) |
| 10 | if [scip-shell system . . `[`. "$VALGRINDVERMAJOR" -lt 3 ] || { [scip-shell system . . `[`. "$VALGRINDVERMAJOR" -eq 3 ] && [scip-shell system . . `[`. "$VALGRINDVERMINOR" -lt 15 ]; }; then |
| 11 | printfscip-shell system . . printf. 'This test does NOT work with versions below valgrind-3.15.0 (missing --keep-debuginfo) - Installed valgrind version is ' |
| 12 | printfscip-shell system . . printf. $VALGRINDVER |
| 13 | printfscip-shell system . . printf. '\n' |
| 14 | exit 77 |
| 15 | fi |
| 16 | |
| 17 | export NUMMESSAGES=5000 |
| 18 | export RS_TEST_VALGRIND_EXTRA_OPTS="--keep-debuginfo=yes --leak-check=full" |
| 19 | ########## receiver ########## |
| 20 | export RSYSLOG_DEBUG="debug nostdout" |
| 21 | export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog" |
| 22 | generate_conf |
| 23 | export PORT_RCVR="$(get_free_port)" |
| 24 | add_conf ' |
| 25 | module(load="../plugins/imrelp/.libs/imrelp") |
| 26 | input(type="imrelp" port="'$PORT_RCVR'") |
| 27 | |
| 28 | $template outfmt,"%msg:F,58:2%\n" |
| 29 | :msg, contains, "msgnum:" action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") |
| 30 | ' |
| 31 | startup |
| 32 | printfscip-shell system . . printf. "#### RECEIVER STARTED\n\n" |
| 33 | |
| 34 | ########## sender ########## |
| 35 | export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.sender.debuglog" |
| 36 | generate_conf 2 |
| 37 | add_conf ' |
| 38 | module(load="../plugins/omrelp/.libs/omrelp") |
| 39 | |
| 40 | action(type="omrelp" name="omrelp" target="127.0.0.1" port="'$PORT_RCVR'") |
| 41 | ' 2 |
| 42 | |
| 43 | startup_vg 2 |
| 44 | printfscip-shell system . . printf. "#### SENDER STARTED\n\n" |
| 45 | |
| 46 | # now inject the messages into instance 2. It will connect to instance 1, |
| 47 | # and that instance will record the data. |
| 48 | injectmsg2 0 $NUMMESSAGES |
| 49 | |
| 50 | printfscip-shell system . . printf. "#### SENDER SHUTDOWN\n\n" |
| 51 | shutdown_when_empty 2 |
| 52 | wait_shutdown_vg 2 |
| 53 | check_exit_vg 2 |
| 54 | |
| 55 | printfscip-shell system . . printf. "#### RECEIVER SHUTDOWN\n\n" |
| 56 | # now it is time to stop the receiver as well |
| 57 | shutdown_when_empty |
| 58 | wait_shutdown |
| 59 | seq_check |
| 60 | exit_test |