On 12/18/2015 06:50 AM, Michal Simek wrote:
On 2.12.2015 23:18, Stephen Warren wrote:
This tests basic environment variable functionality.

Signed-off-by: Stephen Warren <swar...@wwwdotorg.org>
Signed-off-by: Stephen Warren <swar...@nvidia.com>
---
  test/py/test_env.py | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 121 insertions(+)
  create mode 100644 test/py/test_env.py

diff --git a/test/py/test_env.py b/test/py/test_env.py
new file mode 100644
index 000000000000..3af0176c4523
--- /dev/null
+++ b/test/py/test_env.py
@@ -0,0 +1,121 @@
+# Copyright (c) 2015 Stephen Warren
+# Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0
+
+import pytest
+
+# FIXME: This might be useful for other tests;
+# perhaps refactor it into ConsoleBase or some other state object?
+class StateTestEnv(object):
+    def __init__(self, uboot_console):
+        self.uboot_console = uboot_console
+        self.get_env()
+        self.set_var = self.get_non_existent_var()
+
+    def get_env(self):
+        response = self.uboot_console.run_command("printenv")
+        self.env = {}
+        for l in response.splitlines():
+            if not "=" in l:
+                continue
+            (var, value) = l.strip().split("=")

Please keep in your mind - I haven't written anything in python.
This is failing on my testing platform. On microblaze I have variable
which is defined like "console=console=ttyUL0,115200\0" and this script
is not able to handle it properly.
I expect it is because of two = on the same line.

Ah yes. Try:

- (var, value) = l.strip().split("=")
+ (var, value) = l.strip().split("=", 1)

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to