File: 968

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 (72 lines) | stat: -rwxr-xr-x 1,881 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
#!/bin/sh
# PCP QA Test No. 968
# Exercise several corner cases in the Python PMAPI wrappers.
#
# Copyright (c) 2015,2017 Red Hat.
#

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

. ./common.python

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

# real QA test starts here
echo "== options error message" | tee -a $seq_full
cat > $tmp.opts <<EOF
from pcp import pmapi
import sys
opts = pmapi.pmOptions()
nops = opts.pmGetOperands()
nops = opts.pmGetNonOptionsFromList(sys.argv)
ctx = pmapi.pmContext.fromOptions(opts, sys.argv)
EOF
cat $tmp.opts >> $seq_full
$python $tmp.opts 2>&1 | tee -a $seq_full | grep Error

echo "== check setmode" | tee -a $seq_full
cat > $tmp.mode <<EOF
from pcp import pmapi
import cpmapi as api
import sys
ctx = pmapi.pmContext(api.PM_CONTEXT_ARCHIVE, '$here/archives/src-rattle')
try:
    ctx.pmSetMode(api.PM_MODE_INTERP, None, 0)	# no exception
except pmapi.pmErr as error:
    sys.stderr.write("Unexpected pmSetMode error: ", error)
EOF
cat $tmp.mode >> $seq_full
$python $tmp.mode 2>&1 | tee -a $seq_full

echo "== check import" | tee -a $seq_full
cat > $tmp.pmi <<EOF
from pcp import pmi
import cpmapi as api
log = pmi.pmiLogImport('$tmp.log', 0)
log.pmiAddMetric("hinv.ncpu", api.PM_ID_NULL,
                 api.PM_TYPE_U32, api.PM_INDOM_NULL,
                 api.PM_SEM_DISCRETE, log.pmiUnits(0, 0, 0, 0, 0, 0))
log.pmiPutValue("hinv.ncpu", None, "42")
EOF
cat $tmp.pmi >> $seq_full
$python $tmp.pmi 2>&1 | tee -a $seq_full

echo "== check derive" | tee -a $seq_full
cat > $tmp.derive <<EOF
from pcp import pmapi
import sys
ctx = pmapi.pmContext()
try:
    ctx.pmRegisterDerived("fuu", "rat(disk.dev.read)")
except pmapi.pmErr as error:
    print(error.message())
EOF
cat $tmp.derive >> $seq_full
$python $tmp.derive 2>&1 | tee -a $seq_full

# success, all done
echo "== done"
status=0
exit