pmrep: fix archive end time reporting
[pcp.git] / qa / 812
blob2c0787766f64afb3309302413399056ccf0f7749
1 #!/bin/sh
2 # PCP QA Test No. 812
3 # pmlogextract with config file and various instance specifications
5 # Copyright (c) 2015 Ken McDonell. 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 status=1 # failure is the default!
17 $sudo rm -rf $tmp.* $seq.full
18 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
20 _filter()
22 sed \
23 -e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
26 _sort_pmdumplog()
28 $PCP_AWK_PROG '
29 BEGIN { in_inst = 0
30 part = 0
31 pname = sprintf("%03d",part)
32 outname = "'"$tmp"'." pname
34 in_inst == 1 && NF == 0 { in_inst = 0
35 close(outname)
36 part++
37 pname = sprintf("%03d",part)
38 outname = "'"$tmp"'." pname
40 in_inst == 0 && / inst \[/ { in_inst = 1
41 close(outname)
42 part++
43 pname = sprintf("%03d",part)
44 outname = "'"$tmp"'." pname
46 { if (part <= 999)
47 print >outname
48 else {
49 # too many parts to sort
50 exit 1
53 if [ $? -ne 0 ]
54 then
55 echo >&2 "--- 000 ---"
56 [ -f $tmp.000 ] && cat >&2 $tmp.000
57 echo >&2 "--- 001 ---"
58 [ -f $tmp.001 ] && cat >&2 $tmp.001
59 echo >&2 "--- ... ---"
60 echo >&2 "--- 999 ---"
61 [ -f $tmp.999 ] && cat >&2 $tmp.999
62 echo >&2 "_sort_pmdumplog failed: more than 999 parts to sort"
63 exit 1
65 for p in $tmp.[0-9][0-9][0-9]
67 LC_COLLATE=POSIX sort $p
68 rm $p
69 done
72 pmdumplog -z archives/chartqa1 sample.mirage >$tmp.tmp
73 _sort_pmdumplog <$tmp.tmp >$tmp.ref.mirage || exit
74 pmdumplog -z archives/chartqa1 sample.bin >$tmp.tmp
75 _sort_pmdumplog <$tmp.tmp >$tmp.ref.bin || exit
77 _do_diffs()
79 echo "--- sample.mirage diffs ---"
80 pmdumplog -z $tmp sample.mirage >$tmp.tmp
81 if _sort_pmdumplog <$tmp.tmp
82 then
84 else
85 exit
86 fi \
87 | diff - $tmp.ref.mirage
88 echo "--- sample.bin diffs ---"
89 pmdumplog -z $tmp sample.bin | _sort_pmdumplog | diff - $tmp.ref.bin
92 # real QA test starts here
93 echo "=== pmlogextract no config ==="
94 rm -f $tmp.0 $tmp.meta $tmp.index
95 pmlogextract -z archives/chartqa1 $tmp
96 _do_diffs
98 echo
99 echo "=== pmlogextract config with metrics, no instances ==="
100 rm -f $tmp.0 $tmp.meta $tmp.index
101 cat <<End-of-File >$tmp.config
102 sample.mirage
103 sample.bin
104 End-of-File
105 pmlogextract -z -c $tmp.config archives/chartqa1 $tmp
106 _do_diffs
108 echo
109 echo "=== pmlogextract config with metrics, all instances in order ==="
110 rm -f $tmp.0 $tmp.meta $tmp.index
111 cat <<End-of-File >$tmp.config
112 sample.mirage["m-00","m-01","m-02","m-03","m-04","m-05","m-08","m-09","m-10","m-11","m-12","m-13","m-14","m-15","m-16","m-17","m-18","m-19","m-20"]
113 sample.bin[ "bin-100" "bin-200" "bin-300" "bin-400" "bin-500" "bin-600" "bin-700" "bin-800" "bin-900" ]
114 End-of-File
115 pmlogextract -z -c $tmp.config archives/chartqa1 $tmp
116 _do_diffs
118 echo
119 echo "=== pmlogextract config with metrics, all instances in reverse order ==="
120 rm -f $tmp.0 $tmp.meta $tmp.index
121 cat <<End-of-File >$tmp.config
122 sample.mirage["m-20","m-19","m-18","m-17","m-16","m-15","m-14","m-13","m-12","m-11","m-10","m-09","m-08","m-05","m-04","m-03","m-02","m-01","m-00"]
123 sample.bin[ "bin-900" "bin-800" "bin-700" "bin-600" "bin-500" "bin-400" "bin-300" "bin-200" "bin-100" ]
124 End-of-File
125 pmlogextract -z -c $tmp.config archives/chartqa1 $tmp
126 _do_diffs
128 echo
129 echo "=== pmlogextract config with metrics, some instances ==="
130 rm -f $tmp.0 $tmp.meta $tmp.index
131 cat <<End-of-File >$tmp.config
132 sample.mirage["m-19","m-18","m-17","m-16","m-15","m-14","m-13","m-12","m-11","m-09","m-08","m-05","m-04","m-03","m-02","m-00"]
133 sample.bin[ "bin-800" "bin-700" "bin-600" "bin-500" "bin-400" "bin-300" "bin-200" ]
134 End-of-File
135 pmlogextract -z -c $tmp.config archives/chartqa1 $tmp
136 _do_diffs
138 # success, all done
139 status=0
141 exit