summaryrefslogtreecommitdiff
path: root/test/py/test_shell.py
blob: 1af7d597a1759e0e2950b96e5c7fc486a23264b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest
from .helper import *


def test_barebox_true(barebox, barebox_config):
    skip_disabled(barebox_config, "CONFIG_CMD_TRUE")

    _, _, returncode = barebox.run('true')
    assert returncode == 0

def test_barebox_false(barebox, barebox_config):
    skip_disabled(barebox_config, "CONFIG_CMD_FALSE")

    _, _, returncode = barebox.run('false')
    assert returncode == 1

def test_barebox_md5sum(barebox, barebox_config):
    skip_disabled(barebox_config, "CONFIG_CMD_MD5SUM", "CONFIG_CMD_ECHO")

    barebox.run_check("echo -o md5 test")
    out = barebox.run_check("md5sum md5")
    assert out == ["d8e8fca2dc0f896fd7cb4cb0031ba249  md5"]

def test_barebox_version(barebox, barebox_config):
    skip_disabled(barebox_config, "CONFIG_CMD_VERSION")

    stdout, _, returncode = barebox.run('version')
    assert 'barebox' in stdout[1]
    assert returncode == 0

def test_barebox_no_err(barebox, barebox_config):
    skip_disabled(barebox_config, "CONFIG_CMD_DMESG")

    # TODO extend by err once all qemu platforms conform
    stdout, _, _ = barebox.run('dmesg -l crit,alert,emerg')
    assert stdout == []