Exemple #1
0
    def __init__(self, vm, steps_filename, tempdir, params):
        virt_step_editor.StepMakerWindow.__init__(self)

        self.vm = vm
        self.steps_filename = steps_filename
        self.steps_data_dir = ppm_utils.get_data_dir(steps_filename)
        self.tempdir = tempdir
        self.screendump_filename = os.path.join(tempdir, "scrdump.ppm")
        self.params = params

        if not os.path.exists(self.steps_data_dir):
            os.makedirs(self.steps_data_dir)

        self.steps_file = open(self.steps_filename, "w")
        self.vars_file = open(os.path.join(self.steps_data_dir, "vars"), "w")

        self.step_num = 1
        self.run_time = 0
        self.update_delay = 1000
        self.prev_x = 0
        self.prev_y = 0
        self.vars = {}
        self.timer_id = None

        self.time_when_done_clicked = time.time()
        self.time_when_actions_completed = time.time()

        self.steps_file.write("# Generated by Step Maker\n")
        self.steps_file.write("# Generated on %s\n" % time.asctime())
        self.steps_file.write("# uname -a: %s\n" %
                              commands.getoutput("uname -a"))
        self.steps_file.flush()

        self.vars_file.write("# This file lists the vars used during recording"
                             " with Step Maker\n")
        self.vars_file.flush()

        # Done/Break HBox
        hbox = gtk.HBox(spacing=10)
        self.user_vbox.pack_start(hbox)
        hbox.show()

        self.button_break = gtk.Button("Break")
        self.button_break.connect("clicked", self.event_break_clicked)
        hbox.pack_start(self.button_break)
        self.button_break.show()

        self.button_done = gtk.Button("Done")
        self.button_done.connect("clicked", self.event_done_clicked)
        hbox.pack_start(self.button_done)
        self.button_done.show()

        # Set window title
        self.window.set_title("Step Maker")

        # Connect "capture" button
        self.button_capture.connect("clicked", self.event_capture_clicked)

        # Switch to run mode
        self.switch_to_run_mode()
Exemple #2
0
    def __init__(self, vm, steps_filename, tempdir, params):
        virt_step_editor.StepMakerWindow.__init__(self)

        self.vm = vm
        self.steps_filename = steps_filename
        self.steps_data_dir = ppm_utils.get_data_dir(steps_filename)
        self.tempdir = tempdir
        self.screendump_filename = os.path.join(tempdir, "scrdump.ppm")
        self.params = params

        if not os.path.exists(self.steps_data_dir):
            os.makedirs(self.steps_data_dir)

        self.steps_file = open(self.steps_filename, "w")
        self.vars_file = open(os.path.join(self.steps_data_dir, "vars"), "w")

        self.step_num = 1
        self.run_time = 0
        self.update_delay = 1000
        self.prev_x = 0
        self.prev_y = 0
        self.vars = {}
        self.timer_id = None

        self.time_when_done_clicked = time.time()
        self.time_when_actions_completed = time.time()

        self.steps_file.write("# Generated by Step Maker\n")
        self.steps_file.write("# Generated on %s\n" % time.asctime())
        self.steps_file.write("# uname -a: %s\n" %
                              commands.getoutput("uname -a"))
        self.steps_file.flush()

        self.vars_file.write("# This file lists the vars used during recording"
                             " with Step Maker\n")
        self.vars_file.flush()

        # Done/Break HBox
        hbox = gtk.HBox(spacing=10)
        self.user_vbox.pack_start(hbox)
        hbox.show()

        self.button_break = gtk.Button("Break")
        self.button_break.connect("clicked", self.event_break_clicked)
        hbox.pack_start(self.button_break)
        self.button_break.show()

        self.button_done = gtk.Button("Done")
        self.button_done.connect("clicked", self.event_done_clicked)
        hbox.pack_start(self.button_done)
        self.button_done.show()

        # Set window title
        self.window.set_title("Step Maker")

        # Connect "capture" button
        self.button_capture.connect("clicked", self.event_capture_clicked)

        # Switch to run mode
        self.switch_to_run_mode()
Exemple #3
0
def run_steps(test, params, env):
    vm = env.get_vm(params.get("main_vm"))
    if not vm:
        raise error.TestError("VM object not found in environment")
    if not vm.is_alive():
        e_msg = "VM seems to be dead. Guestwizard requires a living VM"
        raise error.TestError(e_msg)

    steps_filename = params.get("steps")
    if not steps_filename:
        raise error.TestError("Steps filename not specified")
    steps_filename = virt_utils.get_path(test.bindir, steps_filename)
    if not os.path.exists(steps_filename):
        raise error.TestError("Steps file not found: %s" % steps_filename)

    sf = open(steps_filename, "r")
    lines = sf.readlines()
    sf.close()

    vm.monitor.cmd("cont")

    current_step_num = 0
    current_screendump = None
    skip_current_step = False

    # Iterate over the lines in the file
    for line in lines:
        line = line.strip()
        if not line:
            continue
        logging.info(line)

        if line.startswith("#"):
            continue

        words = line.split()
        if words[0] == "step":
            current_step_num += 1
            current_screendump = None
            skip_current_step = False
        elif words[0] == "screendump":
            current_screendump = words[1]
        elif skip_current_step:
            continue
        elif words[0] == "sleep":
            timeout_multiplier = float(params.get("timeout_multiplier") or 1)
            time.sleep(float(words[1]) * timeout_multiplier)
        elif words[0] == "key":
            vm.send_key(words[1])
        elif words[0] == "var":
            if not handle_var(vm, params, words[1]):
                logging.error("Variable not defined: %s", words[1])
        elif words[0] == "barrier_2":
            if current_screendump:
                scrdump_filename = os.path.join(
                    ppm_utils.get_data_dir(steps_filename),
                    current_screendump)
            else:
                scrdump_filename = None
            if not barrier_2(vm, words, params, test.debugdir,
                             scrdump_filename, current_step_num):
                skip_current_step = True
        else:
            vm.send_key(words[0])
Exemple #4
0
def run_steps(test, params, env):
    vm = env.get_vm(params.get("main_vm"))
    if not vm:
        raise error.TestError("VM object not found in environment")
    if not vm.is_alive():
        e_msg = "VM seems to be dead. Guestwizard requires a living VM"
        raise error.TestError(e_msg)

    steps_filename = params.get("steps")
    if not steps_filename:
        raise error.TestError("Steps filename not specified")
    steps_filename = virt_utils.get_path(test.bindir, steps_filename)
    if not os.path.exists(steps_filename):
        raise error.TestError("Steps file not found: %s" % steps_filename)

    sf = open(steps_filename, "r")
    lines = sf.readlines()
    sf.close()

    vm.monitor.cmd("cont")

    current_step_num = 0
    current_screendump = None
    skip_current_step = False

    # Iterate over the lines in the file
    for line in lines:
        line = line.strip()
        if not line:
            continue
        logging.info(line)

        if line.startswith("#"):
            continue

        words = line.split()
        if words[0] == "step":
            current_step_num += 1
            current_screendump = None
            skip_current_step = False
        elif words[0] == "screendump":
            current_screendump = words[1]
        elif skip_current_step:
            continue
        elif words[0] == "sleep":
            timeout_multiplier = float(params.get("timeout_multiplier") or 1)
            time.sleep(float(words[1]) * timeout_multiplier)
        elif words[0] == "key":
            vm.send_key(words[1])
        elif words[0] == "var":
            if not handle_var(vm, params, words[1]):
                logging.error("Variable not defined: %s", words[1])
        elif words[0] == "barrier_2":
            if current_screendump:
                scrdump_filename = os.path.join(
                    ppm_utils.get_data_dir(steps_filename),
                    current_screendump)
            else:
                scrdump_filename = None
            if not barrier_2(vm, words, params, test.debugdir,
                             scrdump_filename, current_step_num):
                skip_current_step = True
        else:
            vm.send_key(words[0])