]> git.baikalelectronics.ru Git - uboot.git/commit
test_env: don't strip() printenv results
authorStephen Warren <swarren@nvidia.com>
Wed, 18 Dec 2019 18:37:21 +0000 (11:37 -0700)
committerTom Rini <trini@konsulko.com>
Thu, 2 Jan 2020 15:27:23 +0000 (10:27 -0500)
commit991950ea4323fc01c699392d8174eca2eab2ee04
tree7687fcb632768e58e019baa17bd7e3cf3d220a9d
parent714f0604c0896167672819387f5f38b1d4ee4468
test_env: don't strip() printenv results

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 <swarren@nvidia.com>
test/py/tests/test_env.py