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
|
#!/bin/sh
# PCP QA Test No. 1557
# PMAPI_VERSION 2 -> 3 migration
#
# Copyright (c) 2025 Ken McDonell. All Rights Reserved.
#
if [ $# -eq 0 ]
then
seq=`basename $0`
echo "QA output created by $seq"
else
# use $seq from caller, unless not set
[ -n "$seq" ] || seq=`basename $0`
echo "QA output created by `basename $0` $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
do_valgrind=false
if [ "$1" = "--valgrind" ]
then
_check_valgrind
do_valgrind=true
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s@$tmp@TMP@g" \
# end
}
# filter out date + time stamps like ...
# start: 08/04/2025 20:50:05.444086
#
_filter_datestamp()
{
sed \
-e 's@[0-3][0-9]/../.... ..:..:..\.[0-9]*@DATESTAMP@' \
# end
}
_do_option()
{
echo
echo "--- $* ---" | tee -a $seq_full
echo "+++ v2 +++" >>$seq_full
if $do_valgrind
then
eval _run_valgrind --save-output src/getoptions_v2 -w $@
_filter <$tmp.err
cat $tmp.out | tee -a $seq_full >$tmp.v2
else
eval src/getoptions_v2 -w $@ 2>&1 | tee -a $seq_full >$tmp.v2
fi
if grep -q 'narchives: 0' <$tmp.v2
then
_filter_datestamp <$tmp.v2 >$tmp.tmp
mv $tmp.tmp $tmp.v2
fi
echo "+++ v3 +++" >>$seq_full
if $do_valgrind
then
eval _run_valgrind --save-output src/getoptions -w $@
_filter <$tmp.err
cat $tmp.out | tee -a $seq_full >$tmp.v3
else
eval src/getoptions -w $@ 2>&1 | tee -a $seq_full >$tmp.v3
fi
if grep -q 'narchives: 0' <$tmp.v3
then
_filter_datestamp <$tmp.v3 >$tmp.tmp
mv $tmp.tmp $tmp.v3
fi
echo "diffs ..."
diff $tmp.v2 $tmp.v3
}
# real QA test starts here
echo "pmOptions et al tests ..." | tee -a $seq_full
for arg in '--help' '--interval 42 -T 10m' \
'--archive archives/20041125.0 --hostzone --align "15 sec" --start "@00:10:10" --finish "@00:11:30" --origin "@00:10:20" -Dgetopt' \
'-a archives/20041125.0 -z -A "15" -S "@00:10:10" -T "@00:11:30" -O "@00:10:20" -Dgetopt'
do
_do_option "$arg"
done
# success, all done
exit
|