testbench: fix final issues for python 3 transition

Thanks to Michael Biebl for his help on this issue.

This patch also contains some slight test modernization and
a "name fix" for a non-valgrind test.

closes https://github.com/rsyslog/rsyslog/issues/3853
This commit is contained in:
Rainer Gerhards 2020-01-23 09:33:56 +01:00
parent 24e323988d
commit 618f743299
No known key found for this signature in database
GPG Key ID: 0CB6B2A8BE80B499
8 changed files with 12 additions and 28 deletions

View File

@ -185,6 +185,7 @@ TESTS += \
glbl_setenv_err.sh \
glbl_setenv_err_too_long.sh \
glbl_setenv.sh \
mmexternal-SegFault.sh \
nested-call-shutdown.sh \
dnscache-TTL-0.sh \
invalid_nested_include.sh \
@ -473,7 +474,6 @@ TESTS += \
rscript_backticks_empty_envvar-vg.sh \
rscript-config_enable-off-vg.sh \
prop-jsonmesg-vg.sh \
mmexternal-SegFault-vg.sh \
mmexternal-InvldProg-vg.sh \
internal-errmsg-memleak-vg.sh \
glbl-oversizeMsg-log-vg.sh \
@ -1558,7 +1558,7 @@ EXTRA_DIST= \
imbatchreport_delete_toolarge.sh \
imbatchreport_rename_toolarge.sh \
imbatchreport_errmsg_no_params-vg.sh \
mmexternal-SegFault-vg.sh \
mmexternal-SegFault.sh \
mmexternal-SegFault-empty-jroot-vg.sh \
testsuites/mmexternal-SegFault-mm-python.py \
mmexternal-InvldProg-vg.sh \

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
# call this via "python[3] script name"
import sys
for _ in range(10):

View File

@ -1,32 +1,23 @@
#!/bin/bash
# add 2017-11-06 by PascalWithopf, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
module(load="../plugins/imtcp/.libs/imtcp")
module(load="../plugins/mmexternal/.libs/mmexternal")
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
template(name="outfmt" type="string" string="-%$!%-\n")
if $msg contains "msgnum:" then {
action(type="mmexternal" interface.input="fulljson"
binary="testsuites/mmexternal-SegFault-mm-python.py")
binary="'$PYTHON' '${srcdir}'/testsuites/mmexternal-SegFault-mm-python.py")
action(type="omfile" template="outfmt" file=`echo $RSYSLOG_OUT_LOG`)
}
'
startup_vg
tcpflood -m1 -M "\"<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1\""
injectmsg litteral "<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1"
shutdown_when_empty
wait_shutdown_vg
check_exit_vg
echo '-{ "sometag": "somevalue" }-' | cmp - $RSYSLOG_OUT_LOG
if [ ! $? -eq 0 ]; then
echo "invalid response generated, $RSYSLOG_OUT_LOG is:"
cat $RSYSLOG_OUT_LOG
error_exit 1
fi;
export EXPECTED='-{ "sometag": "somevalue" }-'
cmp_exact
exit_test

View File

@ -4,9 +4,7 @@
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
module(load="../plugins/imtcp/.libs/imtcp")
module(load="../plugins/mmexternal/.libs/mmexternal")
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
set $!x = "a";
template(name="outfmt" type="string" string="-%$!%-\n")
@ -18,12 +16,9 @@ if $msg contains "msgnum:" then {
}
'
startup
#startup_vg
tcpflood -m1 -M "\"<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1\""
injectmsg litteral "<129>Mar 10 01:00:00 172.20.245.8 tag:msgnum:1"
shutdown_when_empty
wait_shutdown
#wait_shutdown_vg
#check_exit_vg
export EXPECTED='-{ "x": "a", "sometag": "somevalue" }-'
cmp_exact

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
# call this via "python[3] script name"
import argparse
import json
import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
# call this via "python[3] script name"
# Added 2017-11-05 by Stephen Workman, released under ASL 2.0
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
# call this via "python[3] script name"
import sys
from pysnmp.entity import engine, config
from pysnmp.carrier.asyncore.dgram import udp

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
# call this via "python[3] script name"
# a small url encoder for testbench purposes
# written 2018-11-05 by Rainer Gerhards
# part of the rsyslog testbench, released under ASL 2.0