Пример #1
0
    def test_get_sub_process_klass(self):
        runtime.GDB_RUN_BINARY_NAMES_EXPR = []
        self.assertIs(process.get_sub_process_klass('/bin/true'),
                      process.SubProcess)

        runtime.GDB_RUN_BINARY_NAMES_EXPR.append('/bin/false')
        self.assertIs(process.get_sub_process_klass('/bin/false'),
                      process.GDBSubProcess)
        self.assertIs(process.get_sub_process_klass('false'),
                      process.GDBSubProcess)
        self.assertIs(process.get_sub_process_klass('true'),
                      process.SubProcess)
Пример #2
0
    def test_get_sub_process_klass(self):
        gdb.GDB_RUN_BINARY_NAMES_EXPR = []
        self.assertIs(process.get_sub_process_klass('/bin/true'),
                      process.SubProcess)

        gdb.GDB_RUN_BINARY_NAMES_EXPR.append('/bin/false')
        self.assertIs(process.get_sub_process_klass('/bin/false'),
                      process.GDBSubProcess)
        self.assertIs(process.get_sub_process_klass('false'),
                      process.GDBSubProcess)
        self.assertIs(process.get_sub_process_klass('true'),
                      process.SubProcess)
Пример #3
0
    def test_get_sub_process_klass(self):
        gdb.GDB_RUN_BINARY_NAMES_EXPR = []
        self.assertIs(process.get_sub_process_klass(FICTIONAL_CMD),
                      process.SubProcess)

        gdb.GDB_RUN_BINARY_NAMES_EXPR.append('/bin/false')
        self.assertIs(process.get_sub_process_klass('/bin/false'),
                      process.GDBSubProcess)
        self.assertIs(process.get_sub_process_klass('false'),
                      process.GDBSubProcess)
        self.assertIs(process.get_sub_process_klass(FICTIONAL_CMD),
                      process.SubProcess)
Пример #4
0
    def one_disk_chunk(self, disk, chunk):
        """
        Tests one part of the disk by spawning a disktest instance.
        :param disk: Directory (usually a mountpoint).
        :param chunk: Portion of the disk used.
        """
        cmd = ("%s/disktest -m %d -f %s/testfile.%d -i -S >>%s 2>&1" %
               (self.srcdir, self.chunk_mb, disk, chunk, self.disk_log))

        proc = process.get_sub_process_klass(cmd)(cmd, shell=True,
                                                  verbose=False)
        pid = proc.start()
        return pid, proc
Пример #5
0
 def fs_write(self):
     """
      Write out 'streams' files in parallel background task.
     """
     for i in range(self.streams):
         s_file = os.path.join(self.workdir, 'poo%d' % (i + 1))
         cmd = 'dd if=/dev/zero of=%s bs=4k count=%d' % \
             (s_file, self.blocks_per_file)
         for option in self.fs_dd_woptions.split():
             cmd += " %s=%s" % (option.split(":")[0], option.split(":")[1])
         # Wait for everyone to complete
         proc = process.get_sub_process_klass(cmd)(cmd + ' > /dev/null',
                                                   shell=True)
         proc.start()
         proc.poll()
         proc.wait()
     sys.stdout.flush()
     sys.stderr.flush()
Пример #6
0
 def fs_write(self):
     """
      Write out 'streams' files in parallel background task.
     """
     for i in range(self.streams):
         s_file = os.path.join(self.workdir, 'poo%d' % (i + 1))
         cmd = 'dd if=/dev/zero of=%s bs=4k count=%d' % \
             (s_file, self.blocks_per_file)
         for option in self.fs_dd_woptions.split():
             cmd += " %s=%s" % (option.split(":")[0],
                                option.split(":")[1])
         # Wait for everyone to complete
         proc = process.get_sub_process_klass(cmd)(cmd + ' > /dev/null',
                                                   shell=True)
         proc.start()
         proc.poll()
         proc.wait()
     sys.stdout.flush()
     sys.stderr.flush()
Пример #7
0
 def fs_read(self):
     """
     Read in 'streams' files in parallel background tasks.
     """
     for i in range(self.streams):
         s_file = os.path.join(self.srcdir, 'poo%d' % (i + 1))
         cmd = 'dd if=%s of=/dev/null bs=4k count=%d' % \
             (s_file, self.blocks_per_file)
         for option in self.fs_dd_roptions.split():
             cmd += " %s=%s" % (option.split(":")[0], option.split(":")[1])
         if self.seq_read:
             process.run(cmd + ' > /dev/null', shell=True)
         else:
             # Wait for everyone to complete
             proc = process.get_sub_process_klass(cmd)(cmd + ' > /dev/null',
                                                       shell=True)
             proc.start()
             proc.poll()
             proc.wait()
         sys.stdout.flush()
 def fs_read(self):
     """
     Read in 'streams' files in parallel background tasks.
     """
     for i in range(self.streams):
         s_file = os.path.join(self.srcdir, 'poo%d' % (i + 1))
         cmd = 'dd if=%s of=/dev/null bs=4k count=%d' % \
             (s_file, self.blocks_per_file)
         for option in self.fs_dd_roptions.split():
             cmd += " %s=%s" % (option.split(":")[0],
                                option.split(":")[1])
         if self.seq_read:
             process.run(cmd + ' > /dev/null', shell=True)
         else:
             # Wait for everyone to complete
             proc = process.get_sub_process_klass(cmd)(cmd + ' > /dev/null',
                                                       shell=True)
             proc.start()
             proc.poll()
             proc.wait()
         sys.stdout.flush()
Пример #9
0
def run(vt_test, test_params, env):
    """Tests for SPICE listening sockets.

    Parameters
    ----------
    vt_test : avocado.core.plugins.vt.VirtTest
        QEMU test object.
    test_params : virttest.utils_params.Params
        Dictionary with the test parameters.
    env : virttest.utils_env.Env
        Dictionary with test environment.
    """
    # See
    # https://www.redhat.com/archives/avocado-devel/2017-January/msg00012.html
    vmname = test_params['main_vm']
    if test_params['start_vm'] == "no":
        test_params['start_vm'] = "yes"
        nc_process_pid = None
        if test_params['spice_port_closed'] == "yes":
            cmd = "nc -l %s" % test_params['spice_port']
            nc_process_cl = process.get_sub_process_klass(cmd)
            nc_process = nc_process_cl(cmd)
            nc_process_pid = nc_process.start()
        error.context("Start guest VM with invalid parameters.")
        try:
            env_process.preprocess_vm(vt_test, test_params, env, vmname)
        except virt_vm.VMCreateError, emsg:
            error_s = test_params['error_msg']
            if '%s,%s' in error_s:
                s_port = env.get_vm(vmname).spice_port
                error_s = error_s % (test_params['spice_addr'], s_port)
            if error_s in emsg.output and emsg.status == 1:
                logging.info("Guest terminated as expected: %s", emsg.output)
                return
            else:
                raise error.TestFail("Guest creation failed, bad error"
                                     "message: %s and/or exit status: %s" %
                                     (emsg.output, emsg.status))
        finally: