qa: rework python-not-configured checks for tests
[pcp.git] / qa / 718
blobfa867ee38dc2b5760ea1ec6962197d6c6bc762d7
1 #! /bin/sh
2 # PCP QA Test No. 718
3 # Exercise dbpmda use with the Python implementation of pmdasimple.
5 # Copyright (c) 2013,2015 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.python
13 [ -d $PCP_PMDAS_DIR/simple ] || _notrun "simple PMDA directory is not installed"
14 $python -c "from pcp import pmda" >/dev/null 2>&1
15 [ $? -eq 0 ] || _notrun "python pcp pmda module not installed"
16 test -f "$PCP_PMDAS_DIR/simple/pmdasimple.python"
17 [ $? -eq 0 ] || _notrun "python simple pmda not yet installed"
19 python_path=`which $python`
20 trap "rm -f $tmp.*; exit" 0 1 2 3 15
22 _filter()
24 sed \
25 -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
26 -e "s;$python_path;\$PCP_PYTHON_PROG;" \
27 -e "s;$python;python;" \
28 | _filter_dumpresult
31 domain=253
33 # ensure help text exists
34 cd "$PCP_PMDAS_DIR/simple"
35 $sudo ./Install </dev/null >/dev/null 2>&1
37 # real QA test starts here
38 $sudo TERM=ansi dbpmda -n root -ie <<End-of-File 2>&1 | _filter
39 open pipe $python_path pmdasimple.python
40 getdesc on
41 desc simple.numfetch
42 fetch simple.numfetch
43 text simple.numfetch
44 desc simple.color
45 fetch simple.color
46 text simple.color
47 desc simple.now
48 fetch simple.now
49 text simple.now
50 instance $domain.0
51 text indom $domain.1
52 End-of-File
54 exit 0