File: 682

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 (104 lines) | stat: -rwxr-xr-x 2,395 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# PCP QA Test No. 682
# Exercise MMV v3 labels support under valgrind.
#
# Copyright (c) 2018 Red Hat.
#

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

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

[ "$(id -un)" = root ] && _notrun "this test fails if run as root"

_check_valgrind

status=1
username=`id -u -n`
hostname=`hostname`
machineid=`_machine_id`
domainname=`_domain_name`
MMV_STATS_DIR="$PCP_TMP_DIR/mmv"

_cleanup()
{
    cd $here
    if $need_restore
    then
	need_restore=false
	$sudo rm -rf $PCP_ETC_DIR/pcp/labels/*
	_restore_config $PCP_ETC_DIR/pcp/labels
	[ -d $MMV_STATS_DIR.$seq ] && _restore_config $MMV_STATS_DIR
	_sighup_pmcd
    fi
    $sudo rm -rf $tmp $tmp.*
}

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

need_restore=true
_save_config $PCP_ETC_DIR/pcp/labels
$sudo rm -rf $PCP_ETC_DIR/pcp/labels/*

# real QA test starts here
home="$PCP_PMDAS_DIR"
iam=mmv

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

# create a directory we can write and pcp group can read
$sudo rm -rf "$MMV_STATS_DIR"
$sudo mkdir -m 755 "$MMV_STATS_DIR"
$sudo chown $username "$MMV_STATS_DIR"
$sudo chgrp pcp "$MMV_STATS_DIR"

_filter_paths()
{
    sed \
	-e "s,$here,QADIR,g" \
	-e "s,$PCP_TMP_DIR,PCP_TMP_DIR,g" \
	-e "s,$PCP_PMDAS_DIR,PCP_PMDAS_DIR,g" \
    #end
}

_run_valgrind $here/src/mmv3_labels | _filter_paths

_filter_mmvdump()
{
    sed \
	-e "s,^Process.*= [0-9][0-9]*,Process    = PID,g" \
	-e "s,^Generated.*= [0-9][0-9]*,Generated  = TIMESTAMP,g" \
	-e 's/interval = [0-9][0-9]*/interval = TIME/' \
	-e 's/eggs"] = [0-9][0-9]* (value=[0-9][0-9]*/eggs"] = N (value=N/' \
    #end
}

echo "=== dump labels and values ==="
_run_valgrind $PCP_PMDAS_DIR/mmv/mmvdump $PCP_TMP_DIR/mmv/labels3 \
	| _filter_mmvdump \
	| _filter_paths

_filter_pminfo()
{
    sed \
	-e "s/.domainname.:.${domainname}./\"domainname\":\"DOMAIN\"/g" \
	-e "s/.machineid.:.${machineid}./\"machineid\":\"MACHINE\"/g" \
	-e "s/.hostname.:.${hostname}./\"hostname\":\"HOSTNAME\"/g" \
	-e "s/.groupid.:.[0-9][0-9]*/\"groupid\":GID/g" \
	-e "s/.userid.:.[0-9][0-9]*/\"userid\":UID/g" \
    #end
}

echo "=== check labels and values ==="
pmda="$PCP_PMDAS_DIR/mmv/pmda_mmv,mmv_init"
_run_valgrind pminfo -L -Kclear -Kadd,70,$pmda -d mmv.labels3 -l -M -f \
	| _filter_pminfo \
	| _filter_paths

status=0
exit