/var/lib/pcp/testsuite/492 is in pcp-testsuite 3.8.12ubuntu1.
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 | #!/bin/sh
# PCP QA Test No. 492
# pmlogrewrite error cases
#
# Copyright (c) 2011 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
which pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"
rm -f $seq.out
if [ $PCP_VER -lt 3600 ]
then
ln $seq.out.1 $seq.out || exit 1
else
ln $seq.out.2 $seq.out || exit 1
fi
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -rf $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s;$tmp;TMP;g"
}
_filter_usage()
{
sed \
-e '/illegal option/{
s/illegal/invalid/
s/.$/'"'&'"'/
}' \
-e '/invalid option/s/[^'"'"']$/'"'&'"'/'
}
_cnt_logrecs()
{
if [ ! -f $1.0 ]
then
echo no file
else
pmdumplog $1 2>/dev/null | grep '^[0-9]' | wc -l | sed -e 's/ //g'
fi
}
# real QA test starts here
echo "=== usage cases ==="
pmlogrewrite -x in out 2>&1 | _filter_usage
echo
pmlogrewrite in out foo
echo
pmlogrewrite -c no.such.file in out
echo
pmlogrewrite -c /dev/tty in out
echo
touch $tmp.forbidden
chmod 0 $tmp.forbidden
pmlogrewrite -c $tmp.forbidden src/rattle $tmp.new 2>&1 | _filter
rm -f $tmp.new.* $tmp.forbidden
echo
mkdir $tmp.forbiddendir
chmod 0 $tmp.forbiddendir
pmlogrewrite -c $tmp.forbiddendir in out 2>&1 | _filter
echo
pmlogrewrite -c $tmp.forbiddendir/blah in out 2>&1 | _filter
chmod 755 $tmp.forbiddendir
rm -rf $tmp.forbiddendir
echo
mkdir $tmp.configdir
touch $tmp.configdir/forbidden
chmod 0 $tmp.configdir/forbidden
pmlogrewrite -v -c $tmp.configdir src/rattle $tmp.new 2>&1 | _filter
echo
ln -s $tmp.configdir/forbidden $tmp.link
pmlogrewrite -v -c $tmp.link src/rattle $tmp.new 2>&1 | _filter
rm -rf $tmp.config $tmp.forbidden
echo
rm -f $tmp.link
ln -s $tmp.configdir $tmp.link
pmlogrewrite -v -c $tmp.link src/rattle $tmp.new 2>&1 | _filter
rm -rf $tmp.configdir $tmp.link
echo
echo "=== truncated archive ==="
pmlogrewrite src/ok-truncbin $tmp.new 2>&1 | _filter
echo "input records: `_cnt_logrecs src/ok-truncbin`"
echo "output records: `_cnt_logrecs $tmp.new`"
echo
echo "=== truncated archive -d ==="
rm -f $tmp.new.*
pmlogrewrite -d src/ok-truncbin $tmp.new 2>&1 | _filter
echo "input records: `_cnt_logrecs src/ok-truncbin`"
echo "output records: `_cnt_logrecs $tmp.new`"
echo
echo "=== bad label ==="
rm -f $tmp.new.*
pmlogrewrite -d src/badlen-8 $tmp.new 2>&1 | _filter
echo "input records: `_cnt_logrecs src/badlen-8`"
echo "output records: `_cnt_logrecs $tmp.new`"
echo
echo "=== truncated metadata ==="
rm -f $tmp.new.*
pmlogrewrite -d src/badlen-9 $tmp.new 2>&1 | _filter
echo "input records: `_cnt_logrecs src/badlen-9`"
echo "output records: `_cnt_logrecs $tmp.new`"
echo
echo "=== bad version ==="
rm -f $tmp.new.*
pmlogrewrite -d src/err_v1 $tmp.new 2>&1 | _filter
echo "input records: `_cnt_logrecs src/err_v1`"
echo "output records: `_cnt_logrecs $tmp.new`"
rm -f $tmp.new.*
# success, all done
exit
|