/var/lib/pcp/testsuite/853 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 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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | #!/bin/sh
# PCP QA Test No. 853
# pmcpp -s testing
#
# Copyright (c) 2015 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
# handle these ...
# 1 "/tmp/853-3145.inc"
#
_filter()
{
sed \
-e "/^# [1-9]/s@$tmp@TMP@" \
# end
}
status=1 # failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "cd $here; rm -rf $tmp.* $tmp; exit \$status" 0 1 2 3 15
# real QA test starts here
cat <<End-of-File >$tmp.inc
%define eek urk
%define mumble 'mumble and "fumble"'
text from .inc file
End-of-File
cat <<End-of-File >$tmp.in
%include "$tmp.inc"
Firstly, there is the mumble ...
%ifdef eek
what about eek ? expect this to be \u\r\k not \e\e\k
%endif
eek at start of line
at end of line eek
text from .in file
%ifndef test_else
not-defined if-part
%else
not-defined else-part
%endif
%ifdef test_else
defined if-part
%else
defined else-part
%endif
Text at end of file.
End-of-File
echo "=== simple cases ==="
echo "----------------------"
pmcpp -s <$tmp.in 2>&1 | _filter
echo "----------------------"
pmcpp -s --define=test_else=1 <$tmp.in 2>&1 | _filter
echo "----------------------"
echo
echo "=== expansion with -r ==="
echo "----------------------"
pmcpp -sr <$tmp.in 2>&1 | _filter
echo "----------------------"
cat <<End-of-File >$tmp.in2
%include "$tmp.inc"
Firstly, there is the mumble ...
%ifdef eek
what about %eek ? expect this to be \u\r\k not \e\e\k
and what about %{eek} ? expect this to be \u\r\k not \e\e\k
%endif
%eek <percent>eek at start of line
<percent>eek at end of line %eek
%{eek} <percent>{eek} at start of line
<percent>{eek} at end of line %{eek}
text from .in file
End-of-File
pmcpp -srd <$tmp.in2 2>&1 | _filter
echo "Check lines in and out ..."
echo "in: `wc -l <$tmp.in2 | sed -e 's/ //g'` + `wc -l <$tmp.inc | sed -e 's/ //g'`"
echo "out: `pmcpp -sr <$tmp.in2 | wc -l | sed -e 's/ //g'`"
echo "----------------------"
echo
echo "=== -D on command line cases ==="
echo "----------------------"
pmcpp -s -D text="blah=blah=blah=..." <$tmp.in 2>&1 | _filter
echo "----------------------"
pmcpp -s -D 'text="blah blah blah ..."' <$tmp.in 2>&1 | _filter
echo "----------------------"
# Note error case coverage is spotty ... real testing for errors
# is in qa/463 (without -s)
#
echo
echo "=== error cases ==="
echo "----------------------"
cat <<End-of-File >$tmp.in
foo
%ifdef eek
bar
End-of-File
pmcpp -s <$tmp.in 2>&1 | _filter
echo "----------------------"
cat <<End-of-File >$tmp.in
%macro value with embedded newline - bad
%define multi 'one line
two lines
three lines'
And is this multi multiple lines?
End-of-File
pmcpp -sr <$tmp.in 2>&1 | _filter
echo "----------------------"
cat <<End-of-File >$tmp.in
# exposed #else outside #if ... scope
test
#else
blah
#endif
End-of-File
pmcpp -r <$tmp.in 2>&1 | _filter
echo "----------------------"
echo
echo "=== macro name and corner-case expansion tests ==="
echo "----------------------"
cat <<End-of-File >$tmp.in
%define _underscore_all_over_ urk
What about _underscore_all_over_? [expect urk]
End-of-File
pmcpp -s <$tmp.in 2>&1 | _filter
echo "----------------------"
cat <<End-of-File >$tmp.in
%define long_macro_name_and_short_value "!"
%define x '^a very long macro value to be sure, to be sure$'
some text %%{long_macro_name_and_short_value}%{long_macro_name_and_short_value}%{long_macro_name_and_short_value}% [expect %!!!%]
[expect ^...$^...$^...$] %x%x%x
End-of-File
pmcpp -d -rs <$tmp.in 2>&1 | _filter
echo "----------------------"
cat <<End-of-File >$tmp.in
#define Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch LLanfair
The town of Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch is a village in Wales and is famous for being apparently the longest place name in the world. There are lots of web pages mentioning Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch. Locally Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch is just too much of a mouthful and so it is truncated from "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch" to "Llanfair". With one more mention of Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch, I think this line will be long enough.
Phew that was a long input line ... 593 chars!
End-of-File
pmcpp -d <$tmp.in 2>&1 | _filter
echo "----------------------"
echo
echo "=== conditionals, bells and whistles ==="
echo "----------------------"
cat <<End-of-File >$tmp.freq
%define dk_freq 1minute
%define cpu_freq '15 sec'
End-of-File
cat <<End-of-File >$tmp.in
%include "$tmp.freq"
log mandatory on %dk_freq {
disk.dev
}
%ifdef want_cpu
%define cpu_pfx 'kernel.all.cpu.'
log mandatory on %cpu_freq {
%{cpu_pfx}user
%{cpu_pfx}sys
}
%endif
End-of-File
pmcpp -rs <$tmp.in 2>&1 | _filter
echo "----------------------"
pmcpp -rs -Dwant_cpu <$tmp.in 2>&1 | _filter
echo "----------------------"
echo
echo "=== -I tests ==="
mkdir $tmp
cd $tmp
cat <<End-of-File >a
#include <b>
Text from a.
End-of-File
cat <<End-of-File >b
Text from b.
End-of-File
echo "----------------------"
pmcpp -d a 2>&1 | _filter
mkdir sub
mv b sub
echo "----------------------"
pmcpp -d a 2>&1 | _filter
echo "----------------------"
pmcpp -d -I sub a 2>&1 | _filter
cat <<End-of-File >sub/b
#include "c-foobar"
Text from b.
End-of-File
mkdir sub/sub-sub
cat <<End-of-File >sub/sub-sub/c-foobar
Text from c-foobar.
End-of-File
echo "----------------------"
pmcpp -d -I sub -I sub/sub-sub a 2>&1 | _filter
echo "----------------------"
mv sub/sub-sub/c-foobar sub
mv a sub
pmcpp -d sub/a 2>&1 | _filter
echo "----------------------"
cd $here
echo "#include <Rebuild>" | pmcpp -P >$tmp.out
echo expect no diff lines ...
diff $tmp.out $PCP_VAR_DIR/pmns/Rebuild
echo "----------------------"
# success, all done
status=0
exit
|