3 # Basic workout for pmGetOptions PMAPI interfaces.
5 # Copyright (c) 2014 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 test $PCP_VER -ge 30901 || _notrun
"No support for pmGetOptions"
18 status
=1 # failure is the default!
19 $sudo rm -rf $tmp.
* $seq.full
20 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 # real QA test starts here
23 echo '== Arguments: none'
26 echo '== Arguments: usage (x2)'
27 $here/src
/getoptions
-?
28 $here/src
/getoptions
--help
30 echo '== Arguments: own options (x2)'
31 $here/src
/getoptions
-x -X goodness
32 $here/src
/getoptions
--extra --eXtra goodness
34 echo '== Arguments: own short-only options'
35 $here/src
/getoptions
-y -Y not
37 echo '== Arguments: own long-only options'
38 $here/src
/getoptions
--fubar --foobar eek
40 echo '== Arguments: one archive, all time options (x2)'
41 $here/src
/getoptions
-a archives
/20041125.0 -z \
42 -A "1 minute" -O "@10:10:10" -S "@10:15" -T "@10:30" \
44 $here/src
/getoptions
--archive archives
/20041125.0 --hostzone \
45 --align "1 minute" --origin "@10:10:10" \
46 --start "@10:15" --finish "@10:30" $here/src
/getoptions
48 echo '== Arguments: one host (x2)'
49 $here/src
/getoptions
-h foo.bar.com
-t 1sec
-s 5
50 $here/src
/getoptions
--host foo.bar.com
--interval 1sec
--samples 5
52 echo '== Arguments: environment variables only'
53 PM_OPTFLAG_ENV_ONLY
=true PCP_HOST
=pcp.org
$here/src
/getoptions
-h non.org
55 echo '== Arguments: host, interval and samples env vars'
56 PCP_HOST
=pcp.org PCP_INTERVAL
="2 seconds" PCP_SAMPLES
=5 $here/src
/getoptions
58 echo '== Arguments: host list env var'
59 PCP_HOST_LIST
=foo.com
,bar.org
$here/src
/getoptions
61 echo '== Arguments: archive, time window env vars'
62 PCP_ARCHIVE
=archives
/20041125.0 PCP_HOSTZONE
=true \
63 PCP_ALIGN
="1 minute" PCP_ORIGIN
="@10:10:10" \
64 PCP_START_TIME
="@10:15" PCP_FINISH_TIME
="@10:30" $here/src
/getoptions
66 echo '== Arguments: archive list env var'
67 PCP_ARCHIVE_LIST
=foo
,bar
,moo
$here/src
/getoptions
69 echo '== Arguments: one archive env var'
70 PCP_ARCHIVE
=foo
$here/src
/getoptions
72 echo '== Arguments: timezone env var'
73 PCP_TIMEZONE
=UTC
$here/src
/getoptions
75 echo '== Arguments: hostzone env var'
76 PCP_HOSTZONE
=true
$here/src
/getoptions
78 echo '== Arguments: gui port env var (x2)'
79 PCP_GUIPORT
=42 $here/src
/getoptions
80 PCP_GUIPORT
=/tmp
/socket
$here/src
/getoptions
82 echo '== Arguments: gui mode env var'
83 PCP_GUIFLAG
=true
$here/src
/getoptions
85 echo '== Arguments: allow mixed hosts and archives'
86 PM_OPTFLAG_MIXED
=true PCP_HOST
=acme.com PCP_ARCHIVE
=log
$here/src
/getoptions
88 echo '== Arguments: hosts file'
89 echo foo.bar.com
> $tmp.hosts
90 echo acme.com
>> $tmp.hosts
91 PM_OPTFLAG_MULTI
=true
$here/src
/getoptions
-H $tmp.hosts