File: 990

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 (121 lines) | stat: -rwxr-xr-x 2,733 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh
# PCP QA Test No. 990
# MMV format error injection and verification of pmdammv response.
#
# Copyright (c) 2016 Red Hat.
#

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

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

_check_valgrind

status=1
username=`id -u -n`
MMV_STATS_DIR=${PCP_TMP_DIR}/mmv
MMVDUMP=$PCP_PMDAS_DIR/mmv/mmvdump
pmda=${PCP_PMDAS_DIR}/mmv/pmda_mmv,mmv_init

_cleanup()
{
    cd $here
    [ -d ${MMV_STATS_DIR}.$seq ] && _restore_config ${MMV_STATS_DIR}
    rm -rf $tmp $tmp.*
}

trap "_cleanup; exit \$status" 0 1 2 3 15

# move the MMV directory to restore contents later.
[ -d ${MMV_STATS_DIR} ] && _save_config ${MMV_STATS_DIR}

$sudo rm -rf ${MMV_STATS_DIR}
$sudo mkdir -m 755 ${MMV_STATS_DIR}
$sudo chown $username ${MMV_STATS_DIR}

# from mmv.log ...
# [Wed Feb  5 14:23:47] pminfo(2011651) Error: mmv: header-1: size 8 too small, expecting 40
#
# These 2 are "equivalent"
# 64-bit platforms
#    Error: mmv: indoms_4: indom[0] offset: 184 < 343597383704
# 32-bit platforms
#    Error: mmv: indoms_4: indom[0] offset: 184 < 4294967320

#
_filter()
{
    sed \
	-e "s,$MMV_STATS_DIR,MMV_STATS_DIR,g" \
	-e "s,$PCP_PMDAS_DIR,PCP_PMDAS_DIR,g" \
	-e 's/\[[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]]/[DATESTAMP]/' \
	-e 's/pminfo([0-9][0-9]*)/pminfo(PID)/' \
	-e '/indoms_4/s/184 < 4294967320/184 < 343597383704/' \
    #end
}

_dump()
{
    section=$1

    echo
    echo "== generating bad $section data files =="
    $here/src/badmmv --$section

    files=`ls -1 ${MMV_STATS_DIR}/${section}_* | LC_COLLATE=POSIX sort`
    for file in $files
    do
	echo -- dump `basename $file`
	$PCP_PMDAS_DIR/mmv/mmvdump $file | _filter
	unlink $file
	echo
    done
}

_verify()
{
    section=$1

    echo
    echo "== generating bad $section data files =="
    $here/src/badmmv --$section

    # run valgrind once for all files in section (its slow to start)
    echo -- verify $section data files | tee -a $seq_full
    _run_valgrind --save-output pminfo -L -Kclear -Kadd,70,$pmda -v mmv 2>&1 \
    | _filter
    _filter <$tmp.err \
    | LC_COLLATE=POSIX sort \
    | uniq
    cat $tmp.out

    # this should always show zero (all badmmv generated files are invalid)
    # -Dappl0 to get warnings and info and debug from PMDA
    #
    pminfo -L -Kclear -Kadd,70,$pmda -Dappl0 -f mmv.control.metrics 2>$tmp.err >$tmp.out
    _filter <$tmp.err \
    | LC_COLLATE=POSIX sort \
    | uniq
    cat $tmp.out

    # cleanup 
    rm -f ${MMV_STATS_DIR}/${section}-*
}

_dump header
_dump contents
_dump indoms
_dump metrics

_verify header
_verify contents
_verify indoms
_verify metrics

# success, all done
status=0
exit