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