示例#1
0
def test_ecc_ram1():
    expect = [
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "model": "K",
            "sn": "3375612524",
            "frequency-hertz": 667000000,
            "capacity-byte": 2147483648,
            "ram-type": "ddr2",
            "ram-ecc": "yes",
            "ram-timings": "5-5-5-15",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "model": "K",
            "sn": "3392385900",
            "frequency-hertz": 667000000,
            "capacity-byte": 2147483648,
            "ram-type": "ddr2",
            "ram-ecc": "yes",
            "ram-timings": "5-5-5-15",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "ECC/R451-R450.txt"))

    assert output == expect
示例#2
0
def test_ecc_ram1_not_an_hex():
    expect = [
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "model": "K",
            "sn": "0F00xb4r",
            "frequency-hertz": 667000000,
            "capacity-byte": 2147483648,
            "ram-type": "ddr2",
            "ram-ecc": "yes",
            "ram-timings": "5-5-5-15",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "model": "K",
            "sn": "0xCA33B3RC",
            "frequency-hertz": 667000000,
            "capacity-byte": 2147483648,
            "ram-type": "ddr2",
            "ram-ecc": "yes",
            "ram-timings": "5-5-5-15",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "ECC/R451-R450-notanhex.txt"))

    assert output == expect
示例#3
0
def test_ecc_ram2():
    expect = [
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "sn": "2853609420",
            "frequency-hertz": 667000000,
            "capacity-byte": 1073741824,
            "ram-type": "ddr2",
            "ram-ecc": "yes",
            "ram-timings": "5-5-5-15",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "sn": "2836829644",
            "frequency-hertz": 667000000,
            "capacity-byte": 1073741824,
            "ram-type": "ddr2",
            "ram-ecc": "yes",
            "ram-timings": "5-5-5-15",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "ECC/R480-R479.txt"))

    assert output == expect
示例#4
0
def test_ram():
    expect = [
        {
            "ram-ecc": "no",
            "ram-type": "ddr3",
            "brand": "G Skill Intl",
            "capacity-byte": 8589934592,
            "frequency-hertz": 1333000000,
            "model": "F3-1600C7-8GTX",
            "type": "ram",
            "working": "yes",
            "ram-timings": "9-9-9-24",
        },
        {
            "ram-ecc": "no",
            "ram-type": "ddr3",
            "brand": "G Skill Intl",
            "capacity-byte": 8589934592,
            "frequency-hertz": 1333000000,
            "model": "F3-1600C7-8GTX",
            "type": "ram",
            "working": "yes",
            "ram-timings": "9-9-9-24",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "dimms.txt"))

    assert len(output) == 2, "2 RAM modules are found"
    assert output == expect
示例#5
0
def test_ram():
    expect = [
        {
            "brand": "Micron Technology",
            "capacity-byte": 8589934592,
            "frequency-hertz": 1600000000,
            "model": "CT102464BA160B.C16",
            "ram-ecc": "no",
            "ram-timings": "11-11-11-28",
            "ram-type": "ddr3",
            "sn": "1949761536",
            "type": "ram",
            "working": "yes",
        },
        {
            "brand": "Micron Technology",
            "capacity-byte": 8589934592,
            "frequency-hertz": 1600000000,
            "model": "CT102464BA160B.C16",
            "ram-ecc": "no",
            "ram-timings": "11-11-11-28",
            "ram-type": "ddr3",
            "sn": "2172780544",
            "type": "ram",
            "working": "yes",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "dimms.txt"))

    assert len(output) == 2, "2 RAM modules are found"
    assert output == expect
示例#6
0
def test_ram1():
    expect = [
        {
            "type": "ram",
            "working": "yes",
            "brand": "SK Hynix (former Hyundai Electronics)",
            "model": "HYMP112U64CP8-S6",
            "sn": "16416",
            "frequency-hertz": 800000000,
            "capacity-byte": 1073741824,
            "ram-type": "ddr2",
            "ram-ecc": "no",
            "ram-timings": "6-6-6-18",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "SK Hynix (former Hyundai Electronics)",
            "model": "HYMP112U64CP8-S6",
            "sn": "8224",
            "frequency-hertz": 800000000,
            "capacity-byte": 1073741824,
            "ram-type": "ddr2",
            "ram-ecc": "no",
            "ram-timings": "6-6-6-18",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "SK Hynix (former Hyundai Electronics)",
            "model": "HYMP112U64CP8-S6",
            "sn": "12320",
            "frequency-hertz": 800000000,
            "capacity-byte": 1073741824,
            "ram-type": "ddr2",
            "ram-ecc": "no",
            "ram-timings": "6-6-6-18",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "SK Hynix (former Hyundai Electronics)",
            "model": "HYMP112U64CP8-S6",
            "sn": "8225",
            "frequency-hertz": 800000000,
            "capacity-byte": 1073741824,
            "ram-type": "ddr2",
            "ram-ecc": "no",
            "ram-timings": "6-6-6-18",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "non ECC/R469-R470-R471-R472.txt"))

    assert output == expect
示例#7
0
def test_ram():
    expect = [
        {
            "type": "ram",
            "working": "yes",
            "brand": "Kingston",
            "sn": "2972574626",
            "frequency-hertz": 533000000,
            "capacity-byte": 536870912,
            "ram-type": "ddr2",
            "ram-ecc": "no",
            "ram-timings": "5-4-4-12",
        }
    ]
    output = read_decode_dimms.parse_decode_dimms(read_file(filedir, "dimms.txt"))

    assert output == expect
示例#8
0
def test_ram():
    expect = [{
        "type": "ram",
        "working": "yes",
        "brand": "Kingston",
        "model": "KD6502-ELG",
        "sn": "3072778780",
        "frequency-hertz": 667000000,
        "capacity-byte": 1073741824,
        "ram-type": "ddr2",
        "ram-ecc": "yes",
        "ram-timings": "5-5-5-15",
    }]
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "dimms.txt"))

    assert output == expect
示例#9
0
def test_ram():
    expect = [
        {
            "type": "ram",
            "working": "yes",
            "brand": "Synertek",
            "ram-ecc": "no",
        },
        {
            "type": "ram",
            "working": "yes",
            "brand": "Synertek",
            "ram-ecc": "no",
        },
    ]
    output = read_decode_dimms.parse_decode_dimms(read_file(filedir, "dimms.txt"))

    assert len(output) == 2, "2 RAM modules are found"
    assert output == expect
示例#10
0
def test_ram():
    output = read_decode_dimms.parse_decode_dimms(
        read_file(filedir, "dimms.txt"))

    assert len(output) == 0
示例#11
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