/var/lib/pcp/testsuite/1100 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 | #!/bin/sh
# Shell completion check / QA Test No. 1100
#
# Copyright (c) 2017 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.python
. ./common.config
echo "PCPQA_CLOSE_X_SERVER=$PCPQA_CLOSE_X_SERVER" >>$here/$seq.full
status=1 # failure is the default!
$sudo rm -rf $tmp $tmp.* $seq.full
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
export PCP_STDERR=$tmp.err
echo "DISPLAY=$DISPLAY" >>$here/$seq.full
echo "PCPQA_CLOSE_X_SERVER=$PCPQA_CLOSE_X_SERVER" >>$here/$seq.full
if [ -z "$DISPLAY" ]
then
export DISPLAY=$PCPQA_CLOSE_X_SERVER
echo "DISPLAY=$DISPLAY" >>$here/$seq.full
fi
# these may not be available if needed modules missing
#
skip_pcp2elasticsearch=false
$python -c "from elasticsearch import Elasticsearch" >/dev/null 2>&1
[ $? -eq 0 ] || skip_pcp2elasticsearch=true
skip_pcp2xlsx=false
$python -c "import xlsxwriter" >/dev/null 2>&1
[ $? -eq 0 ] || skip_pcp2xlsx=true
skip_pmrep=false
$python -c "from collections import OrderedDict" >/dev/null 2>&1
if [ $? -ne 0 ]; then
skip_pmrep=true
skip_pcp2xml=true
skip_pcp2json=true
skip_pcp2graphite=true
skip_pcp2influxdb=true
skip_pcp2zabbix=true
fi
# these may not be available if X11 display is missing
#
skip_pmchart=false
which xdpyinfo >/dev/null 2>&1
if [ $? -eq 0 ]
then
xdpyinfo >/dev/null 2>&1
[ $? -eq 0 ] || skip_pmchart=true
else
skip_pmchart=true
fi
# sources
share_dir=`dirname $PCP_SHARE_DIR`
bash_comp=${share_dir}/bash-completion/completions/pcp
zsh_comp=${share_dir}/zsh/site-functions/_pcp
# functions
_check_completion_bash()
{
cmds="$(grep ' pcp2.*)' $bash_comp | tr -d ')'))"
cmds="$cmds $(grep ' pm.*)' $bash_comp | tr -d ')')"
for cmd in $cmds; do
$skip_pcp2elasticsearch && [ "$cmd" = pcp2elasticsearch ] && continue
$skip_pcp2graphite && [ "$cmd" = pcp2graphite ] && continue
$skip_pcp2influxdb && [ "$cmd" = pcp2influxdb ] && continue
$skip_pcp2zabbix && [ "$cmd" = pcp2zabbix ] && continue
$skip_pcp2json && [ "$cmd" = pcp2json ] && continue
$skip_pcp2xlsx && [ "$cmd" = pcp2xlsx ] && continue
$skip_pcp2xml && [ "$cmd" = pcp2xml ] && continue
$skip_pmchart && [ "$cmd" = pmchart ] && continue
$skip_pmrep && [ "$cmd" = pmrep ] && continue
comps=$(grep -A 1 " $cmd)" $bash_comp | tail -n 1 | sed -e 's,all_args=",,' -e 's,",,')
# Need $tmp.err and PCP_STDERR for pmchart ...
#
rm -f $tmp.err
touch $tmp.err
echo "=== bash $cmd ===" >>$here/$seq.full
echo "comps=$comps" >>$here/$seq.full
$cmd --help >$tmp.out 2>&1
echo "--- stdout ---" >>$here/$seq.full
cat $tmp.out >>$here/$seq.full
echo "--- stderr ---" >>$here/$seq.full
cat $tmp.err >>$here/$seq.full
opts=$(cat $tmp.out $tmp.err | grep -Eo -- ' -.' | tr -d '-' | tr -d '?' | sort | uniq)
echo "opts=$opts" >>$here/$seq.full
for opt in $opts; do
echo $comps | grep $opt > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$opt missing for $cmd bash completions"
fi
done
for comp in $(echo $comps | grep -o .); do
echo $opts | grep $comp > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$comp looks extraneous for $cmd bash completions"
fi
done
done
}
_check_completion_zsh()
{
for cmd in $(grep '#compdef' $zsh_comp | sed -e 's,#compdef ,,'); do
$skip_pcp2elasticsearch && [ "$cmd" = pcp2elasticsearch ] && continue
$skip_pcp2graphite && [ "$cmd" = pcp2graphite ] && continue
$skip_pcp2influxdb && [ "$cmd" = pcp2influxdb ] && continue
$skip_pcp2zabbix && [ "$cmd" = pcp2zabbix ] && continue
$skip_pcp2json && [ "$cmd" = pcp2json ] && continue
$skip_pcp2xlsx && [ "$cmd" = pcp2xlsx ] && continue
$skip_pcp2xml && [ "$cmd" = pcp2xml ] && continue
$skip_pmchart && [ "$cmd" = pmchart ] && continue
$skip_pmrep && [ "$cmd" = pmrep ] && continue
echo $cmd | grep = > /dev/null 2>&1 && continue
common=$(awk "/common_most=/,/ \)/" $zsh_comp)
pytool=$(awk "/common_python=/,/ \)/" $zsh_comp)
pmda=$(awk "/common_pmda=/,/ \)/" $zsh_comp)
version=V
comps=$(awk "/ $cmd\)/,/\;\;/" $zsh_comp | sed -e 's,equivalent to .*,,')
# Need $tmp.err and PCP_STDERR for pmchart ...
#
rm -f $tmp.err
touch $tmp.err
echo "=== zsh $cmd ===" >>$here/$seq.full
echo "comps=$comps" >>$here/$seq.full
$cmd --help >$tmp.out 2>&1
echo "--- stdout ---" >>$here/$seq.full
cat $tmp.out >>$here/$seq.full
echo "--- stderr ---" >>$here/$seq.full
cat $tmp.err >>$here/$seq.full
opts=$(cat $tmp.out $tmp.err | sed -e 's,equivalent to .*,,' | grep -Eo -- ' -[^-].' | tr -d - | tr -d '?' | tr -d , | sort | uniq)
echo "opts=$opts" >>$here/$seq.full
for opt in $opts; do
echo $comps | grep -E -- '({-'$opt'|"-'$opt')' > /dev/null 2>&1
not_found=$?
if [ $not_found -ne 0 ]; then
if [ "$opt" = "V" ]; then
echo $comps | grep common_help > /dev/null 2>&1
not_found=$?
fi
fi
if [ $not_found -ne 0 ]; then
echo $comps | grep common_most > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo $common | grep -E -- '({-'$opt'|"-'$opt')' > /dev/null 2>&1
not_found=$?
fi
fi
if [ $not_found -ne 0 ]; then
echo $comps | grep common_pmda > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo $pmda | grep -E -- '({-'$opt'|"-'$opt')' > /dev/null 2>&1
not_found=$?
fi
fi
if [ $not_found -ne 0 ]; then
echo $comps | grep common_python > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo $pytool | grep -E -- '({-'$opt'|"-'$opt')' > /dev/null 2>&1
not_found=$?
fi
fi
if [ $not_found -ne 0 ]; then
echo "$opt missing for $cmd zsh completions"
fi
done
for comp in $(echo $comps | grep -o \"\(-. | tr -d '"' | tr -d '(' | tr -d '-'); do
echo $opts | grep $comp > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$comp looks extraneous for $cmd zsh completions"
fi
done
done
}
# real QA test starts here
echo "== only V+u for pmlogger should be missing"
_check_completion_bash
_check_completion_zsh
# success, all done
echo "== done"
status=0
exit
|