Exemplo n.º 1
0
def run_bg_test(test, params, vm, sender="both"):
    """
    Run serial data transfer backgroud test.

    :return: return the background case thread if it's successful;
             else raise error.
    """

    # import driver_in_use in this function to avoid circular imports
    from qemu.tests import driver_in_use

    error_context.context("Run serial transfer test in background",
                          logging.info)
    stress_thread = utils_misc.InterruptedThread(
        virtio_serial_file_transfer.transfer_data, (params, vm),
        {"sender": sender})
    stress_thread.daemon = True
    stress_thread.start()

    check_bg_timeout = float(params.get('check_bg_timeout', 120))
    if not utils_misc.wait_for(
            lambda: driver_in_use.check_bg_running(vm, params),
            check_bg_timeout, 0, 1):
        test.fail("Backgroud test is not alive!")
    return stress_thread
 def run_bg_test():
     """
     Set the operation of transferring data as background
     :return: return the background case thread if it's successful;
              else raise error
     """
     stress_thread = utils_misc.InterruptedThread(run_serial_data_transfer)
     stress_thread.start()
     if not utils_misc.wait_for(
             lambda: driver_in_use.check_bg_running(vm, params),
             check_bg_timeout, 0, 1):
         test.fail("Backgroud test is not alive!")
     return stress_thread