Wednesday, June 13, 2018

Reboot testing script for Linux

In many scenarios, we come up with issue during power cycle or reboot of an embedded devices.
As you know it may not be possible to do multiple power cycle manually, here is a teraterm script 
which can be named as "AutoReboot_string_boot_done.ttl" and loaded as a MACRO in teraterm for linux devices. Go to Control->Macros and load the file.

The content of "AutoReboot_string_boot_done.ttl" is as below :-

; TTL Script used for automatic reboot test

username = 'root'
password = 'root'
usernamePrompt = 'login'
passwordPrompt = 'Password'
oopsPrompt = 'Oops'
panicPrompt = 'Kernel panic'
;mountPrompt = 'BOOT-TIME| PowerModing HMIReady'
mountPrompt = 'U-Boot'
maxLoop = 200000

gettime now '%Y/%m/%d-%H:%M:%S'#13#10
sprintf2 startTime 'AutoReboot started at %s' now

gettime logfile "D:/AutoReboot-test-log-%Y%m%d-%H%M%S.txt"
logopen logfile 0 0 0 0 0 0
logwrite startTime

for i 1 maxLoop
  wait mountPrompt
  if result = 1 then
    pause 40
    sendln
    gettime now '%Y/%m/%d-%H:%M:%S'
    sprintf2 rebootTime 'AutoReboot %d times at %s'#13#10 i now
    dispstr rebootTime
    logwrite rebootTime
    sendln
    sendln 'reboot'
  endif
next

gettime now '%Y/%m/%d-%H:%M:%S'
sprintf2 stopTime 'AutoReboot stopped at %s after %d times reboot'#13#10 now i
logwrite stopTime

logclose

-------------

How do the script work?

The above script issue a reboot command in the console after 40second of  mountPrompt = 'U-Boot'.Which means once U-Boot string comes in console logs the script waits for 40seconds for issuing the reboot command. The script can be customized as much as possible.

No comments:

Post a Comment