File: 972

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,644 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. 972
# Exercise the zswap compressed swap PMDA using dbpmda.
#
# Copyright (c) 2014-2015 Red Hat.
#

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

. ./common.python

python_path=`which $python`
pmda_path="$PCP_PMDAS_DIR/zswap"
pmda_script="$pmda_path/pmdazswap.python"
test -f "$pmda_script" || _notrun "pmdazswap 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!
trap "cd $here; rm -rf $tmp.* zswap.log*; exit \$status" 0 1 2 3 15

_filter()
{
    tee -a $seq_full | \
    sed \
	-e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
	-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/' \
	-e "s;$python_path;\$PCP_PYTHON_PROG;" \
	-e "s;$python_basename;python;" \
    #end
}

_setup_zswap_values()
{
    mkdir -p $ZSWAP_STATS_PATH || exit
    cd $ZSWAP_STATS_PATH

    echo 309   > duplicate_entry
    echo 1     > pool_limit_hit
    echo 2000  > pool_pages
    echo 32    > reject_alloc_fail
    echo 11    > reject_compress_poor
    echo 198   > reject_kmemcache_fail
    echo 2     > reject_reclaim_fail
    echo 89123 > stored_pages
    echo 12435 > written_back_pages

    cd $here
}

_setup_zswap_novalues()
{
    rm -fr $ZSWAP_STATS_PATH
}

domain=125
ZSWAP_PAGESIZE=4096; export ZSWAP_PAGESIZE
ZSWAP_STATS_PATH="$tmp.zswap"; export ZSWAP_STATS_PATH

# real QA test starts here
_setup_zswap_values
PCP_PYTHON_PMNS=root $python "$pmda_script" > $tmp.root

echo "== Testing zswap metrics" | tee -a $seq_full
dbpmda -n $tmp.root -ie <<End-of-File 2>&1 | _filter
open pipe $python_path $pmda_script
getdesc on
desc zswap.pool_limit_hit
desc zswap.reject_reclaim_fail
desc zswap.reject_alloc_fail
desc zswap.reject_kmemcache_fail
desc zswap.reject_compress_poor
desc zswap.written_back_pages
desc zswap.duplicate_entry
desc zswap.pool_pages
desc zswap.stored_pages
fetch zswap.pool_limit_hit
fetch zswap.reject_reclaim_fail
fetch zswap.reject_alloc_fail
fetch zswap.reject_kmemcache_fail
fetch zswap.reject_compress_poor
fetch zswap.written_back_pages
fetch zswap.duplicate_entry
fetch zswap.pool_pages
fetch zswap.stored_pages
End-of-File
test -f zswap.log && cat zswap.log >> $seq_full

echo "== Testing zswap without values" | tee -a $seq_full
_setup_zswap_novalues
dbpmda -n $tmp.root -ie <<End-of-File 2>&1 | _filter
open pipe $python_path $pmda_script
getdesc on
desc zswap.pool_limit_hit
fetch zswap.pool_limit_hit
End-of-File
test -f zswap.log && cat zswap.log >> $seq_full

status=0
exit