From patchwork Mon Jul 13 10:33:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 241403 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Mon, 13 Jul 2020 12:33:29 +0200 Subject: [PATCH 1/1] efi_loader: skip warnings for network configuration Message-ID: <20200713103329.46035-1-xypron.glpk@gmx.de> Skip messages should only be written if the setup is not suitable for testing. If DHCP is enabled, we should not write a skip message if no static network configuration is supplied. Likewise if a static network configuration is supplied, we should not write a skip message if DHCP is not enabled. Signed-off-by: Heinrich Schuchardt --- test/py/tests/test_efi_loader.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -- 2.27.0 diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 9465c28fbc..7aa422e764 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -68,8 +68,8 @@ def test_efi_pre_commands(u_boot_console): u_boot_console.run_command('pci enum') @pytest.mark.buildconfigspec('cmd_dhcp') -def test_efi_dhcp(u_boot_console): - """Test the dhcp command. +def test_efi_setup_dhcp(u_boot_console): + """Set up the network using DHCP. The boardenv_* file may be used to enable/disable this test; see the comment at the beginning of this file. @@ -77,7 +77,10 @@ def test_efi_dhcp(u_boot_console): test_dhcp = u_boot_console.config.env.get('env__net_dhcp_server', False) if not test_dhcp: - pytest.skip('No DHCP server available') + env_vars = u_boot_console.config.env.get('env__net_static_env_vars', None) + if not env_vars: + pytest.skip('No DHCP server available') + return None u_boot_console.run_command('setenv autoload no') output = u_boot_console.run_command('dhcp') @@ -88,7 +91,7 @@ def test_efi_dhcp(u_boot_console): @pytest.mark.buildconfigspec('net') def test_efi_setup_static(u_boot_console): - """Set up a static IP configuration. + """Set up the network using a static IP configuration. The configuration is provided by the boardenv_* file; see the comment at the beginning of this file. @@ -96,7 +99,10 @@ def test_efi_setup_static(u_boot_console): env_vars = u_boot_console.config.env.get('env__net_static_env_vars', None) if not env_vars: - pytest.skip('No static network configuration is defined') + test_dhcp = u_boot_console.config.env.get('env__net_dhcp_server', False) + if not test_dhcp: + pytest.skip('No static network configuration is defined') + return None for (var, val) in env_vars: u_boot_console.run_command('setenv %s %s' % (var, val))