travis: Add efi_loader grub2 test
PATCH v2 1/1 travis: Add efi_loader grub2 test
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
---
This patch depends on the previous travis efi_loader enablement
v1 -> v2:
- Fix syntax errors
- Make SMBIOS check conditional (missing cmd on armv7 binary)
--- .travis.yml | 8 ++++++ test/py/tests/test_efi_loader.py | 57 +++++++++++++++++++++++++++++++++------- 2 files changed, 55 insertions(+), 10 deletions(-)
.travis.yml +8 -0
@@ -29,6 +29,9 @@ addons: - gcc-arm-linux-gnueabihf - gcc-aarch64-linux-gnu - iasl + - grub-efi-ia32-bin + - rpm2cpio + - wget install: # install latest device tree compiler
@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + - mkdir ~/grub2-arm + - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di ) env: global:
@@ -88,6 +94,8 @@ script: # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom # value. - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD}; + cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/; + cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi; if [[ "${TEST_PY_BD}" != "" ]]; then ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
test/py/tests/test_efi_loader.py +47 -10
84 lines not on this page · raw message
Signature · 1 line
1.8.5.6
PATCH v2 1/1 travis: Add efi_loader grub2 test
.travis.yml install: · line 53
Quoted 13 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
.travis.yml +3
-0@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + - mkdir ~/grub2-arm + - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )
Do we really want to do this for all the build-only jobs too? I might have expected to do this inside the test scripts that actually use those binaries.
Quoted 10 lines
test/py/tests/test_efi_loader.py +7
-0+ at pytest.mark.buildconfigspec('cmd_bootefi') + u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False) + + # Verify that we have an SMBIOS table + check_smbios = u_boot_console.config.env.get('env__efi_loader_check_smbios', False) + if check_smbios: + u_boot_console.wait_for('grub>')
test/py/tests/test_efi_loader.py def test_efi_helloworld_builtin(u_boot_console): · line 195
Quoted 10 lines
test/py/tests/test_efi_loader.py +10
-0+ output = u_boot_console.run_command('lsefisystab', wait_for_prompt=False, wait_for_echo=False) + u_boot_console.wait_for('SMBIOS') + + # Then exit cleanly + u_boot_console.wait_for('grub>') + output = u_boot_console.run_command('exit', wait_for_prompt=False, wait_for_echo=False) + u_boot_console.wait_for('r = 0') + + # And give us our U-Boot prompt back + u_boot_console.run_command('')
I can't help wondering if adding push_prompt() function (for use in a Python "with" statement) to u_boot_console wouldn't be better; that would avoid all the wait_for_prompt=False and wait_for(prompt) logic there.
PATCH v2 1/1 travis: Add efi_loader grub2 test
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
.travis.yml +0
-0
Quoted 11 lines
.travis.yml install: · line 53
Quoted 7 lines
.travis.yml +3
-0@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + - mkdir ~/grub2-arm + - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )Do we really want to do this for all the build-only jobs too? I might have expected to do this inside the test scripts that actually use those binaries.
So, it's the difference between making various jobs / stanzas more correct vs taking more time to do stuff. Unless this starts to push the "catch-all" arm job over the time limit, I don't think it's a big deal either way. And since travis-ci will tell us how long a given stanza takes we'll have a good idea pretty quick on if that's starting to take too long. That said, I don't have a strong opinion here and it wouldn't be too hard to move all of this into being under the TEST_PY_BD check and since we aren't relying on apt, it's not going to be time-in-apt factor.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161121/ac79e439/attachment.sig>
PATCH v2 1/1 travis: Add efi_loader grub2 test
Quoted 20 lines · Tom Rini
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
.travis.yml +0
-0Quoted 11 lines
.travis.yml install: · line 53
Quoted 7 lines
.travis.yml +3
-0@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + - mkdir ~/grub2-arm + - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )Do we really want to do this for all the build-only jobs too? I might have expected to do this inside the test scripts that actually use those binaries.
Quoted 9 lines
So, it's the difference between making various jobs / stanzas more correct vs taking more time to do stuff. Unless this starts to push the "catch-all" arm job over the time limit, I don't think it's a big deal either way. And since travis-ci will tell us how long a given stanza takes we'll have a good idea pretty quick on if that's starting to take too long. That said, I don't have a strong opinion here and it wouldn't be too hard to move all of this into being under the
TEST_PY_BDcheck and since we aren't relying on apt, it's not going to be time-in-apt factor.
If we move it into TEST_PY_BD, we would either run the same sequence over and over again for individual tests or check if the file exists inside the generation path. Either way, it will get less readable :).
Overall, we're talking of 1s of build time for this:
https://travis-ci.org/agraf/u-boot/jobs/177000864
so I'd definitely prefer to keep it simple rather than optimized.
Alex
PATCH v2 1/1 travis: Add efi_loader grub2 test
Quoted 36 lines · Alexander Graf
Quoted 23 lines · Tom Rini
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
.travis.yml +0
-0Quoted 14 lines
Quoted 10 lines
.travis.yml +1
-0@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echolsefimmap lsefi lsefisystab efinet tftp minicmd
+ - mkdir ~/grub2-arm
+ - ( cd ~/grub2-arm; wget -O -
http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm
| rpm2cpio | cpio -di )Do we really want to do this for all the build-only jobs too? I might have expected to do this inside the test scripts that actually use those binaries.
Quoted 9 lines
So, it's the difference between making various jobs / stanzas more correct vs taking more time to do stuff. Unless this starts to push the "catch-all" arm job over the time limit, I don't think it's a big deal either way. And since travis-ci will tell us how long a given stanza takes we'll have a good idea pretty quick on if that's starting to take too long. That said, I don't have a strong opinion here and it wouldn't be too hard to move all of this into being under the
TEST_PY_BDcheck and since we aren't relying on apt, it's not going to be time-in-apt factor.
Quoted 3 lines
If we move it into
TEST_PY_BD, we would either run the same sequence over and over again for individual tests or check if the file exists inside the generation path. Either way, it will get less readable :).
I believe each test job configures a new container, so no, the change I suggested would mean a given job would either:
a) Run a build without downloading the test EFI RPM.
b) Run a test and download the EFI RPM once.
It seems trivial to just put this in the right place, although admittedly if it's quick it's not going to save much, except that it will make all the compile-only tests not depend on so many potentially-intermittent network accesses.
Quoted 5 lines
Overall, we're talking of 1s of build time for this:
https://travis-ci.org/agraf/u-boot/jobs/177000864
so I'd definitely prefer to keep it simple rather than optimized.
PATCH v2 1/1 travis: Add efi_loader grub2 test
In reply to Stephen WarrenQuoted 43 lines · Stephen Warren
Quoted 11 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
.travis.yml +1
-0@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmapQuoted 5 lines
lsefi lsefisystab efinet tftp minicmd
+ - mkdir ~/grub2-arm
+ - ( cd ~/grub2-arm; wget -O -
http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm
| rpm2cpio | cpio -di )Do we really want to do this for all the build-only jobs too? I might have expected to do this inside the test scripts that actually use those binaries.
Quoted 21 lines
test/py/tests/test_efi_loader.py +2
-0+ at pytest.mark.buildconfigspec('cmd_bootefi') + u_boot_console.run_command('bootefi %x' % addr,wait_for_prompt=False)
test/py/tests/test_efi_loader.py +3
-0+ + # Verify that we have an SMBIOS table + check_smbios =
u_boot_console.config.env.get('env__efi_loader_check_smbios', False)test/py/tests/test_efi_loader.py +3
-0+ if check_smbios: + u_boot_console.wait_for('grub>') + output = u_boot_console.run_command('lsefisystab',wait_for_prompt=False, wait_for_echo=False)
test/py/tests/test_efi_loader.py +5
-0+ u_boot_console.wait_for('SMBIOS') + + # Then exit cleanly + u_boot_console.wait_for('grub>') + output = u_boot_console.run_command('exit',wait_for_prompt=False, wait_for_echo=False)
Quoted 8 lines
test/py/tests/test_efi_loader.py def test_efi_helloworld_builtin(u_boot_console): · line 195
Quoted 4 lines
test/py/tests/test_efi_loader.py +4
-0+ u_boot_console.wait_for('r = 0') + + # And give us our U-Boot prompt back + u_boot_console.run_command('')I can't help wondering if adding
push_prompt()function (for use in a Python "with" statement) tou_boot_consolewouldn't be better; that would avoid all the wait_for_prompt=False andwait_for(prompt)logic there.
What would that function do? The same?
JFYI, I've added the html log output for the sequence above at the end of the email.
Alex
tftpboot 80400000 grub_arm.efi
smc911x: MAC 52:54:00:12:34:56
smc911x: detected LAN9118 controller
smc911x: phy initialized
smc911x: MAC 52:54:00:12:34:56
Using smc911x-0 device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15 Filename 'grub_arm.efi'.
Load address: 0x80400000
Loading:
*%08#################################################################
#################################################################
##############
14.3 MiB/sdone
Bytes transferred = 732672 (b2e00 hex)
smc911x: MAC 52:54:00:12:34:56
=> crc32 80400000 $filesize
CRC32 for 80400000 ... 804b2dff ==> 4afa7ec6
=> bootefi 80400000
## Starting EFI application at 80400000 ...
WARNING: Invalid device tree, expect boot to fail
Scanning disks on mmc...
Card did not respond to voltage select!
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Found 0 disks
%1b[?25hWelcome to GRUB!
smc911x: detected LAN9118 controller
smc911x: phy initialized
smc911x: MAC 52:54:00:12:34:56
smc911x: detected LAN9118 controller
smc911x: phy initialized
smc911x: MAC 52:54:00:12:34:56 %1b[2J%1b[18t%1b[1;26fGNU GRUB version 2.02~beta2
%1b[?25h Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists possible device or file completions.
grub> %1b[9;6fe%1b[9;7f%1b[9;7fx%1b[9;8f%1b[9;8fi%1b[9;9f%1b[9;9ft%1b[9;10f ## Application terminated, r = 0
PATCH v2 1/1 travis: Add efi_loader grub2 test
Quoted 57 lines · Alexander Graf
Quoted 45 lines · Stephen Warren
Quoted 16 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
.travis.yml +1
-0@@ -45,6 +48,9 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmaplsefi lsefisystab efinet tftp minicmd
+ - mkdir ~/grub2-arm
+ - ( cd ~/grub2-arm; wget -O -
http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpmQuoted 1 line
| rpm2cpio | cpio -di )
Do we really want to do this for all the build-only jobs too? I might have expected to do this inside the test scripts that actually use those binaries.
Quoted 22 lines
test/py/tests/test_efi_loader.py +2
-0+ at pytest.mark.buildconfigspec('cmd_bootefi') + u_boot_console.run_command('bootefi %x' % addr,wait_for_prompt=False)
test/py/tests/test_efi_loader.py +3
-0+ + # Verify that we have an SMBIOS table + check_smbios =
u_boot_console.config.env.get('env__efi_loader_check_smbios', False)test/py/tests/test_efi_loader.py +3
-0+ if check_smbios: + u_boot_console.wait_for('grub>') + output = u_boot_console.run_command('lsefisystab',wait_for_prompt=False, wait_for_echo=False)
test/py/tests/test_efi_loader.py +5
-0+ u_boot_console.wait_for('SMBIOS') + + # Then exit cleanly + u_boot_console.wait_for('grub>') + output = u_boot_console.run_command('exit',wait_for_prompt=False, wait_for_echo=False)
+u_boot_console.wait_for('r = 0')Quoted 8 lines
test/py/tests/test_efi_loader.py def test_efi_helloworld_builtin(u_boot_console): · line 195
Quoted 3 lines
test/py/tests/test_efi_loader.py +3
-0+ + # And give us our U-Boot prompt back + u_boot_console.run_command('')I can't help wondering if adding
push_prompt()function (for use in a Python "with" statement) tou_boot_consolewouldn't be better; that would avoid all the wait_for_prompt=False andwait_for(prompt)logic there.
Quoted 1 line
What would that function do? The same?
The internal implementation would likely look the same, but it would avoid needing to implement/replicate such low-level prompt-parsing details in each test that invokes "sub-commands" with different prompts.
PATCH v2 1/1 travis: Add efi_loader grub2 test
In reply to Alexander GrafQuoted 5 lines · Alexander Graf
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up.
Signed-off-by Alexander Graf <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161127/f865d8eb/attachment.sig>