summaryrefslogtreecommitdiffstats
path: root/tests/rscript_int2Hex.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-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