1#!/bin/bash
2# added 2016-03-22 by RGerhards, released under ASL 2.0
3#
4# NOTE: faketime does NOT properly support subseconds,
5# so we must ensure we do not use them. Actually, what we
6# see is uninitialized data value in tv_usec, which goes
7# away as soon as we do not run under faketime control.
8# FOR THE SAME REASON, there is NO VALGRIND EQUIVALENT
9# of this test, as valgrind would abort with reports
10# of faketime.
11#
12# IMPORTANT: we use legacy style for the template to ensure
13# that subseconds works properly for this as well. This is
14# a frequent use case.
15#
16. ${srcdir:=.}/diag.sh init
17. $srcdir/faketime_common.sh
18export TZ=TEST+02:00
19generate_conf
20add_conf '
21module(load="../plugins/imtcp/.libs/imtcp")
22input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
23
24$template outfmt,"%timegenerated:::date-utc%\n"
25:msg, contains, "msgnum:" action(type="omfile" template="outfmt"
26			         file="'$RSYSLOG_OUT_LOG'")
27'
28
29echo "***SUBTEST: check 2016-03-01"
30FAKETIME='2016-03-01 12:00:00' startup
31tcpflood -m1
32shutdown_when_empty
33wait_shutdown
34export EXPECTED="Mar  1 14:00:00"
35cmp_exact
36exit_test
37