summaryrefslogtreecommitdiffstats
path: root/test/t/test_fio.py
blob: dadb5ac43528fcc9882133ac197eb3ee8133656f (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pytest


class TestFio:
    @pytest.mark.complete("fio ")
    def test_1(self, completion):
        assert completion

    @pytest.mark.complete("fio --", require_cmd=True)
    def test_2(self, completion):
        assert completion

    @pytest.mark.complete("fio --debug=foo,", require_cmd=True)
    def test_3(self, completion):
        assert completion

    @pytest.mark.complete("fio --ioengin", require_cmd=True)
    def test_cmdhelp_all(self, completion):
        """Test we got a "known present" option from --cmdhelp=all."""
        assert completion == "e=" or "e" in completion

    @pytest.mark.complete("fio --ioengine=", require_cmd=True)
    def test_enghelp(self, completion):
        """Test --enghelp parsing."""
        assert completion

    @pytest.mark.complete("fio --unlink=", require_cmd=True)
    def test_cmdhelp_boolean(self, completion):
        """Test --cmdhelp=COMMAND boolean parsing."""
        assert completion == "0 1".split()

    @pytest.mark.complete("fio --kb_base=", require_cmd=True)
    def test_cmdhelp_valid_values(self, completion):
        """Test --cmdhelp=COMMAND valid values parsing."""
        # We expect kb_base args to be stable, no additions/removals.
        assert completion == "1000 1024".split()

    @pytest.mark.complete("fio --non_exist3nt_option=", require_cmd=True)
    def test_cmdhelp_nonexistent(self, completion):
        """Test --cmdhelp=COMMAND errors out gracefully."""
        assert not completion

    @pytest.mark.complete(
        "fio --crctest=",
        require_cmd=True,
        xfail="! fio --help 2>&1 | command grep -q -- --crctest",
    )
    def test_crctest(self, completion):
        assert "sha1" in completion

    @pytest.mark.complete("fio --debug=", require_cmd=True)
    def test_debug(self, completion):
        assert "process" in completion