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
|
#!/bin/sh
# PCP QA Test No. 899
# Exercise --host-list, --archive-list, and --archive-folio options.
#
# Copyright (c) 2014 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=1 # failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
tmpdir=`dirname $tmp`
good=$here/20071023-08-06-36.folio
bad=/bin/sh
filter_folios()
{
sed \
-e "s,$tmp,TMP,g" \
-e "s,$bad,BAD,g" \
-e "s,$here,HERE,g" \
-e "s,$good,FOLIO,g" \
-e "s,$tmpdir,TMPDIR,g" \
# end
}
filter_host()
{
host=`hostname`
sed -e "s/$host/HOST/g"
}
# real QA test starts here
PM_OPTFLAG_MULTI=true; export PM_OPTFLAG_MULTI
echo '== Host list (multi) =='
$here/src/getoptions --host-list=www.acme.com,foo.bar.org,oss.sgi.com
echo '== Host list (single) =='
$here/src/getoptions --host-list=www.acme.com
echo '== Archive list (multi) =='
$here/src/getoptions --archive-list=log1,log2,log3
echo '== Archive list (single) =='
$here/src/getoptions --archive-list=log1
echo '== Archive Folio (single) =='
$here/src/getoptions --archive-folio=$good 2>&1 | filter_folios
echo '== Archive Folio (multi) =='
cat << EOF > $tmp.multi
PCPFolio
Version: 1
Archive: smash 20140624.10.52
Archive: verge 20140624.00.10
EOF
$here/src/getoptions --archive-folio=$tmp.multi 2>&1 | filter_folios
echo '== Archive Folio (binary) =='
$here/src/getoptions --archive-folio=$bad 2>&1 | filter_folios
echo '== Archive Folio (badmagic) =='
cat <<EOF > $tmp.badmagic
PPCFolio
Version: 1
Archive: smash 20140624.10.52
EOF
$here/src/getoptions --archive-folio=$tmp.badmagic 2>&1 | filter_folios
echo '== Archive Folio (version2) =='
cat <<EOF > $tmp.version2
PCPFolio
Version: 2
Archive: smash 20140624.10.52
EOF
$here/src/getoptions --archive-folio=$tmp.version2 2>&1 | filter_folios
echo '== Archive Folio (nohost) =='
cat <<EOF > $tmp.nohost
PCPFolio
Version: 1
Archive: 20140624.10.52
EOF
$here/src/getoptions --archive-folio=$tmp.nohost 2>&1 | filter_folios
echo '== Archive Folio (empty) =='
cat <<EOF > $tmp.empty
PCPFolio
Version: 1
EOF
$here/src/getoptions --archive-folio=$tmp.empty 2>&1 | filter_folios
echo '== Check folio containing absolute paths to archives =='
mkaf $PCP_ARCHIVE_DIR/`hostname` >$tmp.absolutepaths 2>/dev/null
$here/src/getoptions --archive-folio=$tmp.absolutepaths | \
grep ' archives:' | sed -e 's/archives: //' -e 's/,/ /g' >$tmp.archives
for a in `cat $tmp.archives`; do [ -f "$a".index ] || echo archive not found \"$a\"; done
# success, all done
status=0
exit
|