qa: rework python-not-configured checks for tests
[pcp.git] / qa / 704
blob9c3d5d856bb47d12d270278bbf4c6bb841ca59fa
1 #! /bin/sh
2 # PCP QA Test No. 704
3 # Exercise MMV python module (end-to-end)
5 # Copyright (c) 2013,2016 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.python
13 $python -c 'from pcp import mmv' 2>/dev/null
14 test $? -eq 0 || _notrun "Python MMV module not available"
16 status=1
17 _needclean=true
18 $sudo rm -f $tmp.* $seq.full
19 MMV_STATS_DIR="$PCP_TMP_DIR/mmv"
21 _cleanup()
23 if $_needclean
24 then
25 [ -d $MMV_STATS_DIR.$seq ] && _restore_config $MMV_STATS_DIR
26 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
27 _wait_for_pmcd
28 _wait_for_pmlogger
29 _needclean=false
31 $sudo rm -f $tmp.*
32 exit $status
35 # Filter time from ...
36 # Ran 1 test in 0.001s
38 _filter()
40 sed -e '/Ran 1 test/s/0.00[0-9]/<0.01/'
43 _filter_pminfo()
45 tee -a $here/$seq.full | sed \
46 -e 's/value [0-9][0-9]*/value NUMBER/'
49 trap "_cleanup" 0 1 2 3 15
51 # real QA starts here
52 [ -d $MMV_STATS_DIR ] && _save_config $MMV_STATS_DIR
53 $sudo rm -rf $MMV_STATS_DIR
54 $sudo mkdir $MMV_STATS_DIR
55 $sudo chmod 1777 $MMV_STATS_DIR
56 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
57 _check_agent mmv >/dev/null || _notrun "MMV agent should be setup but is not"
59 echo "Running python test program"
60 $python $here/src/test_mmv.py 2>&1 | _filter
61 echo "Checking mmv file"
62 find $MMV_STATS_DIR | sed -e "s,$MMV_STATS_DIR,MMV_STATS_DIR,g"
63 echo "Checking pmdammv queries"
64 pminfo -fmdtT mmv.pytest | _filter_pminfo
66 status=0
67 exit