summaryrefslogtreecommitdiffstats
path: root/tests/rscript_int2Hex.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_int2Hex.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_int2Hex.sh')
-rwxr-xr-xtests/rscript_int2Hex.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/rscript_int2Hex.sh b/tests/rscript_int2Hex.sh
new file mode 100755
index 0000000..9ff5e26
--- /dev/null
+++ b/tests/rscript_int2Hex.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# add 2017-02-09 by Jan 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")
+
+set $!ip!v0 = int2hex("");
+set $!ip!v1 = int2hex("0");
+set $!ip!v2 = int2hex("1");
+set $!ip!v4 = int2hex("375894");
+set $!ip!v6 = int2hex("16");
+set $!ip!v8 = int2hex("4294967295");
+
+set $!ip!e1 = int2hex("a");
+
+template(name="outfmt" type="string" string="%!ip%\n")
+local4.* action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
+'
+startup
+tcpflood -m1 -y
+shutdown_when_empty
+wait_shutdown
+export EXPECTED='{ "v0": "0", "v1": "0", "v2": "1", "v4": "5bc56", "v6": "10", "v8": "ffffffff", "e1": "NAN" }'
+cmp_exact
+exit_test