File: 929

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (103 lines) | stat: -rwxr-xr-x 2,615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
# PCP QA Test No. 929
# pmlogger_daily optimization for only one archive (pmlogmv not pmlogextract)
# and -M option (don't rewrite, merge or move)
#
# Copyright (c) 2014 Ken McDonell. All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter

NEEDREWRITE=$PCP_LOG_DIR/pmlogger/.NeedRewrite

_cleanup()
{
    [ -d $tmp.one ] && rm -fr $tmp.one
    [ -d $tmp.two ] && rm -fr $tmp.two
    $sudo rm -f $tmp.*
    [ -f $NEEDREWRITE.$seq ] && $sudo mv $NEEDREWRITE.$seq $NEEDREWRITE
}

_filter()
{
    # strip lines like ...
    # Roll /var/log/pcp/NOTICES -> /var/log/pcp/NOTICES.old
    # Start new /var/log/pcp/NOTICES
    # + mv -f /var/log/pcp/NOTICES /var/log/pcp/NOTICES.old
    # + touch /var/log/pcp/NOTICES
    # as we have no control over the trigger for this (the size of the
    # NOTICES file)
    #
    # and do the usual config/pid filtering
    #
    # in case /var/tmp is a symlink to /tmp, then the diagnostics sometimes
    # use /tmp and sometimes use /var/tmp ... handle both in the filter
    #
    #
    sed \
	-e '/date-and-timestamp/d' \
	-e '/^Roll .*\/NOTICES/d' \
	-e '/^Start .*\/NOTICES/d' \
	-e '/^Start \[/s/ 2[0-9:. -]*/ DATESTAMP/' \
	-e '/^End \[/s/ 2[0-9:. -]*/ DATESTAMP /' \
	-e '/^+ mv .*NOTICES/d' \
	-e '/^+ touch .*NOTICES/d' \
	-e "s,$tmp,TMP,g" \
	-e "s,/tmp/$seq-$$,TMP,g" \
	-e "s,/privateTMP,TMP,g" \
	-e "s,$PCP_TMP_DIR,PCP_TMP_DIR,g" \
	-e "s/$PAST/PAST/g" \
	-e '/+ ln /d' \
    # end
}

status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

[ -f $NEEDREWRITE ] && $sudo mv $NEEDREWRITE $NEEDREWRITE.$seq

# create test control file
#
cat <<End-of-File >$tmp.control
\$version=1.1
#Host           P?  S?  directory       args
one.somewhere   n   n   $tmp.one        -c config.default
two.somewhere   n   n   $tmp.two        -c config.default
End-of-File


# archives for a couple of days ago
#
PAST=`pmdate -2d %Y%m%d`
for host in one two
do
    mkdir -p $tmp.$host
    for ext in 0 meta index
    do
	cp tmparch/foo.$ext $tmp.$host/$PAST.00.10.$ext
	touch -t "${PAST}0010" $tmp.$host/$PAST.00.10.$ext
	if [ "$host" = "two" ]
	then
	    cp tmparch/foo.$ext $tmp.$host/$PAST.13.13.$ext
	    touch -t "${PAST}1313" $tmp.$host/$PAST.13.13.$ext
	fi
    done
done

# real QA test starts here
$sudo $PCP_BINADM_DIR/pmlogger_daily -P -D -x never -V -N -c $tmp.control \
2>&1 | _filter

echo
echo "--- -M case ---"
$sudo $PCP_BINADM_DIR/pmlogger_daily -P -D -x never -M -VN -c $tmp.control \
2>&1 | _filter

# success, all done
status=0
exit