1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 #
28 ###############################################################
29 # tests run by this program are:
30 #
31 # This routine tests help functions and target mode supported
32 # subocmmands and options
33 #
34 ###############################################################
35 # __stc_assertion_start
36 #
37 # ID: fcinfo_comstar_004
38 #
39 # DESCRIPTION:
40 # Runs help and -? options for fcinfo.
41 # - fcinfo --help
42 # - fcinfo -?
43 # - fcinfo hba-port --help
44 # - fcinfo hba-port -?
45 # - fcinfo remote-port --help
46 # - fcinfo remote-port -?
47 #
48 # STRATEGY:
49 #
50 # Setup:
51 # None
52 # Test:
53 # Verify the return code of each command listed below.
54 # Cleanup:
55 # None
56 #
57 # STRATEGY_NOTES:
58 #
59 # KEYWORDS:
60 # fcinfo hba-port remote-port
61 #
62 # TESTABILITY: explicit
63 #
64 # AUTHOR: hyon.kim@sun.com
65 #
66 # REVIEWERS: <e-mail, e-mail>
67 #
68 #
69 # ASSERTION_SOURCE:
70 #
71 # // Optional field - a pointer to the document source of the assertion
72 #
73 #
74 # TEST_AUTOMATION_LEVEL: automated
75 #
76 # CODING_STATUS: IN_PROGRESS
77 #
78 # __stc_assertion_end
79 function fcinfo_help_cmds
80 {
81 typeset return_code=0
82 typeset re_code=0
83
84 ###############################################################
85 # test help options. Failure will be recorded and continuue on
86 ###############################################################
87 CMD="fcinfo --help"
88 cti_execute_cmd "$CMD"
89 re_code=$?
90 ((return_code+=$re_code))
91 cti_report "$CMD returns: $re_code"
92
93 CMD="fcinfo -?"
94 cti_execute_cmd "$CMD"
95 re_code=$?
96 ((return_code+=$re_code))
97 cti_report "$CMD returns: $re_code"
98
99
100 CMD="fcinfo hba-port --help"
101 cti_execute_cmd "$CMD"
102 re_code=$?
103 ((return_code+=$re_code))
104 cti_report "$CMD returns: $re_code"
105
106 CMD="fcinfo hba-port -?"
107 cti_execute_cmd "$CMD"
108 re_code=$?
109 ((return_code+=$re_code))
110 cti_report "$CMD returns: $re_code"
111
112 CMD="fcinfo remote-port --help"
113 cti_execute_cmd "$CMD"
114 re_code=$?
115 ((return_code+=$re_code))
116 cti_report "$CMD returns: $re_code"
117
118 CMD="fcinfo remote-port -?"
119 cti_execute_cmd "$CMD"
120 re_code=$?
121 ((return_code+=$re_code))
122 cti_report "$CMD returns: $re_code"
123
124 return $return_code
125 }
126
127 #########################################################
128 # test purpose 001
129 #########################################################
130 function tp_fcinfo_004
131 {
132 typeset TEST_NAME="help options for fcinfo"
133 cti_assert fcinfo_comstar_004 "Testing $TEST_NAME "
134 typeset return_code=0
135 typeset re_code=0
136
137 ###############################################################
138 # test help options. Failure will be recorded and continuue on
139 ###############################################################
140 CMD="fcinfo --help"
141 cti_execute_cmd "$CMD"
142 re_code=$?
143 ((return_code+=$re_code))
144 cti_report "$CMD returns: $re_code"
145
146 CMD="fcinfo -?"
147 cti_execute_cmd "$CMD"
148 re_code=$?
149 ((return_code+=$re_code))
150 cti_report "$CMD returns: $re_code"
151
152
153 CMD="fcinfo hba-port --help"
154 cti_execute_cmd "$CMD"
155 re_code=$?
156 ((return_code+=$re_code))
157 cti_report "$CMD returns: $re_code"
158
159 CMD="fcinfo hba-port -?"
160 cti_execute_cmd "$CMD"
161 re_code=$?
162 ((return_code+=$re_code))
163 cti_report "$CMD returns: $re_code"
164
165 CMD="fcinfo remote-port --help"
166 cti_execute_cmd "$CMD"
167 re_code=$?
168 ((return_code+=$re_code))
169 cti_report "$CMD returns: $re_code"
170
171 CMD="fcinfo remote-port -?"
172 cti_execute_cmd "$CMD"
173 re_code=$?
174 ((return_code+=$re_code))
175 cti_report "$CMD returns: $re_code"
176
177 if [[ $return_code != 0 ]]
178 then
179 cti_report "Test Purpose 4: $TEST_NAME failed with return"\
180 "code $return_code"
181 cti_fail "Test Purpose 4: $TEST_NAME failed"
182 else
183 cti_report "$TEST_NAME output: "
184 cti_pass "Test Purpose 4: $TEST_NAME passed"
185 fi
186 }