@@ -60,11 +60,14 @@ def setUp(self):
60
60
self .cv_IPMI = conf .ipmi ()
61
61
self .cv_SYSTEM = conf .system ()
62
62
self .bmc_type = conf .args .bmc_type
63
+ self .timeout = 30
63
64
64
65
def number_reboots_to_do (self ):
65
66
return 2
66
67
67
68
def boot_to_os (self ):
69
+ self .timeout = 15
70
+ self .target = OpSystemState .IPLing
68
71
return False
69
72
70
73
def do_things_while_booted (self ):
@@ -102,8 +105,10 @@ def runTest(self):
102
105
self .skipTest ("Qemu platform doesn't have fast-reboot support" )
103
106
104
107
if self .boot_to_os ():
108
+ self .cv_SYSTEM .sys_set_bootdev_no_override ()
105
109
self .cv_SYSTEM .goto_state (OpSystemState .OS )
106
110
else :
111
+ self .cv_SYSTEM .sys_set_bootdev_setup ()
107
112
self .cv_SYSTEM .goto_state (OpSystemState .PETITBOOT_SHELL )
108
113
109
114
c = self .cv_SYSTEM .console
@@ -125,7 +130,7 @@ def runTest(self):
125
130
"grep '^cpu' /proc/cpuinfo|uniq|sed -e 's/^.*: //;s/[,]* .*//;'" ))
126
131
log .debug (repr (cpu ))
127
132
if cpu not in ["POWER9" , "POWER8" , "POWER8E" ]:
128
- self .skipTest ("Fast Reboot not supported on %s" % cpu )
133
+ self .skipTest ("Fast Reboot not supported on {}" . format ( cpu ) )
129
134
130
135
if not self .cv_SYSTEM .has_mtd_pnor_access ():
131
136
self .skipTest ("OpTestSystem does not have MTD PNOR access,"
@@ -139,34 +144,50 @@ def runTest(self):
139
144
self .assertIn ("feeling-lucky" , res ,
140
145
"Failed to set the fast-reset mode" )
141
146
initialResetCount = self .get_fast_reset_count (c )
142
- log .debug ("INITIAL reset count: %d" % initialResetCount )
147
+ log .debug ("FASTREBOOT initialResetCount={}" . format ( initialResetCount ) )
143
148
for i in range (0 , self .number_reboots_to_do ()):
144
149
loopResetCount = self .get_fast_reset_count (c )
145
150
# We do some funny things with the raw pty here, as
146
151
# 'reboot' isn't meant to return
147
152
self .pty = self .cv_SYSTEM .console .get_console ()
148
153
self .pty .sendline (self .reboot_command ())
149
154
self .cv_SYSTEM .set_state (OpSystemState .IPLing )
155
+ log .debug ("FASTREBOOT Expect Buffer ID={}" .format (hex (id (self .pty ))))
156
+ self .cv_SYSTEM .set_state (self .target )
157
+ self .cv_SYSTEM .util .clear_state (self .cv_SYSTEM )
150
158
# We're looking for a skiboot log message, that it's doing fast
151
159
# reboot. We *may* not get this, as on some systems (notably IBM
152
160
# FSP based systems) the skiboot log is *not* printed to IPMI
153
161
# console
154
162
if self .cv_SYSTEM .skiboot_log_on_console ():
163
+ log .debug ("FASTREBOOT looking for RESET: Initiating fast reboot" )
164
+ # timeout is only long enough, if we wait too long the expect
165
+ # buffer will not get the data to keep things moving
155
166
rc = self .pty .expect ([" RESET: Initiating fast reboot" ,
156
167
pexpect .TIMEOUT , pexpect .EOF ],
157
- timeout = 100 )
168
+ timeout = self .timeout )
169
+ log .debug ("FASTREBOOT rc={} (0=We found RESET 1=TIMEOUT 2=EOF)" .format (rc ))
170
+ log .debug ("FASTREBOOT before={}" .format (self .pty .before ))
171
+ log .debug ("FASTREBOOT after={}" .format (self .pty .after ))
158
172
if rc in [1 , 2 ]:
173
+ log .debug ("FASTREBOOT CLOSE Expect Buffer ID={}" .format (hex (id (self .pty ))))
159
174
c .close () # close the console obj
160
175
if self .boot_to_os ():
176
+ log .debug ("FASTREBOOT marker, we're now going to boot to OS" )
177
+ self .cv_SYSTEM .sys_set_bootdev_no_override ()
161
178
self .cv_SYSTEM .goto_state (OpSystemState .OS )
162
179
else :
180
+ log .debug ("FASTREBOOT marker, we're now going to boot to PS" )
181
+ self .cv_SYSTEM .sys_set_bootdev_setup ()
163
182
self .cv_SYSTEM .goto_state (OpSystemState .PETITBOOT_SHELL )
164
183
newResetCount = self .get_fast_reset_count (c )
165
184
self .assertTrue (loopResetCount < newResetCount ,
166
- "Did not do fast reboot" )
185
+ "FASTREBOOT encountered a problem, loopResetCount {} >= newResetCount {}, check the debug logs"
186
+ .format (loopResetCount , newResetCount ))
167
187
self .assertTrue (initialResetCount < newResetCount ,
168
- "Did not do fast reboot" )
169
- log .debug ("Completed Fast reboot cycle %d" % i )
188
+ "FASTREBOOT encountered a problem, initialResetCount {} >= newResetCount {}, check the debug logs"
189
+ .format (initialResetCount , newResetCount ))
190
+ log .debug ("FASTREBOOT completed cycle i={}" .format (i ))
170
191
self .do_things_while_booted ()
171
192
172
193
c .run_command (BMC_CONST .NVRAM_DISABLE_FAST_RESET_MODE )
@@ -182,11 +203,13 @@ def runTest(self):
182
203
183
204
class FastRebootHost (OpTestFastReboot ):
184
205
def boot_to_os (self ):
206
+ self .target = OpSystemState .BOOTING
185
207
return True
186
208
187
209
188
210
class FastRebootHostTorture (FastRebootHost ):
189
211
def boot_to_os (self ):
212
+ self .target = OpSystemState .BOOTING
190
213
return True
191
214
192
215
def number_reboots_to_do (self ):
0 commit comments