| 1 |
import pytest |
| 2 |
|
| 3 |
|
| 4 |
@pytest.fixture(scope="function") |
| 5 |
def bootloader(target, strategy, capsys): |
| 6 |
with capsys.disabled(): |
| 7 |
strategy.transition("barebox") |
| 8 |
return target["CommandProtocol"] |
| 9 |
|
| 10 |
|
| 11 |
@pytest.fixture(scope="function") |
| 12 |
def shell(target, strategy, capsys): |
| 13 |
with capsys.disabled(): |
| 14 |
strategy.transition("shell") |
| 15 |
return target["CommandProtocol"] |
| 16 |
|
| 17 |
|
| 18 |
def test_barebox(bootloader): |
| 19 |
stdout, stderr, returncode = bootloader.run("version") |
| 20 |
assert returncode == 0 |
| 21 |
assert stdout |
| 22 |
assert not stderr |
| 23 |
assert "barebox" in "\n".join(stdout) |
| 24 |
|
| 25 |
|
| 26 |
def test_shell(shell): |
| 27 |
stdout, stderr, returncode = shell.run("cat /proc/version") |
| 28 |
assert returncode == 0 |
| 29 |
assert stdout |
| 30 |
assert not stderr |
| 31 |
assert "Linux" in stdout[0] |
| 32 |
|
| 33 |
|
| 34 |
def test_barebox_2(bootloader): |
| 35 |
bootloader.run_check("true") |