blob: 5accb0bc8d782979cc07002c9096601e4aee4056 [file] [log] [blame]
Leah McNuttc9c9cde2016-10-07 16:53:52 +00001*** Settings ***
2Documentation Does random repeated IPLs based on the state of the machine. The
3... number of repetitions is designated by ${IPL_TOTAL}. Keyword names that are
4... listed in @{AVAIL_IPLS} become the selection of possible IPLs for the test.
5
6Resource ../lib/boot/boot_resource_master.robot
7Resource ../lib/dvt/obmc_call_points.robot
8Resource ../lib/dvt/obmc_driver_vars.txt
9Resource ../lib/list_utils.robot
10
11*** Test Cases ***
12Repeated Testing
13 [Documentation] Performs random, repeated IPLs.
George Keishing9aa0f652016-11-08 03:28:56 -060014 [Tags] Repeated_Testing
Leah McNuttc9c9cde2016-10-07 16:53:52 +000015
16 # Call the Main keyword to prevent any dots from appearing in the console
17 # due to top level keywords.
18 Main
19
20*** Keywords ***
21Main
22 Log to Console ${SUITE NAME}
23
24 Do Test Setup
25 Call Point Setup
26
27 Log Doing ${IPL_TOTAL} IPLs console=True
28
29 :FOR ${IPL_COUNT} IN RANGE ${IPL_TOTAL}
30 \ Log ${\n}***Starting IPL ${IPL_COUNT+1} of ${IPL_TOTAL}*** console=True
31 \ Validate Or Open Connection alias=${master_alias}
32 \ ${cur_state}= Get Power State
33 \ ${next_IPL}= Select IPL ${cur_state}
34 \ Call Point Pre Boot
35 \ Log We are doing a ${next_IPL}${\n} console=True
36 \ Update Last Ten ${next_IPL}
37 \ Run Keyword and Continue On Failure Run IPL ${next_IPL}
38 \ Call Point Post Boot
39 \ Run Keyword If '${IPL_STATUS}' == 'PASS'
40 ... Log IPL_SUCCESS: "${next_IPL}" succeeded. console=True
41 ... ELSE Log IPL_FAILED: ${next_IPL} failed. console=True
42 \ Update Run Table Values ${next_IPL}
43 \ Log FFDC Dump requested! console=True
44 \ Log ***Beginning dump of FFDC*** console=True
45 \ Call Point FFDC
46 \ Log Defect Information
47 \ Log Last Ten IPLs
48 \ Log FFDC Files
49 \ Log ***Finished dumping of FFDC*** console=True
50 \ Call Point Stop Check
51 \ Log FFDC Summary
52 \ Log Run Table
53 \ Log ${\n}***Finished IPL ${IPL_COUNT+1} of ${IPL_TOTAL}*** console=True
54
55Do Test Setup
56 [Documentation] Do any setup that needs to be done before running a series
57 ... of IPLs.
58
59 Should Not Be Empty ${AVAIL_IPLS}
60
61 Setup Run Table
62 Log ***Start of status file for ${OPENBMC_HOST}*** console=True
63
64Setup Run Table
65 [Documentation] For each available IPL, create a variable that stores the
66 ... number of passes and fails for each IPL.
67
68 Log to Console Setting up run table.
69
70 :FOR ${ipl} IN @{AVAIL_IPLS}
71 \ Set Global Variable ${${ipl}_PASS} ${0}
72 \ Set Global Variable ${${ipl}_FAIL} ${0}
73
74Select IPL
75 [Documentation] Contains all of the logic for which IPLs can be chosen
76 ... given the inputted state. Returns the chosen IPL.
77 [Arguments] ${cur_state}
78
79 # cur_state The power state of the machine, either zero or one.
80
81 ${ipl}= Run Keyword If ${cur_state} == ${0} Select Power On
82 ... ELSE Run Keyword If ${cur_state} == ${1} Select Power Off
83 ... ELSE Run Keywords Log to Console
84 ... **ERROR** BMC not in state to power on or off: "${cur_state}" AND
85 ... Fatal Error
86
87 [return] ${ipl}
88
89Select Power On
90 [Documentation] Randomly chooses an IPL from the list of Power On IPLs.
91
92 @{power_on_choices}= Intersect Lists ${VALID_POWER_ON} ${AVAIL_IPLS}
93
94 ${length}= Get Length ${power_on_choices}
95
96 # Currently selects the first IPL in the list of options, rather than
97 # selecting randomly.
98 ${chosen}= Set Variable @{power_on_choices}[0]
99
100 [return] ${chosen}
101
102Select Power Off
103 [Documentation] Randomly chooses an IPL from the list of Power Off IPLs.
104
105 @{power_off_choices}= Intersect Lists ${VALID_POWER_OFF} ${AVAIL_IPLS}
106
107 ${length}= Get Length ${power_off_choices}
108
109 # Currently selects the first IPL in the list of options, rather than
110 # selecting randomly.
111 ${chosen}= Set Variable @{power_off_choices}[0]
112
113 [return] ${chosen}
114
115Run IPL
116 [Documentation] Runs the selected IPL and marks the status when complete.
117 [Arguments] ${ipl_keyword}
118 [Teardown] Set Global Variable ${IPL_STATUS} ${KEYWORD STATUS}
119
120 # ipl_keyword The name of the IPL to run, which corresponds to the
121 # keyword to run. (i.e "BMC Power On")
122
123 Run Keyword ${ipl_keyword}
124
125Log Defect Information
126 [Documentation] Logs information needed for a defect. This information
127 ... can also be found within the FFDC gathered.
128
129 Log Copy this data to the defect: console=True
130
131Log Last Ten IPLs
132 [Documentation] Logs the last ten IPLs that were performed with their
133 ... starting time stamp.
134
135 Log ${\n}----------------------------------${\n}Last 10 IPLs${\n}
136 ... console=True
137 :FOR ${ipl} IN @{LAST_TEN}
138 \ Log ${ipl} console=True
139 Log ----------------------------------${\n} console=True
140
141Log FFDC Files
142 [Documentation] Logs the files outputted during FFDC gathering.
143 Log This is where the list of FFDC files would be. console=True
144
145Log FFDC Summary
146 [Documentation] Logs finding from within the FFDC files gathered.
147 Log This is where the FFDC summary would go. console=True
148
149Log Run Table
150 [Documentation] Logs the table of IPLs that have passed and failed based on
151 ... the available IPLs, as well as the total passes and failures.
152
153 Log ${\n}IPL type${space*14}Pass${space*3}Fail console=True
154 Log ================================== console=True
155 :FOR ${ipl} IN @{AVAIL_IPLS}
156 \ ${length}= Get Length ${ipl}
157 \ ${space_num}= Set Variable ${24-${length}}
158 \ Log ${ipl}${space*${space_num}}${${ipl}_PASS}${space*5}${${ipl}_FAIL}
159 ... console=True
160 Log ================================== console=True
161 Log Totals:${space*17}${IPL_PASSED}${space*5}${IPL_FAILED}${\n}
162 ... console=True
163
164Update Run Table Values
165 [Documentation] Updates the table of IPLs that have passed and failed. See
166 ... the "Log Run Table" keyword for more information.
167 [Arguments] ${last_ipl}
168
169 # last_ipl The name of the last IPL that ran (i.e "BMC Power On").
170
171 ${cur_value}= Get Variable Value ${${last_ipl}_${IPL_STATUS}}
172 Set Global Variable ${${last_ipl}_${IPL_STATUS}} ${cur_value+1}
173 ${total_value}= Run Keyword If '${IPL_STATUS}' == 'PASS'
174 ... Get Variable Value ${IPL_PASSED}
175 ... ELSE Get Variable Value ${IPL_FAILED}
176 Run Keyword If '${IPL_STATUS}' == 'PASS'
177 ... Set Global Variable ${IPL_PASSED} ${total_value+1}
178 ... ELSE Set Global Variable ${IPL_FAILED} ${total_value+1}
179
180Update Last Ten
181 [Documentation] Updates the list of last ten IPLs
182 [Arguments] ${last_ipl}
183
184 # last_ipl The name of the last IPL that ran (i.e. "BMC Power On")
185
186 ${time}= Get Time
187 Append to List ${LAST_TEN} ${time} - Doing "${last_ipl}"