summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/test_dm.py22
-rw-r--r--test/py/tests/test_fs/test_fs_cmd.py13
-rw-r--r--test/py/tests/test_lsblk.py13
-rw-r--r--test/py/tests/test_part.py14
-rw-r--r--test/py/tests/test_sleep.py14
5 files changed, 71 insertions, 5 deletions
diff --git a/test/py/tests/test_dm.py b/test/py/tests/test_dm.py
index f6fbf8ba4c..97203b536e 100644
--- a/test/py/tests/test_dm.py
+++ b/test/py/tests/test_dm.py
@@ -4,14 +4,32 @@
import pytest
@pytest.mark.buildconfigspec('cmd_dm')
-def test_dm_drivers(u_boot_console):
- """Test that each driver in `dm tree` is also listed in `dm drivers`."""
+def test_dm_compat(u_boot_console):
+ """Test that each driver in `dm tree` is also listed in `dm compat`."""
response = u_boot_console.run_command('dm tree')
driver_index = response.find('Driver')
assert driver_index != -1
drivers = (line[driver_index:].split()[0]
for line in response[:-1].split('\n')[2:])
+ response = u_boot_console.run_command('dm compat')
+ for driver in drivers:
+ assert driver in response
+
+@pytest.mark.buildconfigspec('cmd_dm')
+def test_dm_drivers(u_boot_console):
+ """Test that each driver in `dm compat` is also listed in `dm drivers`."""
+ response = u_boot_console.run_command('dm compat')
+ drivers = (line[:20].rstrip() for line in response[:-1].split('\n')[2:])
+ response = u_boot_console.run_command('dm drivers')
+ for driver in drivers:
+ assert driver in response
+
+@pytest.mark.buildconfigspec('cmd_dm')
+def test_dm_static(u_boot_console):
+ """Test that each driver in `dm static` is also listed in `dm drivers`."""
+ response = u_boot_console.run_command('dm static')
+ drivers = (line[:25].rstrip() for line in response[:-1].split('\n')[2:])
response = u_boot_console.run_command('dm drivers')
for driver in drivers:
assert driver in response
diff --git a/test/py/tests/test_fs/test_fs_cmd.py b/test/py/tests/test_fs/test_fs_cmd.py
new file mode 100644
index 0000000000..ba39a53159
--- /dev/null
+++ b/test/py/tests/test_fs/test_fs_cmd.py
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020
+# Niel Fourie, DENX Software Engineering, lusus@denx.de
+
+import pytest
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_fs_generic')
+def test_dm_compat(u_boot_console):
+ """Test that `fstypes` prints a result which includes `sandbox`."""
+ output = u_boot_console.run_command('fstypes')
+ assert "Supported filesystems:" in output
+ assert "sandbox" in output
diff --git a/test/py/tests/test_lsblk.py b/test/py/tests/test_lsblk.py
new file mode 100644
index 0000000000..40ffe01263
--- /dev/null
+++ b/test/py/tests/test_lsblk.py
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2020
+# Niel Fourie, DENX Software Engineering, lusus@denx.de
+
+import pytest
+
+@pytest.mark.buildconfigspec('blk')
+@pytest.mark.buildconfigspec('cmd_lsblk')
+def test_lsblk(u_boot_console):
+ """Test that `lsblk` prints a result which includes `host`."""
+ output = u_boot_console.run_command('lsblk')
+ assert "Block Driver" in output
+ assert "sandbox_host_blk" in output
diff --git a/test/py/tests/test_part.py b/test/py/tests/test_part.py
new file mode 100644
index 0000000000..cba9804510
--- /dev/null
+++ b/test/py/tests/test_part.py
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020
+# Niel Fourie, DENX Software Engineering, lusus@denx.de
+
+import pytest
+
+@pytest.mark.buildconfigspec('cmd_part')
+@pytest.mark.buildconfigspec('partitions')
+@pytest.mark.buildconfigspec('efi_partition')
+def test_dm_compat(u_boot_console):
+ """Test that `part types` prints a result which includes `EFI`."""
+ output = u_boot_console.run_command('part types')
+ assert "Supported partition tables:" in output
+ assert "EFI" in output
diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py
index b69edf26ef..392af29db2 100644
--- a/test/py/tests/test_sleep.py
+++ b/test/py/tests/test_sleep.py
@@ -11,6 +11,12 @@ change test behavior.
# Setup env__sleep_accurate to False if time is not accurate on your platform
env__sleep_accurate = False
+# Setup env__sleep_time time in seconds board is set to sleep
+env__sleep_time = 3
+
+# Setup env__sleep_margin set a margin for any system overhead
+env__sleep_margin = 0.25
+
"""
def test_sleep(u_boot_console):
@@ -23,13 +29,15 @@ def test_sleep(u_boot_console):
if u_boot_console.config.buildconfig.get('config_cmd_misc', 'n') != 'y':
pytest.skip('sleep command not supported')
+
# 3s isn't too long, but is enough to cross a few second boundaries.
- sleep_time = 3
+ sleep_time = u_boot_console.config.env.get('env__sleep_time', 3)
+ sleep_margin = u_boot_console.config.env.get('env__sleep_margin', 0.25)
tstart = time.time()
u_boot_console.run_command('sleep %d' % sleep_time)
tend = time.time()
elapsed = tend - tstart
assert elapsed >= (sleep_time - 0.01)
if not u_boot_console.config.gdbserver:
- # 0.25s margin is hopefully enough to account for any system overhead.
- assert elapsed < (sleep_time + 0.25)
+ # margin is hopefully enough to account for any system overhead.
+ assert elapsed < (sleep_time + sleep_margin)