File: 704

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 (75 lines) | stat: -rwxr-xr-x 1,654 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
#! /bin/sh
# PCP QA Test No. 704
# Exercise MMV python module (end-to-end)
#
# Copyright (c) 2013,2016 Red Hat.
#

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

. ./common.python

$python -c 'from pcp import mmv' 2>/dev/null
test $? -eq 0 || _notrun "Python MMV module not available"

status=1
_needclean=true
MMV_STATS_DIR="$PCP_TMP_DIR/mmv"

_cleanup()
{
    if $_needclean
    then
	[ -d $MMV_STATS_DIR.$seq ] && _restore_config $MMV_STATS_DIR
	_service pmcd restart 2>&1 | _filter_pcp_restart
	_wait_for_pmcd
	_restore_auto_restart pmcd
	_service pmlogger restart 2>&1 | _filter_pcp_restart
	_wait_for_pmlogger
	_needclean=false
    fi
    $sudo rm -f $tmp.*
    exit $status
}

# Filter time from ...
# Ran 1 test in 0.001s
#
_filter()
{
    sed -e '/Ran 1 test/s/0.00[0-9]/<0.01/'
}

_filter_pminfo()
{
    tee -a $seq_full | sed \
        -e 's/value [0-9][0-9]*/value NUMBER/'
}

trap "_cleanup" 0 1 2 3 15

_stop_auto_restart pmcd

# real QA starts here
[ -d $MMV_STATS_DIR ] && _save_config $MMV_STATS_DIR
$sudo rm -rf $MMV_STATS_DIR
$sudo mkdir $MMV_STATS_DIR
$sudo chmod 1777 $MMV_STATS_DIR
if ! _service pmcd restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmcd || _exit 1
if ! _service pmlogger restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmlogger || _exit 1
_check_agent mmv >/dev/null || _notrun "MMV agent should be setup but is not"

echo "Running python test program"
$python $here/src/test_mmv.py 2>&1 | _filter
echo "Checking mmv file"
find $MMV_STATS_DIR | sed -e "s,$MMV_STATS_DIR,MMV_STATS_DIR,g"
echo "Checking pmdammv queries"
pminfo -fmdtT mmv.pytest | _filter_pminfo

status=0
exit