From: Tom Rini Date: Thu, 2 Jan 2020 18:11:30 -0500 Subject: [PATCH] test_env: don't strip() printenv results In-Reply-To: <20191218183721.107623-1-swarren@wwwdotorg.org> References: <20191218183721.107623-1-swarren@wwwdotorg.org> Message-ID: <20200102231130.GJ4866@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Dec 18, 2019 at 11:37:21AM -0700, Stephen Warren wrote: > From: Stephen Warren > > get_env() was originally written to strip() the output of printenv to > isolate the test from any whitespace changes in printenv's output. > However, this throws away any whitespace in the variable value, which can > cause issues when test code expects to see that whitespace. In fact, > printenv never adds any whitespace at all, so there's no need to strip. > > The strip causes a practical problem for test_env_echo_exists() if > state_test_env.get_existent_var() happens to choose a U-Boot variable that > contains trailing whitespace. This is true for variable boot_targets. > > With Python 2, get_existent_var() never returned boot_targets so this > issue never caused a practical problem. > > With Python 3, get_existent_var does sometimes return boot_targets, no > doubt due to Python 3's different dict hash key order implementation, > about 0.5-2% of the time, so this test appears intermittent. With the > strip removed, this intermittency is solved, since the test passes for all > possible U-Boot variables. > > Signed-off-by: Stephen Warren Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: