예제 #1
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "SiS",
        "model": "65x/M650/740",
    }]

    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #2
0
def test_77_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand-manufacturer": "SiS",
        "brand": "ASUSTeK Computer Inc.",
        "model": "771/671",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #3
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Microsoft Corporation",
        "model": "HD Graphics 515",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #4
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASUSTeK Computer Inc.",
        "model": "GeForce GT 610",
        "internal-name": "GF119",  # Still no glxinfo :(
        "brand-manufacturer": "Nvidia",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"), "")

    assert output == expect
예제 #5
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Lenovo",
        "model": "Mobile 4 Series Chipset",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #6
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand-manufacturer": "AMD/ATI",
        "brand": "PC Partner Limited / Sapphire Technology Tahiti PRO",
        "model": "Radeon HD 7950/8950 OEM / R9 280",
        "capacity-byte": 3221225472,
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #7
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand-manufacturer": "AMD/ATI",
        "brand": "Apple Inc. Radeon Pro 560X",
        "model": "Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X",
        "capacity-byte": 4294967296,
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #8
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASUSTeK Computer Inc.",
        "model": "S3 UniChrome Pro",
        "internal-name": "P4M890",
        "brand-manufacturer": "VIA",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #9
0
def test_lspci():
    # VGA core graphics processor core VGA processor graphics core VGA processor is the core of this laptop
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Lenovo 3rd Gen Core processor Graphics Controller",
        "model": "VGA controller",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #10
0
def test_lspci():
    expect = [
        {
            "type": "graphics-card",
            "working": "yes",
            "brand": "ZOTAC International (MCO) Ltd.",
            "model": "GeForce GTX 1060 6GB",
            "internal-name": "GP106",
            "capacity-byte": 6442450944,
            "brand-manufacturer": "Nvidia",
        }
    ]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(True, read_file(filedir, "lspci.txt"), read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #11
0
def test_lspci_integrated():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Hewlett-Packard Company",
        "model": "82945G/GZ",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False,
        read_file(filedir, "82945G/lspci.txt"),
        read_file(filedir, "82945G/glxinfo.txt"),
    )

    assert output == expect
예제 #12
0
def test_lspci():
    expect = [
        {
            "type": "graphics-card",
            "working": "yes",
            "brand": "ASUSTeK Computer Inc.",
            "model": "GeForce 9600 GT",
            "internal-name": "G94",
            "brand-manufacturer": "Nvidia",
        }
    ]
    # False to ignore missing glxinfo
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(False, read_file(filedir, "lspci.txt"), read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #13
0
def test_lspci():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand-manufacturer": "Nvidia",
        "brand": "Apple Inc.",
        "internal-name": "GK107M",
        "model": "GeForce GT 750M Mac Edition",
        "capacity-byte": 2147483648,
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #14
0
def test_lspci():
    expect = [{
        "brand": "ASUSTeK Computer Inc.",
        "brand-manufacturer": "Nvidia",
        "capacity-byte": 1073741824,
        "internal-name": "GF106",
        "model": "GeForce GTS 450",
        "type": "graphics-card",
        "working": "yes",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True, read_file(filedir, "lspci.txt"),
        read_file(filedir, "glxinfo.txt"))

    assert output == expect
예제 #15
0
def test_lspci_dedicated3():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASUSTeK Computer Inc.",
        "internal-name": "GM204",
        "model": "GeForce GTX 970",
        "capacity-byte": 4294967296,
        "brand-manufacturer": "Nvidia",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True,
        read_file(filedir, "dedicated/lspci-gtx-970.txt"),
        read_file(filedir, "dedicated/glxinfo-gtx-970.txt"),
    )

    assert output == expect
예제 #16
0
def test_lspci_dedicated2():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASUSTeK Computer Inc.",
        "internal-name": "G96",
        "model": "GeForce 9400 GT",
        "capacity-byte": 1073741824,
        "brand-manufacturer": "Nvidia",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True,
        read_file(filedir, "dedicated/lspci-9400GT.txt"),
        read_file(filedir, "dedicated/glxinfo-9400GT.txt"),
    )

    assert output == expect
예제 #17
0
def test_lspci_integrated_cpu_3():
    filesubdir = "integrated/on-cpu/Xeon/"

    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASRock Incorporation",
        "model": "Xeon E3-1200 v3/4th Gen Core Processor",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False,
        os.path.join(read_file(filedir, f"{filesubdir}/lspci.txt")),
        os.path.join(read_file(filedir, f"{filesubdir}/glxinfo.txt")),
    )

    assert output == expect
예제 #18
0
def test_lspci_integrated_cpu_2():
    filesubdir = "integrated/on-cpu/HP EliteBook 2540p (i5 M540)/"

    # Yeeeeah, nice and detailed - not.
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Hewlett-Packard Company Core Processor",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False,
        os.path.join(read_file(filedir, f"{filesubdir}/lspci.txt")),
        os.path.join(read_file(filedir, f"{filesubdir}/glxinfo.txt")),
    )

    assert output == expect
예제 #19
0
def test_lspci_integrated_cpu_1():
    filesubdir = "integrated/on-cpu/Acer Swift 3/"

    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Acer Incorporated",
        "model": "Skylake GT2 [HD Graphics 520]",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False,
        os.path.join(read_file(filedir, f"{filesubdir}/lspci.txt")),
        os.path.join(read_file(filedir, f"{filesubdir}/glxinfo.txt")),
    )

    assert output == expect
예제 #20
0
def test_lspci_dedicated1():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASUSTeK Computer Inc.",
        "internal-name": "NV44",
        "model": "GeForce 6200 SE TurboCache",
        "capacity-byte": 67108864,  # 64 MB
        "brand-manufacturer": "Nvidia",
    }]

    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True,
        os.path.join(read_file(filedir, "dedicated/NVIDIA6200/lspci.txt")),
        os.path.join(read_file(filedir, "dedicated/NVIDIA6200/glxinfo.txt")),
    )

    assert output == expect
예제 #21
0
def test_lspci_integrated_mobo_2():
    filesubdir = "integrated/on-mobo/"
    file = "82865G"

    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "Lite-On Technology Corporation",
        "model": "82865G",
        "brand-manufacturer": "Intel",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False,
        os.path.join(read_file(filedir, f"{filesubdir}/lspci-{file}.txt")),
        os.path.join(read_file(filedir, f"{filesubdir}/glxinfo-{file}.txt")),
    )

    assert output == expect
예제 #22
0
def test_lspci_dedicated():
    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "PC Partner Limited / Sapphire Technology",
        "internal-name": "G98",
        "model": "GeForce G 100",
        "capacity-byte":
        536870912,  # This has 512 MB of VRAM, but glxinfo reports 496?
        "brand-manufacturer": "Nvidia",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        True,
        read_file(filedir, "NVIDIA-G100/lspci.txt"),
        read_file(filedir, "NVIDIA-G100/glxinfo.txt"),
    )

    assert output == expect
예제 #23
0
def test_lspci_integrated_mobo_1():
    filesubdir = "integrated/on-mobo/"
    file = "8300GT"

    expect = [{
        "type": "graphics-card",
        "working": "yes",
        "brand": "ASUSTeK Computer Inc.",
        "model": "GeForce 8300",
        "internal-name": "C77",
        "brand-manufacturer": "Nvidia",
    }]
    output = read_lspci_and_glxinfo.parse_lspci_and_glxinfo(
        False,
        os.path.join(read_file(filedir, f"{filesubdir}/lspci-{file}.txt")),
        os.path.join(read_file(filedir, f"{filesubdir}/glxinfo-{file}.txt")),
    )

    assert output == expect
예제 #24
0
def call_parsers(
    generated_files_path: str,
    components: Set[ParserComponents],
    gpu_location: GpuLocation,
    interactive: bool = False,
) -> list:
    generated_files_path = generated_files_path.rstrip("/")

    def read_file(name: str) -> str:
        path = os.path.join(generated_files_path, name)
        try:
            with open(path, "r") as f:
                output = f.read()
            return output
        except FileNotFoundError:
            raise InputFileNotFoundError(path)

    result = []

    # TODO: if linux, else windows
    if sys.platform == "win32":
        pass
    else:
        if not components.isdisjoint(
            {ParserComponents.CASE, ParserComponents.MOTHERBOARD}):
            result += parse_motherboard(
                read_file("baseboard.txt"),
                read_file("connector.txt"),
                read_file("net.txt"),
                interactive,
            )
            if gpu_location == GpuLocation.MOTHERBOARD:
                _merge_gpu(
                    result,
                    "motherboard",
                    parse_lspci_and_glxinfo(False, read_file("lspci.txt"), ""),
                )
        if ParserComponents.CASE in components:
            result += parse_case(read_file("chassis.txt"),
                                 _find_component("motherboard", result))
        if ParserComponents.CPU in components:
            result += parse_lscpu(read_file("lscpu.txt"))
            if gpu_location == GpuLocation.CPU:
                _merge_gpu(
                    result,
                    "cpu",
                    parse_lspci_and_glxinfo(False, read_file("lspci.txt"), ""),
                )
        if ParserComponents.GPU in components and gpu_location == GpuLocation.DISCRETE:
            result += parse_lspci_and_glxinfo(True, read_file("lspci.txt"),
                                              read_file("glxinfo.txt"),
                                              interactive)
        if ParserComponents.RAM in components:
            result += parse_decode_dimms(read_file("dimms.txt"), interactive)
        if ParserComponents.HDD in components or ParserComponents.SSD in components:
            result += parse_smartctl(read_file("smartctl.txt"), interactive)
        if ParserComponents.PSU in components:
            result += parse_psu(_find_component("case", result))

    result = _do_cleanup(result, interactive)
    return result