| 1 |
import pytest |
| 2 |
|
| 3 |
|
| 4 |
@pytest.fixture(scope="function") |
| 5 |
def in_bootloader(strategy, capsys): |
| 6 |
with capsys.disabled(): |
| 7 |
strategy.transition("barebox") |
| 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_barebox(target, in_bootloader): |
| 17 |
|
| 18 |
command = target["BareboxDriver"] |
| 19 |
|
| 20 |
stdout, stderr, returncode = command.run("version") |
| 21 |
assert returncode == 0 |
| 22 |
assert stdout |
| 23 |
assert not stderr |
| 24 |
assert "barebox" in "\n".join(stdout) |
| 25 |
|
| 26 |
|
| 27 |
def test_shell(target, in_shell): |
| 28 |
|
| 29 |
command = target["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_barebox_2(target, in_bootloader): |
| 38 |
|
| 39 |
command = target["BareboxDriver"] |
| 40 |
|
| 41 |
command.run_check("true") |