1#!/bin/bash
2# test many concurrent tcp connections
3# addd 2016-03-02 by RGerhards, released under ASL 2.0
4# the key point of this test is that we do not abort and
5# instead provide the defined return value (0)
6# requires faketime
7echo \[timegenerated-dateordinal-invld\]: check invalid dates with ordinal format
8. ${srcdir:=.}/diag.sh init
9
10. $srcdir/faketime_common.sh
11
12export TZ=UTC+00:00
13export EXPECTED="001" # same for all tests
14
15generate_conf
16add_conf '
17module(load="../plugins/imtcp/.libs/imtcp")
18input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
19
20template(name="outfmt" type="string"
21	 string="%timegenerated:::date-ordinal%\n")
22:msg, contains, "msgnum:" action(type="omfile" template="outfmt"
23			         file=`echo $RSYSLOG_OUT_LOG`)
24'
25
26
27echo "***SUBTEST: check 1800-01-01"
28rm -f $RSYSLOG_OUT_LOG	# do cleanup of previous subtest
29FAKETIME='1800-01-01 00:00:00' startup
30tcpflood -m1
31shutdown_when_empty
32wait_shutdown
33cmp_exact
34
35
36echo "***SUBTEST: check 1960-01-01"
37rm -f $RSYSLOG_OUT_LOG	# do cleanup of previous subtest
38FAKETIME='1960-01-01 00:00:00' startup
39tcpflood -m1
40shutdown_when_empty
41wait_shutdown
42cmp_exact
43
44
45echo "***SUBTEST: check 2101-01-01"
46rm -f $RSYSLOG_OUT_LOG	# do cleanup of previous subtest
47FAKETIME='2101-01-01 00:00:00' startup
48tcpflood -m1
49shutdown_when_empty
50wait_shutdown
51cmp_exact
52
53
54echo "***SUBTEST: check 2500-01-01"
55rm -f $RSYSLOG_OUT_LOG	# do cleanup of previous subtest
56FAKETIME='2500-01-01 00:00:00' startup
57tcpflood -m1
58shutdown_when_empty
59wait_shutdown
60cmp_exact
61
62exit_test
63