@@ -0,0 +1,1808 @@
+%22%22%22%0ATests that ensure the boot time to init process is within spec.%0A%22%22%22%0Aimport time%0Aimport pytest%0Aimport re%0Aimport host_tools.logging as log_tools%0A%0AMAX_BOOT_TIME_US = 150000%0A%22%22%22 The maximum acceptable boot time in us. %22%22%22%0A# TODO: Keep a %60current%60 boot time in S3 and validate we don't regress%0A%0A%0A@pytest.mark.timeout(120)%0Adef test_microvm_boottime_no_network(test_microvm_with_boottime):%0A    %22%22%22Check guest boottime of microvm without network.%22%22%22%0A    boottime_us = _test_microvm_boottime(test_microvm_with_boottime, None)%0A    print(%22Boot time with no network is: %22 + str(boottime_us) + %22 us%22)%0A%0A%0Adef test_microvm_boottime_with_network(%0A        test_microvm_with_boottime,%0A        network_config%0A):%0A    %22%22%22Check guest boottime of microvm with network.%22%22%22%0A    boottime_us = _test_microvm_boottime(%0A        test_microvm_with_boottime,%0A        network_config%0A    )%0A    print(%22Boot time with network configured is: %22 + str(boottime_us) + %22 us%22)%0A%0A%0Adef _test_microvm_boottime(%0A        microvm,%0A        net_config%0A):%0A    %22%22%22%0A    Asserts that we meet the minimum boot time. Should use a Microvm with the%0A    %60boottime%60 capability.%0A    %22%22%22%0A%0A    microvm.basic_config(%0A        vcpu_count=2,%0A        mem_size_mib=1024,%0A        net_iface_count=0,%0A        log_enable=False%0A    )%0A    if net_config:%0A        microvm.basic_network_config(net_config)%0A    microvm.logger_config(%22Warning%22, False, False)%0A%0A    microvm.start()%0A    time.sleep(0.4)%0A    lines = log_tools.sequential_fifo_reader(microvm, 0, 20)%0A%0A    TIMESTAMP_LOG_REGEX = r'Guest-boot-time%5C %5C=%5C (%5Cd+)'%0A    boot_time_us = 0%0A    for line in lines:%0A        timestamps = re.findall(TIMESTAMP_LOG_REGEX, line)%0A        if timestamps:%0A            boot_time_us = int(timestamps%5B0%5D)%0A%0A    assert boot_time_us %3E 0%0A    assert boot_time_us %3C MAX_BOOT_TIME_US%0A    return boot_time_us%0A

add guest boot time performance test