summaryrefslogtreecommitdiff
path: root/qa/728
blob: 60299ae72d3f674efc5c636a743a6c0cec497537 (plain)
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
#!/bin/sh
# PCP QA Test No. 728
# Basic workout for pmGetOptions PMAPI interfaces.
#
# Copyright (c) 2014 Red Hat.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

test $PCP_VER -ge 3901 || _notrun "No support for pmGetOptions"

status=1	# failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here
echo '== Arguments: none'
$here/src/getoptions

echo '== Arguments: usage (x2)'
$here/src/getoptions -?
$here/src/getoptions --help

echo '== Arguments: own options (x2)'
$here/src/getoptions -x -X goodness
$here/src/getoptions --extra --eXtra goodness

echo '== Arguments: own short-only options'
$here/src/getoptions -y -Y not

echo '== Arguments: own long-only options'
$here/src/getoptions --fubar --foobar eek

echo '== Arguments: one archive, all time options (x2)'
$here/src/getoptions -a src/20041125.0 -z \
	-A "1 minute" -O "@10:10:10" -S "@10:15" -T "@10:30" \
	$here/src/getoptions
$here/src/getoptions --archive src/20041125.0 --hostzone \
	--align "1 minute" --origin "@10:10:10" \
	--start "@10:15" --finish "@10:30" $here/src/getoptions

echo '== Arguments: one host (x2)'
$here/src/getoptions -h foo.bar.com -t 1sec -s 5
$here/src/getoptions --host foo.bar.com --interval 1sec --samples 5

echo '== Arguments: environment variables only'
PM_OPTFLAG_ENV_ONLY=true PCP_HOST=pcp.org $here/src/getoptions -h non.org

echo '== Arguments: host, interval and samples env vars'
PCP_HOST=pcp.org PCP_INTERVAL="2 seconds" PCP_SAMPLES=5 $here/src/getoptions

echo '== Arguments: host list env var'
PCP_HOST_LIST=foo.com,bar.org $here/src/getoptions

echo '== Arguments: archive, time window env vars'
PCP_ARCHIVE=src/20041125.0 PCP_HOSTZONE=true \
	PCP_ALIGN="1 minute" PCP_ORIGIN="@10:10:10" \
	PCP_START_TIME="@10:15" PCP_FINISH_TIME="@10:30" $here/src/getoptions

echo '== Arguments: archive list env var'
PCP_ARCHIVE_LIST=foo,bar,moo $here/src/getoptions

echo '== Arguments: one archive env var'
PCP_ARCHIVE=foo $here/src/getoptions

echo '== Arguments: timezone env var'
PCP_TIMEZONE=UTC $here/src/getoptions

echo '== Arguments: hostzone env var'
PCP_HOSTZONE=true $here/src/getoptions

echo '== Arguments: gui port env var (x2)'
PCP_GUIPORT=42 $here/src/getoptions
PCP_GUIPORT=/tmp/socket $here/src/getoptions

echo '== Arguments: gui mode env var'
PCP_GUIFLAG=true $here/src/getoptions

echo '== Arguments: allow mixed hosts and archives'
PM_OPTFLAG_MIXED=true PCP_HOST=acme.com PCP_ARCHIVE=log $here/src/getoptions

# success, all done
status=0
exit