Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 817
blobfb3bae336a76e56c8d0f952c9ac3ad1c5364e744
1 #!/bin/sh
2 # PCP QA Test No. 817
3 # Test libpcp multi-archive support using pmclient_fg
5 # Copyright (c) 2016 Red Hat. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 _get_libpcp_config
17 $multi_archive_contexts || _notrun "Multi-archive support is not available"
19 status=1 # failure is the default!
20 $sudo rm -rf $tmp $tmp.* $seq.full
21 trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
23 _filter()
25 tmpx=`echo $tmp`
26 sed -e 's/^Archive:.* Host:/ARCHIVE: Host:/' \
27 -e "s|$tmpx|TMP|g"
30 # real QA test starts here
31 DIR=archives/multi
32 TOOL=pmstat
33 mkdir -p $tmp.archives
35 # Check that running pmstat on a set of archives performs identically
36 # to running it on the archive created by combining those same archives
37 # using pmlogextract.
39 # First, run pmlogextract against the archives.
40 IN="$DIR/20150508.11.44 $DIR/20150508.11.46 $DIR/20150508.11.50 $DIR/20150508.11.57"
41 OUT=$tmp.44+46+50+57.pmlogextract
42 rm -f $OUT.*
43 echo "Running pmlogextract $IN $OUT" | _filter | tee $seq.full
44 pmlogextract $IN $OUT 2>&1 >> $seq.full
45 [ $? -eq 0 ] || echo "Error running pmlogextract $IN $OUT -- see $seq.full"
47 # Now run pmstat against the extracted archive.
48 IN=$OUT
49 OUTBASE=$OUT.$TOOL.txt
50 echo "Running $TOOL -z -a $IN" | _filter
51 $TOOL -z -a $IN 2>&1 | _filter | tee $OUTBASE
53 # Now, run pmstat against the set of archives.
54 IN=$DIR/20150508.11.44,$DIR/20150508.11.46,$DIR/20150508.11.50,$DIR/20150508.11.57
55 OUT=$tmp.44+46+50+57.$TOOL.txt
56 echo "Running $TOOL -z -a $IN" | _filter
57 $TOOL -z -a $IN 2>&1 | _filter | tee $OUT
59 # Make sure the output is the same
60 echo "Running diff $OUTBASE $OUT" | _filter | tee -a $seq.full
61 diff $OUTBASE $OUT 2>&1 >> $seq.full
62 [ $? -eq 0 ] || echo "$OUT differs from $OUTBASE -- see $seq.full"
64 # Now do it again, specifying the set of archives using the directory name
65 IN=$DIR
66 OUT=$tmp.$DIR.$TOOL.txt
67 echo "Running $TOOL -z -a $IN" | _filter
68 $TOOL -z -a $IN 2>&1 | _filter | tee $OUT
70 # Make sure the output is the same
71 echo "Running diff $OUTBASE $OUT" | _filter | tee -a $seq.full
72 diff $OUTBASE $OUT 2>&1 >> $seq.full
73 [ $? -eq 0 ] || echo "$OUT differs from $OUTBASE -- see $seq.full"
75 # success, all done
76 status=0
77 exit