Skip to contentSkip to conversation

test/py - test OS boot

U-Boot Michal Simek 2 participants 3 messages Apr 18, 2016 – Apr 29, 2016

lore
Share & tools
lore
#0 lore raw

Hi Stephen and Simon,

have you thought how to use test/py for testing OS boot?
I am not experienced with python to quickly hack it myself but in general I think we should support boot till OS (to test OS handoff, legacy, fit formats, bootm subcommands, go, etc) till certain point and then do reset and if that pattern is found test should pass. I was trying to find out a way how to perform reset command and let test pass.
Is there any way how to do it?

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160418/f38ce5df/attachment.sig>
#1 lore raw
Quoted 10 lines · Michal Simek

Hi Stephen and Simon,

have you thought how to use test/py for testing OS boot?
I am not experienced with python to quickly hack it myself but in general I think we should support boot till OS (to test OS handoff, legacy, fit formats, bootm subcommands, go, etc) till certain point and then do reset and if that pattern is found test should pass. I was trying to find out a way how to perform reset command and let test pass.
Is there any way how to do it?

I think you'd want to do something like the following in the test:

try:
orig_to = u_boot_console.p.timeout
# wait_for_prompt=False makes the core code not wait for the U-Boot # prompt code to be seen, since it won't be on a successful kernel # boot
u_boot_console.run_command('run bootcmd', wait_for_prompt=False) u_boot_console.p.timeout = something_long
# You might want to expand wait_for() with options to add extra bad # patterns which immediately indicate a failed boot, or add a new # "with object" function u_boot_console.enable_check() that can # cause extra patterns like the U-Boot console prompt, U-Boot boot # error messages, kernel boot error messages, etc. to fail the # wait_for().
u_boot_console.wait_for('login:')
finally:
u_boot_console.p.timeout = orig_to
# This forces the console object to be shutdown, so any subsequent # test will reset the board back into U-Boot. We want to force this # no matter whether the kernel boot passed or failed. u_boot_console.drain_console() u_boot_console.cleanup_spawn()

You should probably wrap the timeout manipulation into an automatic object that you can use with a "with" statement, similar to how u_boot_console_base.py's ConsoleDisableCheck class and disable_check() function work. That will isolate the logic a bit.

Perhaps the structure of the above logic could be wrapped into a function/"with object":

# Shorter variable name just for email wrapping
c = u_boot_console
with c.needs_target_restart_afterwards():

     c.run_command('run bootcmd', wait_for_prompt=False)
     with c.temporary_timeout(120):
         u_boot_console.wait_for('login:')
#2 lore raw

Hi Stephen,

2016-04-21 19:43 GMT+02:00 Stephen Warren <[email protected]>:

Quoted 46 lines · Michal Simek
Quoted 12 lines

Hi Stephen and Simon,

have you thought how to use test/py for testing OS boot?
I am not experienced with python to quickly hack it myself but in general I think we should support boot till OS (to test OS handoff, legacy, fit formats, bootm subcommands, go, etc) till certain point and then do reset and if that pattern is found test should pass. I was trying to find out a way how to perform reset command and let test pass.
Is there any way how to do it?

I think you'd want to do something like the following in the test:

try:
orig_to = u_boot_console.p.timeout
# wait_for_prompt=False makes the core code not wait for the U-Boot # prompt code to be seen, since it won't be on a successful kernel # boot
u_boot_console.run_command('run bootcmd', wait_for_prompt=False) u_boot_console.p.timeout = something_long
# You might want to expand wait_for() with options to add extra bad # patterns which immediately indicate a failed boot, or add a new # "with object" function u_boot_console.enable_check() that can # cause extra patterns like the U-Boot console prompt, U-Boot boot # error messages, kernel boot error messages, etc. to fail the # wait_for().
u_boot_console.wait_for('login:')
finally:
u_boot_console.p.timeout = orig_to
# This forces the console object to be shutdown, so any subsequent # test will reset the board back into U-Boot. We want to force this # no matter whether the kernel boot passed or failed. u_boot_console.drain_console() u_boot_console.cleanup_spawn()

You should probably wrap the timeout manipulation into an automatic object that you can use with a "with" statement, similar to how u_boot_console_base.py's ConsoleDisableCheck class and disable_check() function work. That will isolate the logic a bit.

Perhaps the structure of the above logic could be wrapped into a function/"with object":

Quoted 8 lines

# Shorter variable name just for email wrapping
c = u_boot_console
with c.needs_target_restart_afterwards():

    c.run_command('run bootcmd', wait_for_prompt=False)
    with c.temporary_timeout(120):
        u_boot_console.wait_for('login:')

This is working nicely. We should add an option to setup timeout to tftpboot command too
because some images for reading can be quite large.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform