File: 1637

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 (142 lines) | stat: -rwxr-xr-x 2,956 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/sh
# PCP QA Test No. 1637
# pmlogconf define tests
#
# non-valgrind variant, see qa/1638 for the valgrind variant
#
# Copyright (c) 2025 Ken McDonell.  All Rights Reserved.
#

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

do_valgrind=false
if [ "$1" = "--valgrind" ]
then
    _check_valgrind
    do_valgrind=true
elif which valgrind >/dev/null 2>&1
then
    [ "$PCPQA_VALGRIND" = both ] || \
        _notrun "valgrind variant qa/1638 will be run"
fi

# test for-some-thing || _notrun No support for some-thing

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=0	# success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
	-e "s@$tmp@TMP@g" \
    # end
}

mkdir -p $tmp/foo

# real QA test starts here
cat <<End-of-File >$tmp/foo/0
#pmlogconf-setup 2.0
ident	qa-$seq-0
# syntax error, name
define
probe	x > 0 ? include : exclude
	sample.bin
End-of-File

cat <<End-of-File >$tmp/foo/1
#pmlogconf-setup 2.0
ident	qa-$seq-1
# syntax error, missing =
define	x
probe	x > 0 ? include : exclude
	sample.bin
End-of-File

cat <<End-of-File >$tmp/foo/2
#pmlogconf-setup 2.0
ident	qa-$seq-2
# syntax error, missing expr
define	x = 
probe	x > 0 ? include : exclude
	sample.bin
End-of-File

cat <<End-of-File >$tmp/foo/3
#pmlogconf-setup 2.0
ident	qa-$seq-3
# definition error, bad expr
define	x = sum( sample.bin
probe	x > 0 ? include : exclude
	sample.bin
End-of-File

cat <<End-of-File >$tmp/foo/3
#pmlogconf-setup 2.0
ident	qa-$seq-3
# goodie
define	x = count(sample.bin)
probe	x > 0 ? include : exclude
	sample.bin
End-of-File

cat <<End-of-File >$tmp/foo/4
#pmlogconf-setup 2.0
ident	qa-$seq-4
# original storage/farm config, rewritten
define	y = (defined(smart.ata) ? count(smart.ata) : 0) + (defined(smart.scsi) ? count(smart.scsi) : 0)
# +1 for QA so the value is always >= 1
define	z = (defined(smart.ata) ? count(smart.ata) : 0) + (defined(smart.scsi) ? count(smart.scsi) : 0) + 1
probe	z > 0 ? include : exclude
	sample.colour
End-of-File

cat <<End-of-File >$tmp/foo/5
#pmlogconf-setup 2.0
ident   Derived metric example using a single metric instance
ident	based on pmlogconf(1) EXAMPLES
delta	once
define  fumble_log = sample.colour[green]
probe   fumble_log >= 200 ? include : exclude
        sample.colour[red]
End-of-File

cat <<End-of-File >$tmp/foo/6
#pmlogconf-setup 2.0
ident   Derived metric name re-use
delta	once
define  fumble_log = sample.colour[red]
probe   fumble_log >= 100 ? include : exclude
        sample.colour[blue]
End-of-File

if $do_valgrind
then
    _run_valgrind pmlogconf -d $tmp/foo $tmp.out
else
    pmlogconf -d $tmp/foo $tmp.out 2>&1
fi \
| _filter
_filter <$tmp.out

# success, all done
exit