| 1 |
import pytest |
| 2 |
|
| 3 |
|
| 4 |
@pytest.fixture(scope="function") |
| 5 |
def in_bootloader(strategy, capsys): |
| 6 |
with capsys.disabled(): |
| 7 |
strategy.transition("uboot") |
| 8 |
|
| 9 |
|
| 10 |
@pytest.fixture(scope="function") |
| 11 |
def in_shell(strategy, capsys): |
| 12 |
with capsys.disabled(): |
| 13 |
strategy.transition("shell") |
| 14 |
|
| 15 |
|
| 16 |
def test_uboot(target, in_bootloader): |
| 17 |
|
| 18 |
command = target.get_driver("UBootDriver") |
| 19 |
|
| 20 |
stdout, stderr, returncode = command.run("version") |
| 21 |
assert returncode == 0 |
| 22 |
assert stdout |
| 23 |
assert not stderr |
| 24 |
assert "U-Boot" in "\n".join(stdout) |
| 25 |
|
| 26 |
|
| 27 |
def test_shell(target, in_shell): |
| 28 |
|
| 29 |
command = target.get_driver("ShellDriver") |
| 30 |
stdout, stderr, returncode = command.run("cat /proc/version") |
| 31 |
assert returncode == 0 |
| 32 |
assert stdout |
| 33 |
assert not stderr |
| 34 |
assert "Linux" in stdout[0] |
| 35 |
|
| 36 |
|
| 37 |
def test_uboot_2(target, in_bootloader): |
| 38 |
command = target.get_driver("UBootDriver") |
| 39 |
|
| 40 |
stdout, stderr, returncode = command.run("version") |
| 41 |
assert returncode == 0 |
| 42 |
assert stdout |
| 43 |
assert not stderr |
| 44 |
assert "U-Boot" in "\n".join(stdout) |