Re: [U-Boot] sandbox does not complete efi_selftest

Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests ./test/run +make O=build-sandbox -s sandbox_defconfig +make O=build-sandbox -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 326 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py .. test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py FF INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 98, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 133, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 154, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute INTERNALERROR> return _wrapped_call(hook_impl.function(*args), self.execute) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call INTERNALERROR> return call_outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__ INTERNALERROR> self.result = func() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "test/py/conftest.py", line 577, in pytest_runtest_protocol INTERNALERROR> console.drain_console() INTERNALERROR> File "test/py/u_boot_console_base.py", line 306, in drain_console INTERNALERROR> self.p.expect(['This should never match U-Boot output']) INTERNALERROR> File "test/py/u_boot_spawn.py", line 174, in expect INTERNALERROR> c = os.read(self.fd, 1024) INTERNALERROR> OSError: [Errno 5] Input/output error
=============== 2 failed, 4 passed, 11 skipped in 17.08 seconds ================ +make O=build-sandbox_spl -s sandbox_spl_defconfig +make O=build-sandbox_spl -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 320 items
test/py/tests/test_ofplatdata.py .
============================= 319 tests deselected ============================= =================== 1 passed, 319 deselected in 0.21 seconds =================== +make O=build-sandbox_flattree -s sandbox_flattree_defconfig +make O=build-sandbox_flattree -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 321 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py ss test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py sss test/py/tests/test_env.py ............ test/py/tests/test_fit.py s test/py/tests/test_fpga.py sssssssssssssssssssssssssss test/py/tests/test_gpt.py sssssss test/py/tests/test_help.py . test/py/tests/test_hush_if_test.py ......................................................s test/py/tests/test_log.py .. test/py/tests/test_md.py .. test/py/tests/test_mmc_rd.py s test/py/tests/test_net.py .sssss test/py/tests/test_ofplatdata.py s test/py/tests/test_sandbox_exit.py ss test/py/tests/test_sf.py ssss test/py/tests/test_shell_basics.py .... test/py/tests/test_sleep.py . test/py/tests/test_tpm2.py ........... test/py/tests/test_ums.py s test/py/tests/test_unknown_cmd.py . test/py/tests/test_ut.py ................................................................................................................................................................... test/py/tests/test_vboot.py s
==================== 254 passed, 67 skipped in 9.23 seconds ==================== <unittest.result.TestResult run=110 errors=0 failures=0> <unittest.result.TestResult run=12 errors=0 failures=0> Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/ <unittest.result.TestResult run=35 errors=0 failures=1> Traceback (most recent call last): File "tools/buildman/test.py", line 426, in testToolchainDownload self.toolchains.LocateArchUrl('arm')) AssertionError: 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc...' != 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc...'
/tmp/binman.ddKM14/source.dtb: Warning (clocks_property): /phandle-source:clocks: Could not get phandle node for (cell 0) /tmp/binman.ddKM14/source.dtb: Warning (clocks_property): /phandle-source2: Missing property '#clock-cells' in node /phandle-target or bad phandle (referred from clocks[0]) <unittest.result.TestResult run=22 errors=0 failures=0> <unittest.result.TestResult run=110 errors=0 failures=0> 100% /tmp/binman.Z_3MuD/source.dtb: Warning (clocks_property): /phandle-source:clocks: Could not get phandle node for (cell 0) /tmp/binman.Z_3MuD/source.dtb: Warning (clocks_property): /phandle-source2: Missing property '#clock-cells' in node /phandle-target or bad phandle (referred from clocks[0]) <unittest.result.TestResult run=22 errors=0 failures=0> 100% <unittest.result.TestResult run=31 errors=0 failures=0> 100% Tests FAILED Makefile:1711: recipe for target 'tests' failed make: *** [tests] Error 1
When I run
$ sandbox/u-boot -D -c "bootefi selftest"
I get at the end the network timeout failure:
Setting up 'simple network protocol' Failed to open socket: 1 Operation not permitted Failed to open socket: 1 Operation not permitted Failed to open socket: 1 Operation not permitted Setting up 'simple network protocol' succeeded
Executing 'simple network protocol' DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover lib/efi_selftest/efi_selftest_snp.c(311): ERROR: Timeout occurred lib/efi_selftest/efi_selftest.c(109): ERROR: Executing 'simple network protocol' failed
Tearing down 'simple network protocol' Tearing down 'simple network protocol' succeeded
and then at the end:
Summary: 1 failures
Preparing for reset. Press any key... resetting ...
Here it hangs waiting for a key.
Also can I suggest removing some of the output when it runs the tests? For example, this seems like boilerplate to me:
Setting up 'event services' Setting up 'event services' succeeded
Executing 'event services' Executing 'event services' succeeded
Regards, Simon

On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests
with agraf/efi-next rebased on master it does not even compile:
make tests V=1
/usr/bin/ld: test/overlay/built-in.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
Regards
Heinrich
./test/run +make O=build-sandbox -s sandbox_defconfig +make O=build-sandbox -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 326 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py .. test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py FF INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 98, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 133, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 154, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute INTERNALERROR> return _wrapped_call(hook_impl.function(*args), self.execute) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call INTERNALERROR> return call_outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__ INTERNALERROR> self.result = func() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "test/py/conftest.py", line 577, in pytest_runtest_protocol INTERNALERROR> console.drain_console() INTERNALERROR> File "test/py/u_boot_console_base.py", line 306, in drain_console INTERNALERROR> self.p.expect(['This should never match U-Boot output']) INTERNALERROR> File "test/py/u_boot_spawn.py", line 174, in expect INTERNALERROR> c = os.read(self.fd, 1024) INTERNALERROR> OSError: [Errno 5] Input/output error
=============== 2 failed, 4 passed, 11 skipped in 17.08 seconds ================ +make O=build-sandbox_spl -s sandbox_spl_defconfig +make O=build-sandbox_spl -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 320 items
test/py/tests/test_ofplatdata.py .
============================= 319 tests deselected ============================= =================== 1 passed, 319 deselected in 0.21 seconds =================== +make O=build-sandbox_flattree -s sandbox_flattree_defconfig +make O=build-sandbox_flattree -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 321 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py ss test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py sss test/py/tests/test_env.py ............ test/py/tests/test_fit.py s test/py/tests/test_fpga.py sssssssssssssssssssssssssss test/py/tests/test_gpt.py sssssss test/py/tests/test_help.py . test/py/tests/test_hush_if_test.py ......................................................s test/py/tests/test_log.py .. test/py/tests/test_md.py .. test/py/tests/test_mmc_rd.py s test/py/tests/test_net.py .sssss test/py/tests/test_ofplatdata.py s test/py/tests/test_sandbox_exit.py ss test/py/tests/test_sf.py ssss test/py/tests/test_shell_basics.py .... test/py/tests/test_sleep.py . test/py/tests/test_tpm2.py ........... test/py/tests/test_ums.py s test/py/tests/test_unknown_cmd.py . test/py/tests/test_ut.py ................................................................................................................................................................... test/py/tests/test_vboot.py s
==================== 254 passed, 67 skipped in 9.23 seconds ==================== <unittest.result.TestResult run=110 errors=0 failures=0> <unittest.result.TestResult run=12 errors=0 failures=0> Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/ <unittest.result.TestResult run=35 errors=0 failures=1> Traceback (most recent call last): File "tools/buildman/test.py", line 426, in testToolchainDownload self.toolchains.LocateArchUrl('arm')) AssertionError: 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc...' != 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc...'
/tmp/binman.ddKM14/source.dtb: Warning (clocks_property): /phandle-source:clocks: Could not get phandle node for (cell 0) /tmp/binman.ddKM14/source.dtb: Warning (clocks_property): /phandle-source2: Missing property '#clock-cells' in node /phandle-target or bad phandle (referred from clocks[0]) <unittest.result.TestResult run=22 errors=0 failures=0> <unittest.result.TestResult run=110 errors=0 failures=0> 100% /tmp/binman.Z_3MuD/source.dtb: Warning (clocks_property): /phandle-source:clocks: Could not get phandle node for (cell 0) /tmp/binman.Z_3MuD/source.dtb: Warning (clocks_property): /phandle-source2: Missing property '#clock-cells' in node /phandle-target or bad phandle (referred from clocks[0]) <unittest.result.TestResult run=22 errors=0 failures=0> 100% <unittest.result.TestResult run=31 errors=0 failures=0> 100% Tests FAILED Makefile:1711: recipe for target 'tests' failed make: *** [tests] Error 1
When I run
$ sandbox/u-boot -D -c "bootefi selftest"
efi-next rebased on u-boot master does not compile:
I get at the end the network timeout failure:
Setting up 'simple network protocol' Failed to open socket: 1 Operation not permitted Failed to open socket: 1 Operation not permitted Failed to open socket: 1 Operation not permitted Setting up 'simple network protocol' succeeded
Executing 'simple network protocol' DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover lib/efi_selftest/efi_selftest_snp.c(311): ERROR: Timeout occurred lib/efi_selftest/efi_selftest.c(109): ERROR: Executing 'simple network protocol' failed
Tearing down 'simple network protocol' Tearing down 'simple network protocol' succeeded
and then at the end:
Summary: 1 failures
Preparing for reset. Press any key... resetting ...
Here it hangs waiting for a key.
Also can I suggest removing some of the output when it runs the tests? For example, this seems like boilerplate to me:
Setting up 'event services' Setting up 'event services' succeeded
Executing 'event services' Executing 'event services' succeeded
Regards, Simon

On 09/17/2018 07:42 PM, Heinrich Schuchardt wrote:
On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests
with agraf/efi-next rebased on master it does not even compile:
make tests V=1
/usr/bin/ld: test/overlay/built-in.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
This patch is missing in efi-next: https://patchwork.ozlabs.org/patch/965315/
Regards
Heinrich

In efi_next the command
./u-boot -v -d selfconfig.dtb
leads to a segmentation fault for sandbox_defconfig.
The command is executed by ConsoleSandbox.get_spawn().
We cannot expect 'make tests' to succeed until this is fixed.
Valgrind indicates where the segmentation fault occurs:
==13906== Invalid read of size 4 ==13906== at 0x14C4D7: find_id (bootstage.c:72) ==13906== by 0x14C564: bootstage_add_record (bootstage.c:106) ==13906== by 0x1C45FA: hang (hang.c:27) ==13906== by 0x144359: board_init_f (board_f.c:901) ==13906== by 0x127556: main (start.c:319) ==13906== Address 0x0 is not stack'd, malloc'd or (recently) free'd
Best regards
Heinrich

On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests ./test/run +make O=build-sandbox -s sandbox_defconfig +make O=build-sandbox -s -j8
With you git repository this fails with
<unittest.result.TestResult run=110 errors=0 failures=0> <unittest.result.TestResult run=12 errors=0 failures=0> Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/ <unittest.result.TestResult run=35 errors=0 failures=1> Traceback (most recent call last): File "/home/zfsdt/temp/u-boot-dm/tools/buildman/test.py", line 426, in testToolchainDownload self.toolchains.LocateArchUrl('arm')) AssertionError: 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc...' != 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc...'
Please, provide a reproducable way to show you problem.
Best regards
Heinrich

On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests ./test/run +make O=build-sandbox -s sandbox_defconfig +make O=build-sandbox -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 326 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py .. test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py FF INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 98, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 133, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 154, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute INTERNALERROR> return _wrapped_call(hook_impl.function(*args), self.execute) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call INTERNALERROR> return call_outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__ INTERNALERROR> self.result = func() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "test/py/conftest.py", line 577, in pytest_runtest_protocol INTERNALERROR> console.drain_console() INTERNALERROR> File "test/py/u_boot_console_base.py", line 306, in drain_console INTERNALERROR> self.p.expect(['This should never match U-Boot output']) INTERNALERROR> File "test/py/u_boot_spawn.py", line 174, in expect INTERNALERROR> c = os.read(self.fd, 1024) INTERNALERROR> OSError: [Errno 5] Input/output error
With https://patchwork.ozlabs.org/patch/965315/ we can see where the problem occurs. The ConsoleSandbox seems to hang on the detection of the console size (172*42 is the size of my console). This problem does not occur when running the same interactively.
$ rm build-sandbox -rf && make tests ./test/run +make O=/home/zfsdt/workspace/u-boot-build/denx/build-sandbox -s sandbox_defconfig +make O=/home/zfsdt/workspace/u-boot-build/denx/build-sandbox -s -j8 =========================================================================== test session starts ============================================================================ platform linux2 -- Python 2.7.15+, pytest-3.6.4, py-1.6.0, pluggy-0.6.0 rootdir: /home/zfsdt/workspace/u-boot-build/denx/test/py, inifile: pytest.ini collected 411 items
test/py/tests/test_000_version.py .
[ 0%] test/py/tests/test_avb.py sssss
[ 0%] test/py/tests/test_bind.py ..
[ 0%] test/py/tests/test_dfu.py s
[ 0%] test/py/tests/test_efi_loader.py .sssss
[ 0%] test/py/tests/test_efi_selftest.py FFFFF
[ 0%] test/py/tests/test_env.py ............
[ 0%] test/py/tests/test_fit.py F
[ 0%] test/py/tests/test_fpga.py sssssssssssssssssssssssssss
[ 0%] test/py/tests/test_gpt.py sssssss
[ 0%] test/py/tests/test_help.py .
[ 0%] test/py/tests/test_hush_if_test.py ....................................................... [ 0%] test/py/tests/test_log.py ..
[ 0%] test/py/tests/test_md.py ..
[ 0%] test/py/tests/test_mmc_rd.py s
[ 0%] test/py/tests/test_net.py .sssss
[ 0%] test/py/tests/test_ofplatdata.py s
[ 0%] test/py/tests/test_sandbox_exit.py ..
[ 0%] test/py/tests/test_sf.py ssss
[ 0%] test/py/tests/test_shell_basics.py ....
[ 0%] test/py/tests/test_sleep.py .
[ 0%] test/py/tests/test_tpm2.py ...........
[ 0%] test/py/tests/test_ums.py s
[ 0%] test/py/tests/test_unknown_cmd.py .
[ 0%] test/py/tests/test_ut.py ........................................................................................................................................................................ [ 0%] test/py/tests/test_vboot.py F
[ 0%] test/py/tests/test_fs/test_basic.py sssssssssssssssssssssssssssssssssssssss [ 0%] test/py/tests/test_fs/test_ext.py ssssssssssssssssss
[ 0%] test/py/tests/test_fs/test_mkdir.py ssssssssssss
[ 0%] test/py/tests/test_fs/test_unlink.py ssssssssssssss
================================================================================= FAILURES ================================================================================= ____________________________________________________________________________ test_efi_selftest _____________________________________________________________________________
u_boot_console = <u_boot_console_sandbox.ConsoleSandbox object at 0x7fb1b5ef50d0>
@pytest.mark.buildconfigspec('cmd_bootefi_selftest') def test_efi_selftest(u_boot_console): """ Run bootefi selftest """
u_boot_console.run_command(cmd='setenv efi_selftest') u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key']) if m != 0:
raise Exception('Failures occurred during the EFI selftest')
E Exception: Failures occurred during the EFI selftest
test/py/tests/test_efi_selftest.py:19: Exception --------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------- => setenv efi_selftest => => bootefi selftest Scanning disk mmc2.blk... ^[[42;172R______________________________________________________________________ test_efi_selftest_device_tree _______________________________________________________________________
u_boot_console = <u_boot_console_sandbox.ConsoleSandbox object at 0x7fb1b5ef50d0>
@pytest.mark.buildconfigspec('cmd_bootefi_selftest') @pytest.mark.buildconfigspec('of_control') def test_efi_selftest_device_tree(u_boot_console): u_boot_console.run_command(cmd='setenv efi_selftest list')
output = u_boot_console.run_command('bootefi selftest')
test/py/tests/test_efi_selftest.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <u_boot_console_sandbox.ConsoleSandbox object at 0x7fb1b5ef50d0>, cmd = '', wait_for_echo = True, send_nl = True, wait_for_prompt = True
def run_command(self, cmd, wait_for_echo=True, send_nl=True, wait_for_prompt=True): """Execute a command via the U-Boot console.
The command is always sent to U-Boot.
U-Boot echoes any command back to its output, and this function typically waits for that to occur. The wait can be disabled by setting wait_for_echo=False, which is useful e.g. when sending CTRL-C to interrupt a long-running command such as "ums".
Command execution is typically triggered by sending a newline character. This can be disabled by setting send_nl=False, which is also useful when sending CTRL-C.
This function typically waits for the command to finish executing, and returns the console output that it generated. This can be disabled by setting wait_for_prompt=False, which is useful when invoking a long- running command such as "ums".
Args: cmd: The command to send. wait_for_echo: Boolean indicating whether to wait for U-Boot to echo the command text back to its output. send_nl: Boolean indicating whether to send a newline character after the command string. wait_for_prompt: Boolean indicating whether to wait for the command prompt to be sent by U-Boot. This typically occurs immediately after the command has been executed.
Returns: If wait_for_prompt == False: Nothing. Else: The output from U-Boot during command execution. In other words, the text U-Boot emitted between the point it echod the command string and emitted the subsequent command prompts. """
if self.at_prompt and \ self.at_prompt_logevt != self.logstream.logfile.cur_evt: self.logstream.write(self.prompt, implicit=True)
try: self.at_prompt = False if send_nl: cmd += '\n' while cmd: # Limit max outstanding data, so UART FIFOs don't overflow chunk = cmd[:self.max_fifo_fill] cmd = cmd[self.max_fifo_fill:] self.p.send(chunk) if not wait_for_echo: continue chunk = re.escape(chunk) chunk = chunk.replace('\\n', '[\r\n]') m = self.p.expect([chunk] + self.bad_patterns) if m != 0: self.at_prompt = False raise Exception('Bad pattern found on console: ' + self.bad_pattern_ids[m - 1]) if not wait_for_prompt: return m = self.p.expect([self.prompt_compiled] + self.bad_patterns) if m != 0: self.at_prompt = False raise Exception('Bad pattern found on console: ' +
self.bad_pattern_ids[m - 1])
E TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
test/py/u_boot_console_base.py:207: TypeError -------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------- /u-boot
U-Boot 2018.09-00267-gfa2a852294-dirty (Sep 18 2018 - 00:13:30 +0200)
Model: sandbox DRAM: 128 MiB MMC: mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD) In: serial Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: eth@10002000, eth5: eth@10003000, eth3: sbe5, eth1: eth@10004000 Hit any key to stop autoboot: 0 => --------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------- => setenv efi_selftest list => => bootefi selftest Scanning disk mmc2.blk... ^[[42;172R____________________________________________________________________ test_efi_selftest_watchdog_reboot _____________________________________________________________________
u_boot_console = <u_boot_console_sandbox.ConsoleSandbox object at 0x7fb1b5ef50d0>
@pytest.mark.buildconfigspec('cmd_bootefi_selftest') def test_efi_selftest_watchdog_reboot(u_boot_console): u_boot_console.run_command(cmd='setenv efi_selftest list')
output = u_boot_console.run_command('bootefi selftest')
test/py/tests/test_efi_selftest.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <u_boot_console_sandbox.ConsoleSandbox object at 0x7fb1b5ef50d0>, cmd = '', wait_for_echo = True, send_nl = True, wait_for_prompt = True
def run_command(self, cmd, wait_for_echo=True, send_nl=True, wait_for_prompt=True): """Execute a command via the U-Boot console.
The command is always sent to U-Boot.
U-Boot echoes any command back to its output, and this function typically waits for that to occur. The wait can be disabled by setting wait_for_echo=False, which is useful e.g. when sending CTRL-C to interrupt a long-running command such as "ums".
Command execution is typically triggered by sending a newline character. This can be disabled by setting send_nl=False, which is also useful when sending CTRL-C.
This function typically waits for the command to finish executing, and returns the console output that it generated. This can be disabled by setting wait_for_prompt=False, which is useful when invoking a long- running command such as "ums".
Args: cmd: The command to send. wait_for_echo: Boolean indicating whether to wait for U-Boot to echo the command text back to its output. send_nl: Boolean indicating whether to send a newline character after the command string. wait_for_prompt: Boolean indicating whether to wait for the command prompt to be sent by U-Boot. This typically occurs immediately after the command has been executed.
Returns: If wait_for_prompt == False: Nothing. Else: The output from U-Boot during command execution. In other words, the text U-Boot emitted between the point it echod the command string and emitted the subsequent command prompts. """
if self.at_prompt and \ self.at_prompt_logevt != self.logstream.logfile.cur_evt: self.logstream.write(self.prompt, implicit=True)
try: self.at_prompt = False if send_nl: cmd += '\n' while cmd: # Limit max outstanding data, so UART FIFOs don't overflow chunk = cmd[:self.max_fifo_fill] cmd = cmd[self.max_fifo_fill:] self.p.send(chunk) if not wait_for_echo: continue chunk = re.escape(chunk) chunk = chunk.replace('\\n', '[\r\n]') m = self.p.expect([chunk] + self.bad_patterns) if m != 0: self.at_prompt = False raise Exception('Bad pattern found on console: ' + self.bad_pattern_ids[m - 1]) if not wait_for_prompt: return m = self.p.expect([self.prompt_compiled] + self.bad_patterns) if m != 0: self.at_prompt = False raise Exception('Bad pattern found on console: ' +
self.bad_pattern_ids[m - 1])
E TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
test/py/u_boot_console_base.py:207: TypeError -------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------- /u-boot
U-Boot 2018.09-00267-gfa2a852294-dirty (Sep 18 2018 - 00:13:30 +0200)
Model: sandbox DRAM: 128 MiB MMC: mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD) In: serial Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: eth@10002000, eth5: eth@10003000, eth3: sbe5, eth1: eth@10004000 Hit any key to stop autoboot: 0 => --------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------- => setenv efi_selftest list => => bootefi selftest Scanning disk mmc2.blk... ^[[42;172R_______________________________________________________________________
Best regards
Heinrich Schuchardt

On 17.09.18 15:44, Heinrich Schuchardt wrote:
On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests ./test/run +make O=build-sandbox -s sandbox_defconfig +make O=build-sandbox -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 326 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py .. test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py FF INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 98, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 133, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 154, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute INTERNALERROR> return _wrapped_call(hook_impl.function(*args), self.execute) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call INTERNALERROR> return call_outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__ INTERNALERROR> self.result = func() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "test/py/conftest.py", line 577, in pytest_runtest_protocol INTERNALERROR> console.drain_console() INTERNALERROR> File "test/py/u_boot_console_base.py", line 306, in drain_console INTERNALERROR> self.p.expect(['This should never match U-Boot output']) INTERNALERROR> File "test/py/u_boot_spawn.py", line 174, in expect INTERNALERROR> c = os.read(self.fd, 1024) INTERNALERROR> OSError: [Errno 5] Input/output error
With https://patchwork.ozlabs.org/patch/965315/ we can see where the problem occurs. The ConsoleSandbox seems to hang on the detection of the console size (172*42 is the size of my console). This problem does not occur when running the same interactively.
I don't understand this. When I run u-boot with </dev/null it successfully times out and proceeds.
Alex

On 09/19/2018 01:12 AM, Alexander Graf wrote:
On 17.09.18 15:44, Heinrich Schuchardt wrote:
On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
On 15 September 2018 at 22:02, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in the chat with Alex you indicated that you see a problem with efi_selftest expecting an input before resetting the board.
I do not understand why this should be a problem with sandbox. There never was a problem with the Python tests for any other board.
Could you, please, detail where the issue is and how it can be reproduced.
Using u-boot-dm/ef-working I see this:
$ make tests ./test/run +make O=build-sandbox -s sandbox_defconfig +make O=build-sandbox -s -j8 ============================= test session starts ============================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.34, pluggy-0.4.0 rootdir: test/py, inifile: pytest.ini collected 326 items
test/py/tests/test_000_version.py . test/py/tests/test_avb.py sssss test/py/tests/test_bind.py .. test/py/tests/test_dfu.py s test/py/tests/test_efi_loader.py .sssss test/py/tests/test_efi_selftest.py FF INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 98, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 133, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 154, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute INTERNALERROR> return _wrapped_call(hook_impl.function(*args), self.execute) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call INTERNALERROR> return call_outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__ INTERNALERROR> self.result = func() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "test/py/conftest.py", line 577, in pytest_runtest_protocol INTERNALERROR> console.drain_console() INTERNALERROR> File "test/py/u_boot_console_base.py", line 306, in drain_console INTERNALERROR> self.p.expect(['This should never match U-Boot output']) INTERNALERROR> File "test/py/u_boot_spawn.py", line 174, in expect INTERNALERROR> c = os.read(self.fd, 1024) INTERNALERROR> OSError: [Errno 5] Input/output error
With https://patchwork.ozlabs.org/patch/965315/ we can see where the problem occurs. The ConsoleSandbox seems to hang on the detection of the console size (172*42 is the size of my console). This problem does not occur when running the same interactively.
I don't understand this. When I run u-boot with </dev/null it successfully times out and proceeds.
Alex
$ make mrproper && make sandbox_defconfig && make $ ./u-boot -v -d u-boot.dtb -c 'bootefi selftest'
leads to a segmentation fault. See output below.
This is the segmentation fault that leads to OSError when running 'make tests'.
Best regards
Heinrich Schuchardt
U-Boot 2018.09-00269-ga2b22dffcb (Sep 19 2018 - 02:47:16 +0200)
Model: sandbox DRAM: 128 MiB
Warning: host_lo MAC addresses don't match: Address in ROM is f2:1a:c7:df:78:d4 Address in environment is 00:00:11:22:33:44
Warning: host_enp2s0 MAC addresses don't match: Address in ROM is f2:1a:c7:df:78:d4 Address in environment is 00:00:11:22:33:45
Warning: host_wlp4s0 using MAC address from ROM MMC: In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp2s0, eth2: host_wlp4s0, eth3: eth@10002000 Found 0 disks Segmentation fault

On 18.09.18 17:52, Heinrich Schuchardt wrote:
On 09/19/2018 01:12 AM, Alexander Graf wrote:
On 17.09.18 15:44, Heinrich Schuchardt wrote:
On 09/16/2018 07:45 AM, Simon Glass wrote:
Hi Heinrich,
With https://patchwork.ozlabs.org/patch/965315/ we can see where the problem occurs. The ConsoleSandbox seems to hang on the detection of the console size (172*42 is the size of my console). This problem does not occur when running the same interactively.
I don't understand this. When I run u-boot with </dev/null it successfully times out and proceeds.
Alex
$ make mrproper && make sandbox_defconfig && make $ ./u-boot -v -d u-boot.dtb -c 'bootefi selftest'
leads to a segmentation fault. See output below.
This is the segmentation fault that leads to OSError when running 'make tests'.
Best regards
Heinrich Schuchardt
U-Boot 2018.09-00269-ga2b22dffcb (Sep 19 2018 - 02:47:16 +0200)
Model: sandbox DRAM: 128 MiB
Warning: host_lo MAC addresses don't match: Address in ROM is f2:1a:c7:df:78:d4 Address in environment is 00:00:11:22:33:44
Warning: host_enp2s0 MAC addresses don't match: Address in ROM is f2:1a:c7:df:78:d4 Address in environment is 00:00:11:22:33:45
Warning: host_wlp4s0 using MAC address from ROM MMC: In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp2s0, eth2: host_wlp4s0, eth3: eth@10002000 Found 0 disks Segmentation fault
With this patch I no longer see the segfault. I'm not sure though why the calculated y value is so incredibly out of range (multiples of the overall screen height).
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 30086600fb..e95c06442f 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -248,6 +248,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, &xoff, &yoff); if (!data) return width_frac; + if ((y + height) >= vid_priv->ysize) + return -EAGAIN;
/* Figure out where to write the character in the frame buffer */ bits = data;

On 09/16/2018 07:45 AM, Simon Glass wrote:
When I run
$ sandbox/u-boot -D -c "bootefi selftest"
I get at the end the network timeout failure:
Setting up 'simple network protocol' Failed to open socket: 1 Operation not permitted Failed to open socket: 1 Operation not permitted Failed to open socket: 1 Operation not permitted Setting up 'simple network protocol' succeeded
Executing 'simple network protocol' DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover DHCP Discover lib/efi_selftest/efi_selftest_snp.c(311): ERROR: Timeout occurred lib/efi_selftest/efi_selftest.c(109): ERROR: Executing 'simple network protocol' failed
You have to ensure that the network interface used by the simple network protocol is connected to a DHCP server for this test to succeed. The loop interface is not a good choice.
Tearing down 'simple network protocol' Tearing down 'simple network protocol' succeeded
and then at the end:
Summary: 1 failures
Preparing for reset. Press any key... resetting ...
Here it hangs waiting for a key.
This key is served by test_efi_selftest.py so this should not pose a problem if the SandboxConsole class works correctly.
What really needs a fix is this segmentation fault for sandbox_defconfig:
$ valgrind ./u-boot -v -d u-boot.dtb -c 'bootefi hello' ==12957== Memcheck, a memory error detector ==12957== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==12957== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==12957== Command: ./u-boot -v -d u-boot.dtb -c bootefi\ hello ==12957==
U-Boot 2018.09-00268-g05538f55c0 (Sep 18 2018 - 02:12:40 +0200)
Model: sandbox DRAM: 128 MiB
Warning: host_lo MAC addresses don't match: Address in ROM is f2:49:6f:48:66:70 Address in environment is 00:00:11:22:33:44 ==12957== Invalid read of size 1 ==12957== at 0x1C5B3F: memcpy (string.c:526) ==12957== by 0x177653: eth_raw_bus_post_bind (sandbox-raw-bus.c:45) ==12957== by 0x15871A: device_bind_common.isra.0 (device.c:150) ==12957== by 0x1588CE: device_bind_with_driver_data (device.c:222) ==12957== by 0x15953C: lists_bind_fdt (lists.c:175) ==12957== by 0x1595D5: dm_scan_fdt_live (root.c:232) ==12957== by 0x159911: dm_extended_scan_fdt (root.c:338) ==12957== by 0x1599AD: dm_init_and_scan (root.c:384) ==12957== by 0x14458C: initr_dm (board_r.c:292) ==12957== by 0x1B23D5: initcall_run_list (initcall.c:30) ==12957== by 0x1445E8: board_init_r (board_r.c:879) ==12957== by 0x127568: main (start.c:321) ==12957== Address 0x89171a3 is 0 bytes after a block of size 3 alloc'd ==12957== at 0x48357BF: malloc (vg_replace_malloc.c:299) ==12957== by 0x4B8FF49: strndup (strndup.c:43) ==12957== by 0x4C1BC90: if_nameindex_netlink (if_index.c:171) ==12957== by 0x4C1BC90: if_nameindex (if_index.c:208) ==12957== by 0x17757B: eth_raw_bus_post_bind (sandbox-raw-bus.c:23) ==12957== by 0x15871A: device_bind_common.isra.0 (device.c:150) ==12957== by 0x1588CE: device_bind_with_driver_data (device.c:222) ==12957== by 0x15953C: lists_bind_fdt (lists.c:175) ==12957== by 0x1595D5: dm_scan_fdt_live (root.c:232) ==12957== by 0x159911: dm_extended_scan_fdt (root.c:338) ==12957== by 0x1599AD: dm_init_and_scan (root.c:384) ==12957== by 0x14458C: initr_dm (board_r.c:292) ==12957== by 0x1B23D5: initcall_run_list (initcall.c:30) ==12957== ==12957== Invalid read of size 1 ==12957== at 0x1C5B41: memcpy (string.c:527) ==12957== by 0x177653: eth_raw_bus_post_bind (sandbox-raw-bus.c:45) ==12957== by 0x15871A: device_bind_common.isra.0 (device.c:150) ==12957== by 0x1588CE: device_bind_with_driver_data (device.c:222) ==12957== by 0x15953C: lists_bind_fdt (lists.c:175) ==12957== by 0x1595D5: dm_scan_fdt_live (root.c:232) ==12957== by 0x159911: dm_extended_scan_fdt (root.c:338) ==12957== by 0x1599AD: dm_init_and_scan (root.c:384) ==12957== by 0x14458C: initr_dm (board_r.c:292) ==12957== by 0x1B23D5: initcall_run_list (initcall.c:30) ==12957== by 0x1445E8: board_init_r (board_r.c:879) ==12957== by 0x127568: main (start.c:321) ==12957== Address 0x89171a4 is 1 bytes after a block of size 3 alloc'd ==12957== at 0x48357BF: malloc (vg_replace_malloc.c:299) ==12957== by 0x4B8FF49: strndup (strndup.c:43) ==12957== by 0x4C1BC90: if_nameindex_netlink (if_index.c:171) ==12957== by 0x4C1BC90: if_nameindex (if_index.c:208) ==12957== by 0x17757B: eth_raw_bus_post_bind (sandbox-raw-bus.c:23) ==12957== by 0x15871A: device_bind_common.isra.0 (device.c:150) ==12957== by 0x1588CE: device_bind_with_driver_data (device.c:222) ==12957== by 0x15953C: lists_bind_fdt (lists.c:175) ==12957== by 0x1595D5: dm_scan_fdt_live (root.c:232) ==12957== by 0x159911: dm_extended_scan_fdt (root.c:338) ==12957== by 0x1599AD: dm_init_and_scan (root.c:384) ==12957== by 0x14458C: initr_dm (board_r.c:292) ==12957== by 0x1B23D5: initcall_run_list (initcall.c:30) ==12957==
Warning: host_enp2s0 MAC addresses don't match: Address in ROM is 5e:44:87:71:0f:cb Address in environment is 00:00:11:22:33:45
Warning: host_wlp4s0 using MAC address from ROM MMC: In: cros-ec-keyb Out: vidconsole Err: vidconsole Model: sandbox SCSI: Net: eth0: host_lo, eth1: host_enp2s0, eth2: host_wlp4s0, eth3: eth@10002000 Found 0 disks ==12957== Invalid read of size 2 ==12957== at 0x16D4BF: console_truetype_putc_xy (console_truetype.c:279) ==12957== by 0x16F42B: vidconsole_put_char (vidconsole-uclass.c:375) ==12957== by 0x16F471: vidconsole_puts (vidconsole-uclass.c:403) ==12957== by 0x14CF63: console_puts (console.c:250) ==12957== by 0x14CF63: fputs (console.c:361) ==12957== by 0x1C7366: printf (vsprintf.c:798) ==12957== by 0x199D07: efi_disk_register (efi_disk.c:435) ==12957== by 0x12B273: efi_init_obj_list (bootefi.c:69) ==12957== by 0x12B362: do_bootefi (bootefi.c:516) ==12957== by 0x153DD7: cmd_call (command.c:499) ==12957== by 0x153DD7: cmd_process (command.c:538) ==12957== by 0x143572: run_pipe_real (cli_hush.c:1677) ==12957== by 0x143572: run_list_real (cli_hush.c:1875) ==12957== by 0x143984: run_list (cli_hush.c:2024) ==12957== by 0x143984: parse_stream_outer (cli_hush.c:3216) ==12957== by 0x142EA8: parse_string_outer (cli_hush.c:3274) ==12957== Address 0x138f2db2 is not stack'd, malloc'd or (recently) free'd ==12957== ==12957== ==12957== Process terminating with default action of signal 11 (SIGSEGV) ==12957== Access not within mapped region at address 0x138F2DB2 ==12957== at 0x16D4BF: console_truetype_putc_xy (console_truetype.c:279) ==12957== by 0x16F42B: vidconsole_put_char (vidconsole-uclass.c:375) ==12957== by 0x16F471: vidconsole_puts (vidconsole-uclass.c:403) ==12957== by 0x14CF63: console_puts (console.c:250) ==12957== by 0x14CF63: fputs (console.c:361) ==12957== by 0x1C7366: printf (vsprintf.c:798) ==12957== by 0x199D07: efi_disk_register (efi_disk.c:435) ==12957== by 0x12B273: efi_init_obj_list (bootefi.c:69) ==12957== by 0x12B362: do_bootefi (bootefi.c:516) ==12957== by 0x153DD7: cmd_call (command.c:499) ==12957== by 0x153DD7: cmd_process (command.c:538) ==12957== by 0x143572: run_pipe_real (cli_hush.c:1677) ==12957== by 0x143572: run_list_real (cli_hush.c:1875) ==12957== by 0x143984: run_list (cli_hush.c:2024) ==12957== by 0x143984: parse_stream_outer (cli_hush.c:3216) ==12957== by 0x142EA8: parse_string_outer (cli_hush.c:3274) ==12957== If you believe this happened as a result of a stack ==12957== overflow in your program's main thread (unlikely but ==12957== possible), you can try to increase the size of the ==12957== main thread stack using the --main-stacksize= flag. ==12957== The main thread stack size used in this run was 8388608. ==12957== ==12957== HEAP SUMMARY: ==12957== in use at exit: 0 bytes in 0 blocks ==12957== total heap usage: 56 allocs, 56 frees, 5,998 bytes allocated ==12957== ==12957== All heap blocks were freed -- no leaks are possible ==12957== ==12957== For counts of detected and suppressed errors, rerun with: -v ==12957== ERROR SUMMARY: 32 errors from 3 contexts (suppressed: 0 from 0) Segmentation fault
participants (3)
-
Alexander Graf
-
Heinrich Schuchardt
-
Simon Glass