summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-27 09:25:53 -0400
committerTom Rini <trini@konsulko.com>2020-07-27 09:25:53 -0400
commit3773028fced4795d52f02b387496395ec387f3bb (patch)
treeab11a71616bc9d5534d4b633520819c1b9be8b9c /test/py
parentada61f1ee2a4eaa1b29d699b5ba940483171df8a (diff)
parent5d4f7b4e2a1a2df459172ec95cbcdd6373dd707a (diff)
Merge branch '2020-07-27-misc-env-improvements'
- Assorted environment fixes. - Enhance environment in MMC and controlled via OF_CONTROL - Allow for environment in FAT to use the same device we boot from rather than be hard-coded.
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/test_env.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 6ff38f1020b..a64aaa9bc5a 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -336,3 +336,66 @@ def test_env_import_whitelist_delete(state_test_env):
unset_var(state_test_env, 'foo2')
unset_var(state_test_env, 'foo3')
unset_var(state_test_env, 'foo4')
+
+@pytest.mark.buildconfigspec('cmd_nvedit_info')
+def test_env_info(state_test_env):
+
+ """Test 'env info' command with all possible options.
+ """
+ c = state_test_env.u_boot_console
+
+ response = c.run_command('env info')
+ nb_line = 0
+ for l in response.split('\n'):
+ if 'env_valid = ' in l:
+ assert '= invalid' in l or '= valid' in l or '= redundant' in l
+ nb_line += 1
+ elif 'env_ready =' in l or 'env_use_default =' in l:
+ assert '= true' in l or '= false' in l
+ nb_line += 1
+ else:
+ assert true
+ assert nb_line == 3
+
+ response = c.run_command('env info -p -d')
+ assert 'Default environment is used' in response or "Environment was loaded from persistent storage" in response
+ assert 'Environment can be persisted' in response or "Environment cannot be persisted" in response
+
+ response = c.run_command('env info -p -d -q')
+ assert response == ""
+
+ response = c.run_command('env info -p -q')
+ assert response == ""
+
+ response = c.run_command('env info -d -q')
+ assert response == ""
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_nvedit_info')
+@pytest.mark.buildconfigspec('cmd_echo')
+def test_env_info_sandbox(state_test_env):
+
+ """Test 'env info' command result with several options on sandbox
+ with a known ENV configuration: ready & default & persistent
+ """
+ c = state_test_env.u_boot_console
+
+ response = c.run_command('env info')
+ assert 'env_ready = true' in response
+ assert 'env_use_default = true' in response
+
+ response = c.run_command('env info -p -d')
+ assert 'Default environment is used' in response
+ assert 'Environment cannot be persisted' in response
+
+ response = c.run_command('env info -d -q')
+ response = c.run_command('echo $?')
+ assert response == "0"
+
+ response = c.run_command('env info -p -q')
+ response = c.run_command('echo $?')
+ assert response == "1"
+
+ response = c.run_command('env info -d -p -q')
+ response = c.run_command('echo $?')
+ assert response == "1"