コード例 #1
0
ファイル: test_core_generic.py プロジェクト: shartse/sdb
    # member - bogus member
    "spa | member spa_ubsync.bogus",
    # member - incomplete array expression
    "addr spa_namespace_avl | member avl_root->avl_child[1",
    # member - bogus array index
    "addr spa_namespace_avl | member avl_root->avl_child[a]",
    # member - incomplete expression
    "spa | member spa_zio_taskq[0][0].stqs_taskq->",
    # member - incomplete expression
    "spa | member spa_zio_taskq[0][0].stqs_taskq.",
]

CMD_TABLE = POS_CMDS + NEG_CMDS


@pytest.mark.skipif(not dump_exists(),
                    reason="couldn't find crash dump to run tests against")
@pytest.mark.parametrize('cmd', POS_CMDS)
def test_cmd_output_and_error_code_0(capsys, cmd):
    assert repl_invoke(cmd) == 0
    captured = capsys.readouterr()
    assert captured.out == slurp_output_file("core", cmd)


@pytest.mark.skipif(not dump_exists(),
                    reason="couldn't find crash dump to run tests against")
@pytest.mark.parametrize('cmd', NEG_CMDS)
def test_cmd_output_and_error_code_1(capsys, cmd):
    assert repl_invoke(cmd) == 1
    captured = capsys.readouterr()
    assert captured.out == slurp_output_file("core", cmd)
コード例 #2
0
    "spa rpool",
    "spa | pp",
    "spa | head 1 | spa",
    "spa | vdev",
    "spa | vdev | pp",
    "spa | vdev | metaslab",
    "spa | vdev | metaslab -w",
    "spa | vdev | metaslab | member ms_allocatable | range_tree",
    "spa | vdev | metaslab | member ms_allocatable.rt_root | zfs_btree",

    # zfs_dbgmsg
    "zfs_dbgmsg",
    "zfs_dbgmsg | tail 5 | zfs_dbgmsg",

    # zfs_histogram
    "spa data | member spa_normal_class.mc_histogram | zfs_histogram",
    "spa data | vdev | metaslab | filter 'obj.ms_loaded == 1' | head 1 | member ms_sm.sm_phys.smp_histogram | zhist",
    "spa data | vdev | metaslab | filter 'obj.ms_loaded == 1' | head 1 | member ms_sm.sm_phys.smp_histogram | zhist 9",
    "spa data | vdev | metaslab | filter 'obj.ms_loaded == 1' | head 1 | member ms_allocatable.rt_histogram | zhist",
] # yapf: disable


@pytest.mark.skipif(  # type: ignore[misc]
    not dump_exists(),
    reason="couldn't find crash dump to run tests against")
@pytest.mark.parametrize('cmd', CMD_TABLE)  # type: ignore[misc]
def test_cmd_output_and_error_code(capsys: Any, cmd: str) -> None:
    assert repl_invoke(cmd) == 0
    captured = capsys.readouterr()
    assert captured.out == slurp_output_file("zfs", cmd)