This file is indexed.

/var/lib/pcp/testsuite/938 is in pcp-testsuite 4.0.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
#!/bin/sh
# PCP QA Test No. 938
# derived metrics - ternary expressions
#
# Copyright (c) 2017 Ken McDonell.  All Rights Reserved.
#

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

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

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

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

# Derived metric expr dump from 0x8513a48...
# expr node 0x867eb68 type=PLUS left=0x867eb98 right=0x867ed28
# 
# also need to deal with different PMIDs for kernel metrics on different
# platforms, and different sizes for same
#
_filter()
{
    $PCP_AWK_PROG <$tmp.out >$tmp.sed '
BEGIN				{ n = 0 }
$1 == "expr" && $2 == "node" && $3 ~ /^0x/	{ print "s/" $3 "/<addr-" n ">/"; n++ }
				{ next }'
    sed -f $tmp.sed <$tmp.out \
    | sed \
	-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
	-e 's/=0x0 /=(nil) /g' \
	-e "s;$tmp;TMP;" \
	-e '/PMID: /{
s/60\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/75\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/78\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/79\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/80\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/85\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/116\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
s/139\.[0-9][0-9]*\.[0-9][0-9]*/KERNEL_PMDA_PMID/g
}' \
	-e '/KERNEL_PMDA_PMID/{
N
s/[1-9][0-9]-bit/N-bit/
}'
    # end
}

# real QA test starts here

cat <<End-of-File >$tmp.config
a.m1 = sample.long.one == 1 ? sample.ulonglong.ten : sample.ulonglong.hundred
a.m2 = sample.long.one != 1 ? sample.ulonglong.ten : sample.ulonglong.hundred
a.m3 = sample.bin > 400 ? sample.bin-sample.bin : sample.bin
a.m4 = sample.bin > 400 ? sample.long.ten : sample.bin
# singular ? indom : indom
a.m5 = sample.long.one < 0 ? sample.bin-sample.bin : sample.bin
# indom ? singular : indom
a.m6 = sample.bin!=100 && sample.bin!=900 && sample.bin!=500 ? sample.long.ten : sample.bin
# indom ? indom : singular
a.m7 = sample.bin==100 || sample.bin==900 || sample.bin==500 ? sample.bin : sample.long.ten
# based on Marko's I/O percentage example from pcp email 03 Aug 2017
a.m8 = delta(disk.all.read_bytes) + delta(disk.all.write_bytes) == 0 ? mkconst(0, type="double", semantics="instant") : 100 * (delta(sample.byte_ctr) + delta(sample.kbyte_ctr) - delta(sampledso.byte_ctr)) / (delta(disk.all.read_bytes) + delta(disk.all.write_bytes))
# error cases
a.err.m1 = sample.bin > 400 ? sample.longlong.ten : sample.bin
a.err.m2 = sample.long.one ? sample.byte_ctr : sample.kbyte_ctr
a.err.m3 = sample.long.one ? sample.bin : sample.lights
a.err.m4 = sample.long.one ? sample.bin : sample.colour
a.err.m5 = sample.long.one ? sample.seconds : sample.ulong.ten
a.err.m6 = sample.long.one ? sample.byte_rate : sample.byte_rate_perhour
a.err.m7 = sample.long.one ? sample.long.hundred : sample.step
a.err.m8 = sample.colour > 200 ? sample.ulong.hundred : sample.ulong.ten
a.err.m9 = sample.string.hullo ? 1 : 2
End-of-File

export PCP_DERIVED_CONFIG=$tmp.config

pminfo -Dderive,appl0,appl1 -fd a >$tmp.out 2>&1
_filter

echo "expecting ..."
cat <<End-of-File
a.m1		10
a.m2		100
a.m3		100 200 300 400 0 0 0 0 0
a.m4		100 200 300 400 10 10 10 10 10
a.m5		100 200 300 400 500 600 700 800 900
a.m6		100 10 10 10 500 10 10 10 900
a.m7		100 10 10 10 500 10 10 10 900
a.err.m1	<expr2> and <expr3> different types
a.err.m2	<expr2> and <expr3> different units (space)
a.err.m3	<expr2> and <expr3> different types
a.err.m4	<expr2> and <expr3> different indoms
a.err.m5	<expr2> and <expr3> different semantics
a.err.m6	<expr2> and <expr3> different units (time)
a.err.m7	<expr2> and <expr3> different units (count)
a.err.m8	<expr1> with indom, <expr2> and <expr3> singular
a.err.m9	<expr1> not arithmetic
End-of-File

# success, all done
status=0
exit