1210373Ssimon#!/bin/sh
2210373Ssimon
3210373Ssimon# $FreeBSD: stable/10/usr.sbin/newsyslog/tests/legacy_test.sh 321263 2017-07-20 00:44:01Z ngie $
4210373Ssimon
5321263Sngie# A regular expression matching the format of an RFC-5424 log line header,
6321263Sngie# including the timestamp up through the seconds indicator; it does not include
7321263Sngie# the (optional) timezone offset.
8321263SngieRFC5424_FMT='^<[0-9][0-9]*>1 [0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}'
9321263Sngie
10321263Sngie# A regular expression matching the format of an RFC-3164 (traditional syslog)
11321263Sngie# log line header, including the timestamp.
12321263SngieRFC3164_FMT='^[A-Z][a-z]{2} [ 0-9][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2}'
13321263Sngie
14210373SsimonCOUNT=0
15263226SjmmvTMPDIR=$(pwd)/work
16210373Ssimonif [ $? -ne 0 ]; then
17321263Sngie	echo "$0: Can't create temp dir, exiting..."
18321263Sngie	exit 1
19210373Ssimonfi
20210373Ssimon
21210373Ssimon# Begin an individual test
22210373Ssimonbegin()
23210373Ssimon{
24210373Ssimon	COUNT=`expr $COUNT + 1`
25210373Ssimon	OK=1
26210373Ssimon	NAME="$1"
27210373Ssimon}
28210373Ssimon
29210373Ssimon# End an individual test
30210373Ssimonend()
31210373Ssimon{
32210373Ssimon	if [ $OK = 1 ]
33210373Ssimon	then
34210373Ssimon		printf 'ok '
35210373Ssimon	else
36210373Ssimon		printf 'not ok '
37210373Ssimon	fi
38210373Ssimon	echo "$COUNT - $NAME"
39210373Ssimon}
40210373Ssimon
41210373Ssimon# Make a file that can later be verified
42210373Ssimonmkf()
43210373Ssimon{
44210373Ssimon	CN=`basename $1`
45210373Ssimon	echo "$CN-$CN" >$1
46210373Ssimon}
47210373Ssimon
48210373Ssimon# Verify that the file specified is correct
49210373Ssimonckf()
50210373Ssimon{
51210373Ssimon	if [ -f $2 ] && echo "$1-$1" | diff - $2 >/dev/null
52210373Ssimon	then
53210373Ssimon		ok
54210373Ssimon	else
55210373Ssimon		notok
56210373Ssimon	fi
57210373Ssimon}
58210373Ssimon
59210373Ssimon# Check that a file exists
60210373Ssimonckfe()
61210373Ssimon{
62210373Ssimon	if [ -f $1 ]
63210373Ssimon	then
64210373Ssimon		ok
65210373Ssimon	else
66210373Ssimon		notok
67210373Ssimon	fi
68210373Ssimon}
69210373Ssimon
70210373Ssimon# Verify that the specified file does not exist
71210373Ssimon# (is not there)
72210373Ssimoncknt()
73210373Ssimon{
74210373Ssimon	if [ -r $1 ]
75210373Ssimon	then
76210373Ssimon		notok
77210373Ssimon	else
78210373Ssimon		ok
79210373Ssimon	fi
80210373Ssimon}
81210373Ssimon
82228975Suqs# Check if a file is there, depending of if it's supposed to or not -
83228975Suqs# basically how many log files we are supposed to keep vs. how many we
84220927Ssimon# actually keep.
85220927Ssimonckntfe()
86220927Ssimon{
87220927Ssimon	curcnt=$1
88220927Ssimon	keepcnt=$2
89220927Ssimon	f=$3
90220927Ssimon
91220927Ssimon	if [ $curcnt -le $keepcnt ]
92220927Ssimon	then
93220927Ssimon		#echo Assuming file there
94220927Ssimon		ckfe $f
95220927Ssimon	else
96220927Ssimon		#echo Assuming file NOT there
97220927Ssimon		cknt $f
98220927Ssimon	fi
99220927Ssimon}
100220927Ssimon
101321263Sngie# Verify that the specified file has RFC-5424 rotation messages.
102321263Sngieckrfc5424()
103321263Sngie{
104321263Sngie	local lc=$(wc -l $1 | cut -w -f2)
105321263Sngie	local rc=$(grep -cE "${RFC5424_FMT}" $1)
106321263Sngie	if [ "$lc" -eq 0 -o "$rc" -eq 0 -o "$lc" -ne "$rc" ]
107321263Sngie	then
108321263Sngie		notok
109321263Sngie	else
110321263Sngie		ok
111321263Sngie	fi
112321263Sngie}
113220927Ssimon
114220927Ssimon
115321263Sngie# Verify that the specified file has RFC-3164 rotation messages.
116321263Sngieckrfc3164()
117321263Sngie{
118321263Sngie	local lc=$(wc -l $1 | cut -w -f2)
119321263Sngie	local rc=$(grep -cE "${RFC3164_FMT}" $1)
120321263Sngie	if [ "$lc" -eq 0 -o "$rc" -eq 0 -o "$lc" -ne "$rc" ]
121321263Sngie	then
122321263Sngie		notok
123321263Sngie	else
124321263Sngie		ok
125321263Sngie	fi
126321263Sngie}
127321263Sngie
128321263Sngie
129210373Ssimon# A part of a test succeeds
130210373Ssimonok()
131210373Ssimon{
132210373Ssimon	:
133210373Ssimon}
134210373Ssimon
135210373Ssimon# A part of a test fails
136210373Ssimonnotok()
137210373Ssimon{
138210373Ssimon	OK=0
139210373Ssimon}
140210373Ssimon
141210373Ssimon# Verify that the exit code passed is for unsuccessful termination
142210373Ssimonckfail()
143210373Ssimon{
144210373Ssimon	if [ $1 -gt 0 ]
145210373Ssimon	then
146210373Ssimon		ok
147210373Ssimon	else
148210373Ssimon		notok
149210373Ssimon	fi
150210373Ssimon}
151210373Ssimon
152210373Ssimon# Verify that the exit code passed is for successful termination
153210373Ssimonckok()
154210373Ssimon{
155210373Ssimon	if [ $1 -eq 0 ]
156210373Ssimon	then
157210373Ssimon		ok
158210373Ssimon	else
159210373Ssimon		notok
160210373Ssimon	fi
161210373Ssimon}
162210373Ssimon
163210373Ssimon# Check that there are X files which match expr
164210373Ssimonchkfcnt()
165210373Ssimon{
166210373Ssimon	cnt=$1; shift
167210373Ssimon	if [ $cnt -eq `echo "$@" | wc -w` ]
168210373Ssimon	then
169210373Ssimon		ok
170210373Ssimon	else
171210373Ssimon		notok
172210373Ssimon	fi
173210373Ssimon}
174210373Ssimon
175210373Ssimon# Check that two strings are alike
176210373Ssimonckstr()
177210373Ssimon{
178210373Ssimon	if [ "$1" = "$2" ]
179210373Ssimon	then
180210373Ssimon		ok
181210373Ssimon	else
182210373Ssimon		notok
183210373Ssimon	fi
184210373Ssimon}
185210373Ssimon
186210373Ssimontmpdir_create()
187210373Ssimon{
188210373Ssimon	mkdir -p ${TMPDIR}/log ${TMPDIR}/alog
189210373Ssimon	cd ${TMPDIR}/log
190210373Ssimon}
191210373Ssimon
192210373Ssimontmpdir_clean()
193210373Ssimon{
194210373Ssimon	cd ${TMPDIR}
195210373Ssimon	rm -rf "${TMPDIR}/log" "${TMPDIR}/alog" newsyslog.conf
196210373Ssimon}
197210373Ssimon
198210373Ssimonrun_newsyslog()
199210373Ssimon{
200210373Ssimon
201210373Ssimon	newsyslog -f ../newsyslog.conf -F -r "$@"
202210373Ssimon}
203210373Ssimon
204210373Ssimontests_normal_rotate() {
205210373Ssimon	ext="$1"
206210373Ssimon	dir="$2"
207210373Ssimon
208210373Ssimon	if [ -n "$dir" ]; then
209210373Ssimon		newsyslog_args=" -a ${dir}"
210210373Ssimon		name_postfix="${ext} archive dir"
211210373Ssimon	else
212210373Ssimon		newsyslog_args=""
213210373Ssimon		name_postfix="${ext}"
214210373Ssimon	fi
215210373Ssimon
216210373Ssimon	tmpdir_create
217210373Ssimon
218210373Ssimon	begin "create file ${name_postfix}" -newdir
219210373Ssimon	run_newsyslog -C
220210373Ssimon	ckfe $LOGFNAME
221210373Ssimon	cknt ${dir}${LOGFNAME}.0${ext}
222210373Ssimon	end
223210373Ssimon
224210373Ssimon	begin "rotate normal 1 ${name_postfix}"
225210373Ssimon	run_newsyslog $newsyslog_args
226210373Ssimon	ckfe ${LOGFNAME}
227210373Ssimon	ckfe ${dir}${LOGFNAME}.0${ext}
228210373Ssimon	cknt ${dir}${LOGFNAME}.1${ext}
229210373Ssimon	end
230210373Ssimon
231210373Ssimon	begin "rotate normal 2 ${name_postfix}"
232210373Ssimon	run_newsyslog $newsyslog_args
233210373Ssimon	ckfe ${LOGFNAME}
234210373Ssimon	ckfe ${dir}${LOGFNAME}.0${ext}
235210373Ssimon	ckfe ${dir}${LOGFNAME}.1${ext}
236210373Ssimon	cknt ${dir}${LOGFNAME}.2${ext}
237210373Ssimon	end
238210373Ssimon
239210373Ssimon	begin "rotate normal 3 ${name_postfix}"
240210373Ssimon	run_newsyslog $newsyslog_args
241210373Ssimon	ckfe ${LOGFNAME}
242210373Ssimon	ckfe ${dir}${LOGFNAME}.0${ext}
243210373Ssimon	ckfe ${dir}${LOGFNAME}.1${ext}
244210373Ssimon	ckfe ${dir}${LOGFNAME}.2${ext}
245210373Ssimon	cknt ${dir}${LOGFNAME}.3${ext}
246210373Ssimon	end
247210373Ssimon
248210373Ssimon	begin "rotate normal 4 ${name_postfix}"
249210373Ssimon	run_newsyslog $newsyslog_args
250210373Ssimon	ckfe ${LOGFNAME}
251210373Ssimon	ckfe ${dir}${LOGFNAME}.0${ext}
252210373Ssimon	ckfe ${dir}${LOGFNAME}.1${ext}
253210373Ssimon	ckfe ${dir}${LOGFNAME}.2${ext}
254210373Ssimon	cknt ${dir}${LOGFNAME}.4${ext}
255210373Ssimon	end
256210373Ssimon
257210373Ssimon	begin "rotate normal 5 ${name_postfix}"
258210373Ssimon	run_newsyslog $newsyslog_args
259210373Ssimon	ckfe ${LOGFNAME}
260210373Ssimon	ckfe ${dir}${LOGFNAME}.0${ext}
261210373Ssimon	ckfe ${dir}${LOGFNAME}.1${ext}
262210373Ssimon	ckfe ${dir}${LOGFNAME}.2${ext}
263210373Ssimon	cknt ${dir}${LOGFNAME}.4${ext}
264210373Ssimon	end
265210373Ssimon
266210373Ssimon	# Wait a bit so we can see if the noaction test rotates files
267210373Ssimon	sleep 1.1
268210373Ssimon
269210373Ssimon	begin "noaction ${name_postfix}"
270210373Ssimon	ofiles=`ls -Tl ${dir}${LOGFNAME}.*${ext} | tr -d '\n'`
271210373Ssimon	run_newsyslog ${newsyslog_args} -n >/dev/null
272210373Ssimon	ckfe ${LOGFNAME}
273210373Ssimon	ckstr "$ofiles" "`ls -lT ${dir}${LOGFNAME}.*${ext} | tr -d '\n'`"
274210373Ssimon	end
275210373Ssimon
276210373Ssimon	tmpdir_clean
277210373Ssimon}
278210373Ssimon
279220927Ssimontests_normal_rotate_keepn() {
280220927Ssimon	cnt="$1"
281220927Ssimon	ext="$2"
282220927Ssimon	dir="$3"
283220927Ssimon
284220927Ssimon	if [ -n "$dir" ]; then
285220927Ssimon		newsyslog_args=" -a ${dir}"
286220927Ssimon		name_postfix="${ext} archive dir"
287220927Ssimon	else
288220927Ssimon		newsyslog_args=""
289220927Ssimon		name_postfix="${ext}"
290220927Ssimon	fi
291220927Ssimon
292220927Ssimon	tmpdir_create
293220927Ssimon
294220927Ssimon	begin "create file ${name_postfix}" -newdir
295220927Ssimon	run_newsyslog -C
296220927Ssimon	ckfe $LOGFNAME
297220927Ssimon	cknt ${dir}${LOGFNAME}.0${ext}
298220927Ssimon	end
299220927Ssimon
300220927Ssimon	begin "rotate normal 1 cnt=$cnt ${name_postfix}"
301220927Ssimon	run_newsyslog $newsyslog_args
302220927Ssimon	ckfe ${LOGFNAME}
303220927Ssimon	ckntfe 1 $cnt ${dir}${LOGFNAME}.0${ext}
304220927Ssimon	cknt ${dir}${LOGFNAME}.1${ext}
305220927Ssimon	end
306220927Ssimon
307220927Ssimon	begin "rotate normal 2 cnt=$cnt ${name_postfix}"
308220927Ssimon	run_newsyslog $newsyslog_args
309220927Ssimon	ckfe ${LOGFNAME}
310220927Ssimon	ckntfe 1 $cnt ${dir}${LOGFNAME}.0${ext}
311220927Ssimon	ckntfe 2 $cnt ${dir}${LOGFNAME}.1${ext}
312220927Ssimon	cknt ${dir}${LOGFNAME}.2${ext}
313220927Ssimon	end
314220927Ssimon
315220927Ssimon	begin "rotate normal 3 cnt=$cnt ${name_postfix}"
316220927Ssimon	run_newsyslog $newsyslog_args
317220927Ssimon	ckfe ${LOGFNAME}
318220927Ssimon	ckntfe 1 $cnt ${dir}${LOGFNAME}.0${ext}
319220927Ssimon	ckntfe 2 $cnt ${dir}${LOGFNAME}.1${ext}
320220927Ssimon	ckntfe 3 $cnt ${dir}${LOGFNAME}.2${ext}
321220927Ssimon	cknt ${dir}${LOGFNAME}.3${ext}
322220927Ssimon	end
323220927Ssimon
324220927Ssimon	begin "rotate normal 3 cnt=$cnt ${name_postfix}"
325220927Ssimon	run_newsyslog $newsyslog_args
326220927Ssimon	ckfe ${LOGFNAME}
327220927Ssimon	ckntfe 1 $cnt ${dir}${LOGFNAME}.0${ext}
328220927Ssimon	ckntfe 2 $cnt ${dir}${LOGFNAME}.1${ext}
329220927Ssimon	ckntfe 3 $cnt ${dir}${LOGFNAME}.2${ext}
330220927Ssimon	ckntfe 4 $cnt ${dir}${LOGFNAME}.3${ext}
331220927Ssimon	cknt ${dir}${LOGFNAME}.4${ext}
332220927Ssimon	end
333220927Ssimon
334220927Ssimon	# Wait a bit so we can see if the noaction test rotates files
335220927Ssimon	sleep 1.1
336220927Ssimon
337220927Ssimon	begin "noaction ${name_postfix}"
338220927Ssimon	osum=`md5 ${dir}${LOGFNAME} | tr -d '\n'`
339220927Ssimon	run_newsyslog ${newsyslog_args} -n >/dev/null
340220927Ssimon	ckfe ${LOGFNAME}
341220927Ssimon	ckstr "$osum" "`md5 ${dir}${LOGFNAME} | tr -d '\n'`"
342220927Ssimon	end
343220927Ssimon
344220927Ssimon	tmpdir_clean
345220927Ssimon}
346220927Ssimon
347210373Ssimontests_time_rotate() {
348210373Ssimon	ext="$1"
349210373Ssimon	dir="$2"
350210373Ssimon
351210373Ssimon	if [ -n "$dir" ]; then
352210373Ssimon		newsyslog_args="-t DEFAULT -a ${dir}"
353210373Ssimon		name_postfix="${ext} archive dir"
354210373Ssimon	else
355210373Ssimon		newsyslog_args="-t DEFAULT"
356210373Ssimon		name_postfix="${ext}"
357210373Ssimon	fi
358210373Ssimon
359210373Ssimon	tmpdir_create
360210373Ssimon
361210373Ssimon	begin "create file ${name_postfix}" -newdir
362210373Ssimon	run_newsyslog -C ${newsyslog_args}
363210373Ssimon	ckfe ${LOGFNAME}
364210373Ssimon	end
365210373Ssimon
366210373Ssimon	begin "rotate time 1 ${name_postfix}"
367210373Ssimon	run_newsyslog ${newsyslog_args}
368210373Ssimon	ckfe ${LOGFNAME}
369210373Ssimon	chkfcnt 1 ${dir}${LOGFNAME}.*${ext}
370210373Ssimon	end
371210373Ssimon
372210373Ssimon	sleep 1.1
373210373Ssimon
374210373Ssimon	begin "rotate time 2 ${name_postfix}"
375210373Ssimon	run_newsyslog ${newsyslog_args}
376210373Ssimon	ckfe ${LOGFNAME}
377210373Ssimon	chkfcnt 2 ${dir}${LOGFNAME}.*${ext}
378210373Ssimon	end
379210373Ssimon
380210373Ssimon	sleep 1.1
381210373Ssimon
382210373Ssimon	begin "rotate time 3 ${name_postfix}"
383210373Ssimon	run_newsyslog ${newsyslog_args}
384210373Ssimon	ckfe ${LOGFNAME}
385210373Ssimon	chkfcnt 3 ${dir}${LOGFNAME}.*${ext}
386210373Ssimon	end
387210373Ssimon
388210373Ssimon	sleep 1.1
389210373Ssimon
390210373Ssimon	begin "rotate time 4 ${name_postfix}"
391210373Ssimon	run_newsyslog ${newsyslog_args}
392210373Ssimon	ckfe ${LOGFNAME}
393210373Ssimon	chkfcnt 3 ${dir}${LOGFNAME}.*${ext}
394210373Ssimon	end
395210373Ssimon
396210373Ssimon	begin "noaction ${name_postfix}"
397210373Ssimon	ofiles=`ls -1 ${dir}${LOGFNAME}.*${ext} | tr -d '\n'`
398210373Ssimon	run_newsyslog ${newsyslog_args} -n >/dev/null
399210373Ssimon	ckfe ${LOGFNAME}
400210373Ssimon	ckstr "$ofiles" "`ls -1 ${dir}${LOGFNAME}.*${ext} | tr -d '\n'`"
401210373Ssimon	end
402210373Ssimon
403210373Ssimon	tmpdir_clean
404210373Ssimon}
405210373Ssimon
406321263Sngietests_rfc5424() {
407321263Sngie	ext="$1"
408321263Sngie	dir="$2"
409321263Sngie
410321263Sngie	if [ -n "$dir" ]; then
411321263Sngie		newsyslog_args=" -a ${dir}"
412321263Sngie		name_postfix="${ext} archive dir"
413321263Sngie	else
414321263Sngie		newsyslog_args=""
415321263Sngie		name_postfix="${ext}"
416321263Sngie	fi
417321263Sngie
418321263Sngie	tmpdir_create
419321263Sngie
420321263Sngie	begin "RFC-5424 - create file ${name_postfix}" -newdir
421321263Sngie	run_newsyslog -C
422321263Sngie	ckfe $LOGFNAME
423321263Sngie	cknt ${dir}${LOGFNAME}.0${ext}
424321263Sngie	ckfe $LOGFNAME5424
425321263Sngie	cknt ${dir}${LOGFNAME5424}.0${ext}
426321263Sngie	ckrfc3164 ${LOGFNAME}
427321263Sngie	ckrfc5424 ${LOGFNAME5424}
428321263Sngie	end
429321263Sngie
430321263Sngie	begin "RFC-5424 - rotate normal 1 ${name_postfix}"
431321263Sngie	run_newsyslog $newsyslog_args
432321263Sngie	ckfe ${LOGFNAME}
433321263Sngie	ckfe ${dir}${LOGFNAME}.0${ext}
434321263Sngie	ckfe $LOGFNAME5424
435321263Sngie	ckfe ${dir}${LOGFNAME5424}.0${ext}
436321263Sngie	ckrfc3164 ${LOGFNAME}
437321263Sngie	ckrfc3164 ${dir}${LOGFNAME}.0${ext}
438321263Sngie	ckrfc5424 ${LOGFNAME5424}
439321263Sngie	ckrfc5424 ${dir}${LOGFNAME5424}.0${ext}
440321263Sngie	end
441321263Sngie
442321263Sngie	tmpdir_clean
443321263Sngie}
444321263Sngie
445321263Sngieecho 1..128
446210373Ssimonmkdir -p ${TMPDIR}
447210373Ssimoncd ${TMPDIR}
448210373Ssimon
449210373SsimonLOGFNAME=foo.log
450210373SsimonLOGFPATH=${TMPDIR}/log/${LOGFNAME}
451210373Ssimon
452321263Sngie# Log file for RFC-5424 testing
453321263SngieLOGFNAME5424=foo5424.log
454321263SngieLOGFPATH5424=${TMPDIR}/log/${LOGFNAME5424}
455321263Sngie
456220927Ssimon# Normal, no archive dir, keep X files
457220927Ssimonecho "$LOGFPATH	640  0	   *	@T00  NC" > newsyslog.conf
458220927Ssimontests_normal_rotate_keepn 0
459210373Ssimon
460220927Ssimonecho "$LOGFPATH	640  1	   *	@T00  NC" > newsyslog.conf
461220927Ssimontests_normal_rotate_keepn 1
462210373Ssimon
463220927Ssimonecho "$LOGFPATH	640  2	   *	@T00  NC" > newsyslog.conf
464220927Ssimontests_normal_rotate_keepn 2
465220927Ssimon
466220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NC" > newsyslog.conf
467220927Ssimontests_normal_rotate_keepn 3
468220927Ssimon
469220927Ssimon# Normal, no archive dir, keep X files, gz
470220927Ssimonecho "$LOGFPATH	640  0	   *	@T00  NCZ" > newsyslog.conf
471220927Ssimontests_normal_rotate_keepn 0 ".gz"
472220927Ssimon
473220927Ssimonecho "$LOGFPATH	640  1	   *	@T00  NCZ" > newsyslog.conf
474220927Ssimontests_normal_rotate_keepn 1 ".gz"
475220927Ssimon
476220927Ssimonecho "$LOGFPATH	640  2	   *	@T00  NCZ" > newsyslog.conf
477220927Ssimontests_normal_rotate_keepn 2 ".gz"
478220927Ssimon
479220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCZ" > newsyslog.conf
480220927Ssimontests_normal_rotate_keepn 3 ".gz"
481220927Ssimon
482210373Ssimon# Normal, no archive dir
483220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NC" > newsyslog.conf
484210373Ssimontests_normal_rotate
485210373Ssimon
486220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCZ" > newsyslog.conf
487210373Ssimontests_normal_rotate ".gz"
488210373Ssimon
489220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCJ" > newsyslog.conf
490210373Ssimontests_normal_rotate ".bz2"
491210373Ssimon
492210373Ssimon# Normal, archive dir
493220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NC" > newsyslog.conf
494210373Ssimontests_normal_rotate "" "${TMPDIR}/alog/"
495210373Ssimon
496220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCZ" > newsyslog.conf
497210373Ssimontests_normal_rotate ".gz" "${TMPDIR}/alog/"
498210373Ssimon
499220927Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCJ" > newsyslog.conf
500210373Ssimontests_normal_rotate ".bz2" "${TMPDIR}/alog/"
501210373Ssimon
502210373Ssimon# Time based, no archive dir
503210373Ssimonecho "$LOGFPATH	640  3	   *	@T00  NC" > newsyslog.conf
504210373Ssimontests_time_rotate
505210373Ssimon
506210373Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCZ" > newsyslog.conf
507210373Ssimontests_time_rotate "gz" ""
508210373Ssimon
509210373Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCJ" > newsyslog.conf
510210373Ssimontests_time_rotate "bz2" ""
511210373Ssimon
512210373Ssimon# Time based, archive dir
513210373Ssimonecho "$LOGFPATH	640  3	   *	@T00  NC" > newsyslog.conf
514210373Ssimontests_time_rotate "" "${TMPDIR}/alog/"
515210373Ssimon
516210373Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCZ" > newsyslog.conf
517210373Ssimontests_time_rotate "gz" "${TMPDIR}/alog/"
518210373Ssimon
519210373Ssimonecho "$LOGFPATH	640  3	   *	@T00  NCJ" > newsyslog.conf
520210373Ssimontests_time_rotate "bz2" "${TMPDIR}/alog/"
521210373Ssimon
522321263Sngie# RFC-5424; Normal, no archive dir
523321263Sngieecho "$LOGFPATH5424	640  3	   *	@T00  NCT" > newsyslog.conf
524321263Sngieecho "$LOGFPATH	640  3	   *	@T00  NC" >> newsyslog.conf
525321263Sngietests_rfc5424
526321263Sngie
527210373Ssimonrm -rf "${TMPDIR}"
528