summaryrefslogtreecommitdiffstats
path: root/tests/rscript_script_error.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/rscript_script_error.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rscript_script_error.sh')
-rwxr-xr-xtests/rscript_script_error.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/rscript_script_error.sh b/tests/rscript_script_error.sh
new file mode 100755
index 0000000..372e8d0
--- /dev/null
+++ b/tests/rscript_script_error.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+# Added 2017-12-09 by Rainer Gerhards, released under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+module(load="../plugins/imtcp/.libs/imtcp")
+input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
+template(name="outfmt" type="string" string="%$!%\n")
+
+local4.* {
+ set $!valid!serial = parse_time("2017-10-05T01:10:11Z");
+ set $!valid!error = script_error();
+ set $!invalid!serial = parse_time("not a date/time");
+ set $!invalid!error = script_error();
+ set $!valid2!serial = parse_time("2017-10-05T01:10:11Z");
+ set $!valid2!error = script_error();
+ action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
+}
+'
+
+startup
+tcpflood -m1
+shutdown_when_empty
+wait_shutdown
+
+# Our fixed and calculated expected results
+export EXPECTED='{ "valid": { "serial": 1507165811, "error": 0 }, "invalid": { "serial": 0, "error": 1 }, "valid2": { "serial": 1507165811, "error": 0 } }'
+cmp_exact $RSYSLOG_OUT_LOG
+
+exit_test