summaryrefslogtreecommitdiff
path: root/qa/985
blob: 3106a3cf2ed79ae2d6d67c73d19c435fb05dc3e6 (plain)
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
#!/bin/sh
# PCP QA Test No. 985
# Exercise the dmcache PMDA using dbpmda.
#
# Copyright (c) 2014 Red Hat.
#

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

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

pmda_path="$PCP_PMDAS_DIR/dmcache"
pmda_script="$pmda_path/pmdadmcache.python"
test -f "$pmda_script" || _notrun "pmdadmcache not supported"
python -c "from pcp import pmda" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python pcp pmda module not installed"

status=1	# failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

_filter()
{
    tee -a $seq.full | \
    sed \
	-e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
	-e '/pmResult/s/ .* numpmid/ ... numpmid/' \
	-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*/TIMESTAMP/' \

    test -f dmcache.log && cat dmcache.log >> $seq.full
}

# create sample output for the PMDA to consume
cat > $tmp.dmcache.sh <<EOF
#!/bin/sh
echo dmcache1: 0 52428800 cache 8 289/837632 512 71/117856 576 35 329 0 0 71 0 1 writeback 2 migration_threshold 2048 mq 10 random_threshold 4 sequential_threshold 512 discard_promote_adjustment 1 read_promote_adjustment 4 write_promote_adjustment 8
echo dmcache2: 0 52606976 cache 8 289/837632 512 71/117856 484 32 330 0 0 71 0 1 writethrough 2 migration_threshold 2048 mq 10 random_threshold 4 sequential_threshold 512 discard_promote_adjustment 1 read_promote_adjustment 4 write_promote_adjustment 8
EOF
chmod 755 $tmp.dmcache.sh

domain=129
export DM_STATUS=$tmp.dmcache.sh

# real QA test starts here
echo "== Finding dmcache metrics" | tee -a $seq.full
PCP_PYTHON_PMNS=root python "$pmda_script" 2>/dev/null > $tmp.root

echo "== Testing dmcache metrics" | tee -a $seq.full
$sudo dbpmda -n $tmp.root -ie <<End-of-File 2>&1 | _filter
open pipe /usr/bin/python $pmda_script
getdesc on
desc dmcache.size
desc dmcache.metadata.block_size
desc dmcache.metadata.used
desc dmcache.metadata.total
desc dmcache.cache.block_size
desc dmcache.cache.used
desc dmcache.cache.total
desc dmcache.read_hits
desc dmcache.read_misses
desc dmcache.write_hits
desc dmcache.write_misses
desc dmcache.demotions
desc dmcache.promotions
desc dmcache.dirty
desc dmcache.io_mode_code
desc dmcache.io_mode
fetch dmcache.size
fetch dmcache.metadata.block_size
fetch dmcache.metadata.used
fetch dmcache.metadata.total
fetch dmcache.cache.block_size
fetch dmcache.cache.used
fetch dmcache.cache.total
fetch dmcache.read_hits
fetch dmcache.read_misses
fetch dmcache.write_hits
fetch dmcache.write_misses
fetch dmcache.demotions
fetch dmcache.promotions
fetch dmcache.dirty
fetch dmcache.io_mode_code
fetch dmcache.io_mode
End-of-File

# success, all done
status=0
exit