Exemple #1
0
def test_TryToCreateControlFlowGraphsFromLinuxSrc_graphs_are_valid():
    """Test that a known file produces valid graphs."""
    path = linux.LinuxSourcesDataset().src_tree_root / "kernel" / "exit.c"
    assert path.is_file()  # If this fails, the linux source tree is broken.

    for graph in linux.TryToCreateControlFlowGraphsFromLinuxSrc(path):
        assert graph.IsValidControlFlowGraph(strict=False)
Exemple #2
0
def test_BytecodeFromLinuxSrc_known_file():
    """Test that a known file produces bytecode."""
    path = linux.LinuxSourcesDataset().src_tree_root / "kernel" / "exit.c"
    assert path.is_file()  # If this fails, the linux source tree is broken.

    bytecode = linux.BytecodeFromLinuxSrc(path, "-O0")
    assert bytecode
Exemple #3
0
def test_TryToCreateControlFlowGraphsFromLinuxSrc_known_file():
    """Test that a known file produces graphs."""
    path = linux.LinuxSourcesDataset().src_tree_root / "kernel" / "exit.c"
    assert path.is_file()  # If this fails, the linux source tree is broken.

    # TODO(github.com/ChrisCummins/ProGraML/issues/7): No stable value.
    assert len(linux.TryToCreateControlFlowGraphsFromLinuxSrc(path)) < 20
Exemple #4
0
def linux_dataset() -> linux.LinuxSourcesDataset():
    yield linux.LinuxSourcesDataset()