Skip to contentSkip to conversation

test/py: fix printenv signon message disable code

PATCH New Stephen Warren 3 participants 4 messages Jun 16, 2016 – Jun 19, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/py: fix printenv signon message disable code

From: Stephen Warren <[email protected]>

CONFIG_VERSION_VARIABLE isn't always defined, so we can't simply look up its value directly, or an exception will occur if it isn't defined. Instead, we must use .get() to supply a default value if the variable isn't defined.

Fixes da37f006e7c5 ("tests: py: disable main_signon check for printenv cmd")
Cc Heiko Schocher <[email protected]>
---
 test/py/tests/test_env.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
test/py/tests/test_env.py +2 -1
index 22a22d1d538b..035dbf5cac4c 100644
@@ -39,7 +39,8 @@ class StateTestEnv(object):
             Nothing.
         """
 
-        if self.u_boot_console.config.buildconfig['config_version_variable'] == 'y':
+        if self.u_boot_console.config.buildconfig.get(
+                'config_version_variable', 'n') == 'y':
             with self.u_boot_console.disable_check('main_signon'):
                 response = self.u_boot_console.run_command('printenv')
         else:
Signature · 1 line
2.9.0
#1 lore raw

PATCH 1/1 test/py: fix printenv signon message disable code

Hello Stephen,

Am 16.06.2016 um 20:59 schrieb Stephen Warren:

Quoted 7 lines

From: Stephen Warren <[email protected]>

CONFIG_VERSION_VARIABLE isn't always defined, so we can't simply look up its value directly, or an exception will occur if it isn't defined. Instead, we must use .get() to supply a default value if the variable isn't defined.

Quoted 6 lines
Fixes da37f006e7c5 ("tests: py: disable main_signon check for printenv cmd")
Cc Heiko Schocher <[email protected]>
---
  test/py/tests/test_env.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks!

Quoted 5 lines
test/py/tests/test_env.py +0 -0
index 22a22d1d538b..035dbf5cac4c 100644

test/py/tests/test_env.py class StateTestEnv(object): · line 46

Quoted 9 lines
test/py/tests/test_env.py +2 -1
@@ -39,7 +39,8 @@ class StateTestEnv(object):
              Nothing.
          """
 
-        if self.u_boot_console.config.buildconfig['config_version_variable'] == 'y':
+        if self.u_boot_console.config.buildconfig.get(
+                'config_version_variable', 'n') == 'y':
              with self.u_boot_console.disable_check('main_signon'):
                  response = self.u_boot_console.run_command('printenv')
          else:

Hmm... may we should also move VERSION_VARIABLE to Kconfig?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#2 lore raw

PATCH 1/1 test/py: fix printenv signon message disable code

Quoted 29 lines · Heiko Schocher

Hello Stephen,

Am 16.06.2016 um 20:59 schrieb Stephen Warren:

Quoted 7 lines

From: Stephen Warren <[email protected]>

CONFIG_VERSION_VARIABLE isn't always defined, so we can't simply look up its value directly, or an exception will occur if it isn't defined. Instead, we must use .get() to supply a default value if the variable isn't defined.

Quoted 7 lines
Fixes da37f006e7c5 ("tests: py: disable main_signon check for

printenv cmd")

---
  test/py/tests/test_env.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks!

Quoted 8 lines
test/py/tests/test_env.py +0 -0
index 22a22d1d538b..035dbf5cac4c 100644
@@ -39,7 +39,8 @@ class StateTestEnv(object):
              Nothing.
          """
 
Quoted 9 lines

test/py/tests/test_env.py class StateTestEnv(object): · line 46

Quoted 7 lines
test/py/tests/test_env.py +0 -1
-        if

self.u_boot_console.config.buildconfig['config_version_variable'] == 'y':

test/py/tests/test_env.py +2 -0
+        if self.u_boot_console.config.buildconfig.get(
+                'config_version_variable', 'n') == 'y':
              with self.u_boot_console.disable_check('main_signon'):
                  response = self.u_boot_console.run_command('printenv')
          else:

Hmm... may we should also move VERSION_VARIABLE to Kconfig?

Be my guest:-) I believe the check above will automatically adapt to such a change, because the buildconfig object contains the union of all options found in .config (from Kconfig) and include/autoconf.mk (from include/configs/xxx.h).

#3 lore raw

PATCH 1/1 test/py: fix printenv signon message disable code

In reply to Stephen Warren
Quoted 10 lines · Stephen Warren

From: Stephen Warren <[email protected]>

CONFIG_VERSION_VARIABLE isn't always defined, so we can't simply look up its value directly, or an exception will occur if it isn't defined. Instead, we must use .get() to supply a default value if the variable isn't defined.

Fixes da37f006e7c5 ("tests: py: disable main_signon check for printenv cmd")

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/20160619/08878f01/attachment.sig>