Skip to content

Commit

Permalink
testbench improvement: define state file directories for imfile tests
Browse files Browse the repository at this point in the history
Not all imfile tests have state file directories or a global working
directory defined. This results in usage of the default location.
While state file names should be sufficiently different, there is still
some riks of using the same name in different tests. That becomes
problematic if tests are run in parallel (and they are run in
parallel inside the regular CI).
  • Loading branch information
rgerhards committed Jul 28, 2023
1 parent f34eee3 commit 1193349
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 21 deletions.
2 changes: 2 additions & 0 deletions tests/imfile-basic-legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# This is part of the rsyslog testbench, licensed under ASL 2.0
. ${srcdir:=.}/diag.sh init
NUMMESSAGES=50000
mkdir WorkDirectory $RSYSLOG_DYNNAME.work
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.work
$ModLoad ../plugins/imfile/.libs/imfile
$InputFileName ./'$RSYSLOG_DYNNAME'.input
$InputFileTag file:
Expand Down
7 changes: 5 additions & 2 deletions tests/imfile-endmsg.regex-with-example-vg.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/bash
# This is part of the rsyslog testbench, licensed under ASL 2.0
# This test tests imfile endmsg.regex.
export USE_VALGRIND="YES"
. $srcdir/diag.sh check-inotify
. ${srcdir:=.}/diag.sh init
. $srcdir/diag.sh check-inotify
export USE_VALGRIND="YES"

mkdir $RSYSLOG_DYNNAME.statefiles
generate_conf
add_conf '
module(load="../plugins/imfile/.libs/imfile")
module(load="../plugins/mmnormalize/.libs/mmnormalize")
input(type="imfile"
statefile.directory="'${RSYSLOG_DYNNAME}'.statefiles"
File="./'$RSYSLOG_DYNNAME'.*.input"
Tag="file:" addMetadata="on" escapelf="off"
endmsg.regex="(^[^ ]+ (stdout|stderr) F )|(\\n\"}$)")
Expand Down
6 changes: 4 additions & 2 deletions tests/imfile-endmsg.regex-with-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
export IMFILECHECKTIMEOUT="60"
export IMFILELASTINPUTLINES="6"

mkdir $RSYSLOG_DYNNAME.statefiles
generate_conf
add_conf '
module(load="../plugins/imfile/.libs/imfile")
module(load="../plugins/mmnormalize/.libs/mmnormalize")
input(type="imfile"
statefile.directory="'${RSYSLOG_DYNNAME}'.statefiles"
File="./'$RSYSLOG_DYNNAME'.*.input"
Tag="file:" addMetadata="on" escapelf="off"
endmsg.regex="(^[^ ]+ (stdout|stderr) F )|(\\n\"}$)")
Expand Down Expand Up @@ -62,7 +64,7 @@ if $msg contains "msgnum:" then
template="outfmt"
)
'
if [ "x${USE_VALGRIND:-false}" == "xtrue" ] ; then
if [ "${USE_VALGRIND:-false}" == "true" ] ; then
startup_vg
else
startup
Expand Down Expand Up @@ -109,7 +111,7 @@ echo '{"time":"date", "stream":"stdout", "log":"msgnum:7"}' >> $RSYSLOG_DYNNAME.
content_check_with_count "$RSYSLOG_DYNNAME" $IMFILELASTINPUTLINES $IMFILECHECKTIMEOUT

shutdown_when_empty # shut down rsyslogd when done processing messages
if [ "x${USE_VALGRIND:-false}" == "xtrue" ] ; then
if [ "${USE_VALGRIND:-false}" == "true" ] ; then
wait_shutdown_vg
check_exit_vg
else
Expand Down
2 changes: 2 additions & 0 deletions tests/imfile-symlink-multi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
. $srcdir/diag.sh check-inotify
export IMFILEINPUTFILES="10"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
# comment out if you need more debug info:
global( debug.whitelist="on"
debug.files=["imfile.c"])
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module(load="../plugins/imfile/.libs/imfile"
mode="inotify" normalizePath="off")
input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input-symlink.log" Tag="file:"
Expand Down
2 changes: 2 additions & 0 deletions tests/imfile-symlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ export IMFILECHECKTIMEOUT="60"

# generate input files first. Note that rsyslog processes it as
# soon as it start up (so the file should exist at that point).
mkdir $RSYSLOG_DYNNAME.statefiles
generate_conf
add_conf '
# comment out if you need more debug info:
global( debug.whitelist="on"
debug.files=["imfile.c"])
module(load="../plugins/imfile/.libs/imfile"
statefile.directory="'${RSYSLOG_DYNNAME}'.statefiles"
mode="inotify" normalizePath="off")
input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input-symlink.log" Tag="file:"
Severity="error" Facility="local7" addMetadata="on")
Expand Down
4 changes: 3 additions & 1 deletion tests/imfile-wildcards-dirs-multi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export IMFILEINPUTFILESSTEPS="5"
#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
/* Filter out busy debug output, comment out if needed */
/*
Expand All @@ -19,6 +19,8 @@ global(
)
*/
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
Expand Down
5 changes: 3 additions & 2 deletions tests/imfile-wildcards-dirs-multi2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ export IMFILEINPUTFILESSTEPS="5"
#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
/* Filter out busy debug output, comment out if needed */
global(
debug.whitelist="off"
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
)
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
Expand Down
5 changes: 3 additions & 2 deletions tests/imfile-wildcards-dirs-multi3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ export IMFILEINPUTFILESSTEPS="5"
#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
/* Filter out busy debug output, comment out if needed */
global(
debug.whitelist="off"
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
)
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
Expand Down
5 changes: 3 additions & 2 deletions tests/imfile-wildcards-dirs-multi4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ export IMFILEINPUTFILESSTEPS="5"
#export IMFILEINPUTFILESALL=$((IMFILEINPUTFILES * IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
/* Filter out busy debug output, comment out if needed */
global(
debug.whitelist="off"
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
)
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
Expand Down
6 changes: 3 additions & 3 deletions tests/imfile-wildcards-dirs-multi5-polling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
export IMFILEINPUTFILES="8"
export IMFILEINPUTFILESSTEPS="5"
export IMFILECHECKTIMEOUT="15"
# generate input files first. Note that rsyslog processes it as
# soon as it start up (so the file should exist at that point).

# Start rsyslog now before adding more files
mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
global( debug.whitelist="on"
debug.files=["imfile.c", "stream.c"])
# debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q",
# "msg.c", "../action.c", "imdiag.c"])
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module(load="../plugins/imfile/.libs/imfile" mode="polling" pollingInterval="1")
input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input.dir?/*/*.logfile"
Expand Down
10 changes: 5 additions & 5 deletions tests/imfile-wildcards-dirs-multi5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export IMFILEINPUTFILES="8" #"8"
export IMFILEINPUTFILESSTEPS="5" #"5"
#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="60"
# generate input files first. Note that rsyslog processes it as
# soon as it start up (so the file should exist at that point).

# Start rsyslog now before adding more files
mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
global( debug.whitelist="on"
global( workDirectory="./'"$RSYSLOG_DYNNAME"'.work"
debug.whitelist="on"
debug.files=["imfile.c"])
module(load="../plugins/imfile/.libs/imfile" mode="inotify" pollingInterval="1")
Expand Down Expand Up @@ -80,8 +80,8 @@ do
./msleep 1000
done

shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
shutdown_when_empty
wait_shutdown
#echo rsyslog.debug:
#cat rsyslog.debug
exit_test
5 changes: 3 additions & 2 deletions tests/imfile-wildcards-dirs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
export IMFILEINPUTFILES="10"
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
/* Filter out busy debug output, comment out if needed */
global(
debug.whitelist="off"
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
)
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
Expand Down
3 changes: 3 additions & 0 deletions tests/imfile-wildcards-dirs2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export IMFILEINPUTFILESSTEPS="5"
#export IMFILEINPUTFILESALL=$(($IMFILEINPUTFILES * $IMFILEINPUTFILESSTEPS))
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
Expand All @@ -16,6 +17,8 @@ global(
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
)
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module( load="../plugins/imfile/.libs/imfile"
mode="inotify"
PollingInterval="1")
Expand Down
3 changes: 3 additions & 0 deletions tests/imfile-wildcards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ export IMFILEINPUTFILES="10"
export IMFILELASTINPUTLINES="3"
export IMFILECHECKTIMEOUT="60"

mkdir "$RSYSLOG_DYNNAME.work"
generate_conf
add_conf '
# comment out if you need more debug info:
global( debug.whitelist="on"
debug.files=["imfile.c"])
global(workDirectory="./'"$RSYSLOG_DYNNAME"'.work")
module(load="../plugins/imfile/.libs/imfile"
mode="inotify" normalizePath="off")
Expand Down

0 comments on commit 1193349

Please sign in to comment.