Пример #1
0
def test_search_boot_tests():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    inputs = {
        "boot_folder_name": "zynq-adrv9361-z7035-bob",
        "hdl_hash": "ecd880d44cdd000691283f2edbd31aa52d6ccc3e",
        "linux_hash": "b0cb7c3bfd1fec02b1671b061112cd2551a9b340",
        "hdl_branch": "hdl_2019_r2",
        "linux_branch": "2019_R2",
        "is_hdl_release": True,
        "is_linux_release": True,
        "uboot_reached": True,
        "linux_prompt_reached": True,
        "drivers_enumerated": True,
        "dmesg_warnings_found": False,
        "dmesg_errors_found": False,
        "jenkins_job_date": datetime.datetime.now(),  # "Dec 31, 2020 @ 13:47:04.129",
        "jenkins_build_number": 34,
        "jenkins_project_name": "pyadi-iio-hw",
        "jenkins_agent": "master",
    }

    tel.log_boot_tests(**inputs)
    time.sleep(2)
    inputs["boot_folder_name"] = "zynq-adrv9361-z7035-fmc"
    tel.log_boot_tests(**inputs)
    time.sleep(2)
    tel = telemetry.searches(server=server)
    tel.use_test_index = True
    res = tel.boot_tests(inputs["boot_folder_name"])
    tel.db.delete_index()
    assert len(res) == 2
    assert "zynq-adrv9361-z7035-fmc" in res.keys()
    assert "zynq-adrv9361-z7035-bob" in res.keys()
Пример #2
0
def test_ingest_tx_quad_cal():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_ad9361_tx_quad_cal_test("test1", "pluto", 4, 100, 0)
    time.sleep(2)
    results = tel.db.search_all()
    tel.db.delete_index()
    assert results["hits"]["total"]["value"] == 1
Пример #3
0
def test_ingest_github_stats():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_ad9361_tx_quad_cal_test("TransceiverToolbox", 1, 2, 3, 4)
    time.sleep(2)
    results = tel.db.search_all()
    tel.db.delete_index()
    assert results["hits"]["total"]["value"] == 1
Пример #4
0
def test_log_github_release_stats():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    rd = datetime.datetime.now()
    tel.log_github_release_stats("TransceiverToolbox", "v19.2.1", 1024, rd)
    time.sleep(2)
    results = tel.db.search_all()
    tel.db.delete_index()
    assert results["hits"]["total"]["value"] == 1
Пример #5
0
def test_ingest_lte():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_lte_evm_test("test2", "lte20_tm3.1", "pluto", "pluto", 30720000,
                         30720000, 1000000000, 0.1, 1)
    time.sleep(2)
    results = tel.db.search_all()
    tel.db.delete_index()
    assert results["hits"]["total"]["value"] == 1
Пример #6
0
def test_search_tx_quad_cal_chan1():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_ad9361_tx_quad_cal_test("test1", "pluto", 4, 100, 0)
    time.sleep(2)
    tel = telemetry.searches(server=server)
    tel.use_test_index = True
    x, y, t = tel.ad9361_tx_quad_cal_test(channel=1)
    tel.db.delete_index()
    assert y == []
    assert t == []
    assert x == []
Пример #7
0
def test_ingest_hdl_resources():
    loc = os.path.dirname(__file__)
    loc = os.path.split(loc)[:-1]
    loc = os.path.join(loc[0], "tests", "resource_utilization.csv")

    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_hdl_resources_from_csv(loc)
    time.sleep(2)
    results = tel.db.search_all()
    tel.db.delete_index()
    assert results["hits"]["total"]["value"] == 1
Пример #8
0
def log_boot_logs(server, in_args):
    entry = {
        "boot_folder_name": "NA",
        "hdl_hash": "NA",
        "linux_hash": "NA",
        "boot_partition_hash": "NA",
        "hdl_branch": "NA",
        "linux_branch": "NA",
        "boot_partition_branch": "NA",
        "is_hdl_release": False,
        "is_linux_release": False,
        "is_boot_partition_release": False,
        "uboot_reached": False,
        "linux_prompt_reached": False,
        "drivers_enumerated": 0,
        "drivers_missing": 0,
        "dmesg_warnings_found": 0,
        "dmesg_errors_found": 0,
        "jenkins_job_date": datetime.datetime.now(),
        "jenkins_build_number": 0,
        "jenkins_project_name": 0,
        "jenkins_agent": "NA",
        "pytest_errors": 0,
        "pytest_failures": 0,
        "pytest_skipped": 0,
        "pytest_tests": 0,
        "last_failing_stage": "NA",
        "last_failing_stage_failure": "NA"
    }
    if len(in_args) == 0:
        click.echo("Must have non-zero arguments for database entry")
        sys.exit(1)
    if int(len(in_args) / 2) != len(in_args) / 2:
        click.echo(
            "ERROR: Number of inputs arguments must be even\n" +
            "       and in the form of: entry1<space>value1<space>entry2<space>value2"
        )
        sys.exit(1)
    for i in range(0, len(in_args), 2):
        if in_args[i] in entry:
            if in_args[i + 1].lower() == "true":
                entry[in_args[i]] = True
            elif in_args[i + 1].lower() == "false":
                entry[in_args[i]] = False
            else:
                entry[in_args[i]] = in_args[i + 1]
        else:
            click.echo("ERROR: " + in_args[i] + " not a valid entry")
            sys.exit(1)
    tel = telemetry.ingest(server=server)
    tel.log_boot_tests(**entry)
Пример #9
0
def test_search_github_stats():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_github_stats("TransceiverToolbox", 1, 2, 3, 4)
    time.sleep(2)
    tel = telemetry.searches(server=server)
    tel.use_test_index = True
    stats = tel.github_stats()
    tel.db.delete_index()
    for k in stats:
        assert k == "TransceiverToolbox"
    assert stats["TransceiverToolbox"]["views"] == 1
    assert stats["TransceiverToolbox"]["clones"] == 2
    assert stats["TransceiverToolbox"]["view_unique"] == 3
    assert stats["TransceiverToolbox"]["clones_unique"] == 4
Пример #10
0
def test_search_github_release_stats():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    rd = datetime.datetime.now()
    tel.log_github_release_stats("TransceiverToolbox", "v19.2.1", 1024, rd)
    time.sleep(2)
    tel = telemetry.searches(server=server)
    tel.use_test_index = True
    stats = tel.github_release_stats()
    tel.db.delete_index()

    s = datetime.datetime.strptime(
        stats["TransceiverToolbox"]["release_date"], "%Y-%m-%dT%H:%M:%S.%f"
    )

    for k in stats:
        assert k == "TransceiverToolbox"
    assert stats["TransceiverToolbox"]["tag"] == "v19.2.1"
    assert stats["TransceiverToolbox"]["downloads"] == 1024
    assert s == rd
Пример #11
0
def test_ingest_lte():
    tel = telemetry.ingest(server=server)
    tel.use_test_index = True
    tel.log_lte_evm_test(
        "AD9361",
        -10,
        "slow_attack",
        1e9,
        "TM 3.1",
        "5 MHz",
        0.1,
        0.2,
        0.3,
        0.4,
        0.5,
        0.6,
        0.7,
        0.8,
    )
    time.sleep(2)
    results = tel.db.search_all()
    tel.db.delete_index()
    assert results["hits"]["total"]["value"] == 1
Пример #12
0
def log_hdl_resources_from_csv(server, filename):
    tel = telemetry.ingest(server=server)
    tel.log_hdl_resources_from_csv(filename)