示例#1
0
def test_lscpu():
    expect = {
        'type': 'cpu',
        "working": "yes",
        'isa': 'x86-32',
        'model': 'Celeron 2.80GHz',
        'brand': 'Intel',
        'core-n': 1,
        'thread-n': 1,
        'frequency-hertz': -1,
        'human_readable_frequency': 'N/A'
    }
    output = read_lscpu(filedir + 'lscpu.txt')
示例#2
0
def test_lscpu():
    expect = {
        "type": "cpu",
        "working": "yes",
        "isa": "x86-64",
        "model": "Core i5-6500",
        "brand": "Intel",
        "core-n": 4,
        "thread-n": 4,
        "frequency-hertz": 3200000000,
        "human_readable_frequency": "N/A"
    }
    output = read_lscpu(filedir + 'lscpu.txt')

    assert expect == output
示例#3
0
def test_lscpu():
    expect = {
        "type": "cpu",
        "working": "yes",
        "isa": "x86-64",
        "model": "Pentium 4 2.80GHz",
        "brand": "Intel",
        "core-n": 1,
        "thread-n": 2,
        "frequency-hertz": 2800000000,
        "human_readable_frequency": "N/A"
    }
    output = read_lscpu(filedir + 'lscpu.txt')

    assert expect == output
示例#4
0
def test_lscpu():
    expect = {
        "type": "cpu",
        "working": "yes",
        "isa": "x86-32",
        "model": "Athlon 4",
        "brand": "AMD",
        "core-n": 1,
        "thread-n": 1,
        "frequency-hertz": -1,
        "human_readable_frequency": "N/A"
    }

    output = read_lscpu(filedir + 'lscpu.txt')

    assert expect == output
示例#5
0
def extract_data(directory: str, has_dedicated_gpu: bool, gpu_in_cpu: bool,
                 cleanup: bool, interactive: bool) -> dict:
    mobo = get_baseboard(directory + "/baseboard.txt")
    cpu = read_lscpu(directory + "/lscpu.txt")
    gpu = read_lspci_and_glxinfo(has_dedicated_gpu, directory + "/lspci.txt",
                                 directory + "/glxinfo.txt", interactive)
    if not has_dedicated_gpu:
        entries = extract_integrated_gpu_from_standalone(gpu)
        if gpu_in_cpu:
            if isinstance(cpu, list):
                # Multiple processors
                updated_cpus = []
                for one_cpu in cpu:
                    one_cpu = {**one_cpu, **entries}
                    updated_cpus.append(one_cpu)
                cpu = updated_cpus
                del updated_cpus
            else:
                cpu = {**cpu, **entries}
        else:
            mobo = {**mobo, **entries}
        gpu = []
    mobo = get_connectors(directory + "/connector.txt", mobo, interactive)
    mobo = get_net(directory + "/net.txt", mobo, interactive)
    chassis = get_chassis(directory + "/chassis.txt")
    dimms = read_decode_dimms(directory + "/dimms.txt", interactive)
    if chassis["motherboard-form-factor"] == "proprietary-laptop":
        psu = {"type": "external-psu"}
    else:
        psu = {"type": "psu"}
    disks = read_smartctl(directory)

    result = []
    empty_dict = {}
    for thing in (chassis, mobo, cpu, dimms, gpu, disks, psu):
        if thing.__len__() == 0:
            result.append(empty_dict)
        else:
            result.append(thing)
    if cleanup:
        result = do_cleanup(result, interactive)

    return result