qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 978
blob02fa7bd077b03446fb1c861bf0f493f14aef71d5
1 #!/bin/sh
2 # PCP QA Test No. 978
3 # Exercise pmgetopt(1) functionality.
5 # Copyright (c) 2014 Red Hat.
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 # real QA test starts here
21 cat > $tmp.config1 <<EOF
22 # getopts: A:a:D:gh:Ln:O:p:PS:s:T:t:Z:z?
23 # Usage: [options] [[...] command [...]]
25 Summary Options:
26 --archive
27 --host
28 --namespace
29 -P,--pmie display pmie evaluation statistics
30 --help
32 Command Options:
33 --host
34 --namespace
35 --align
36 --archive
37 -g start in GUI mode with new time control
38 -n=FILE use an alternative PMNS
39 -O=TIME initial sample time within the time window
40 -p=N port for connection to existing time control
41 -S=TIME start of the time window
42 -s=N terminate after this many samples
43 -T=TIME end of the time window
44 -t=DELTA sampling interval
45 --timezone
46 -z set reporting timezone to local time of metrics source
47 # End
49 Anything beyond "End" will simply be appended to the usage message.
51 Anything at all.
52 EOF
54 # verify basic handling of a series of options passed in
55 echo == verify usage message generation
56 pmgetopt --config=$tmp.config1 --usage --progname=pcp
57 echo == verify handling of -a xxx -h yyy
58 pmgetopt < $tmp.config1 -- -a xxx -h yyy
59 echo == verify handling of -z -g --timezone TZ
60 pmgetopt < $tmp.config1 -- -z -g --timezone TZ
62 # verify automatic generation of getopt string and all short/long opt combos
63 cat > $tmp.config2 <<EOF
64 # Usage: [options] archive
66 Options:
67 --align
68 --origin
69 --namespace
70 -d, --delay pause between updates for archive replay
71 -f=N,--fixed=N fixed output format with N digits precision
72 --origin=TIME initial sample time within the time window
73 -t=DELTA, --samples=delta sampling interval
74 -r,--raw output raw counter values (no rate conversion)
75 -s=N terminate after this many samples
76 -u non-interpolated fetching; ignores interval
77 --width set the width of each column of output
78 --help
79 EOF
81 echo == verify usage message generation without getopt
82 opts2="--config=$tmp.config2 --progname=pcpqa"
83 pmgetopt $opts2 --usage
84 echo == verify handling of mixing short and long options
85 pmgetopt $opts2 -- --delay -f 5 /a/b/pcplog
86 echo == verify handling of spaces and single quotes
87 pmgetopt $opts2 -- "/a/b/pcp log" "/c/d/foo'bar"
88 echo == verify handling of an invalid option
89 pmgetopt $opts2 -- -x /a/b/pcplog
91 # verify automatic generation of getopt string and extra long opt combos
92 cat > $tmp.config3 <<EOF
93 Options:
94 --host-list
95 --archive-list
96 --archive-folio
97 --help
98 EOF
100 echo == verify handling of archive folios and host/archive lists
101 opts3="--config=$tmp.config3 --progname=pcpqa"
102 pmgetopt $opts3 --usage
103 pmgetopt $opts3 -- --archive-folio=20071023-08-06-36.folio
105 # success, all done
106 status=0
107 exit