From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Fri, 18 Dec 2015 14:50:10 +0100 Subject: [U-Boot] [PATCH V2 3/7] test/py: add test of setenv/printenv/echo In-Reply-To: <1449094708-14784-3-git-send-email-swarren@wwwdotorg.org> References: <1449094708-14784-1-git-send-email-swarren@wwwdotorg.org> <1449094708-14784-3-git-send-email-swarren@wwwdotorg.org> Message-ID: <56740F12.4070101@monstr.eu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2.12.2015 23:18, Stephen Warren wrote: > This tests basic environment variable functionality. > > Signed-off-by: Stephen Warren > Signed-off-by: Stephen Warren > --- > 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. Thanks, Michal -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: