예제 #1
0
파일: vt.py 프로젝트: EIChaoYang/avocado-vt
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        loader.register_plugin(VirtTestLoader)
예제 #2
0
파일: vt.py 프로젝트: uyvan/avocado-vt
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        loader.register_plugin(VirtTestLoader)
예제 #3
0
    def run(self, args):
        """
        Take care of command line overwriting, parameter preparation,
        setup and cleanup chains, and paths/utilities for all host controls.
        """
        if getattr(args, "reference", None):
            # graph generated tests are not 1-to-1 mapped to test references which is the
            # original invocation notion but N-to-1 and generated from just one test reference
            assert len(
                args.reference
            ) == 1, "Cartesian graph run supports maximally one test reference"
            # test references (here called test restrictions) are mixed with run (overwrite) parameters
            args.params = args.reference[0].split()
        elif not getattr(args, "params", None):
            args.params = []
        cmd_parser.params_from_cmd(args)

        loader.register_plugin(CartesianLoader)
        if getattr(args, "auto", None) and args.auto:
            args.test_runner = CartesianRunner
예제 #4
0
    def run(self, config):
        """
        Take care of command line overwriting, parameter preparation,
        setup and cleanup chains, and paths/utilities for all host controls.
        """
        if config.get("run.references") or config.get("list.references"):
            refs = config.get("run.references") if config.get(
                "run.references") else config.get("list.references")
            # graph generated tests are not 1-to-1 mapped to test references which is the
            # original invocation notion but N-to-1 and generated from just one test reference
            assert len(
                refs
            ) == 1, "Cartesian graph run supports maximally one test reference"
            # test references (here called test restrictions) are mixed with run (overwrite) parameters
            config["params"] = refs[0].split()
        elif not config.get("params"):
            config["params"] = []
        cmd_parser.params_from_cmd(config)

        loader.register_plugin(CartesianLoader)
        if config.get("auto") and config["auto"]:
            config["run.test_runner"] = "traverser"
예제 #5
0
 def run(self, args):
     loader.register_plugin(VirtTestLoader)
예제 #6
0
 def run(self, config):
     loader.register_plugin(VirtTestLoader)
예제 #7
0
 def run(self, args):
     loader.register_plugin(VirtTestLoader)
예제 #8
0
        def initialize(self):
            if not is_registering_settings_required():
                return

            # [vt] section
            section = 'vt'

            help_msg = ('Explicitly choose a cartesian config. When choosing '
                        'this, some options will be ignored (see options '
                        'below)')
            settings.register_option(section, key='config', default=None,
                                     help_msg=help_msg)

            help_msg = 'Save the resulting cartesian config to a file'
            settings.register_option(section, key='save_config', default=None,
                                     help_msg=help_msg)

            help_msg = ("Choose test type (%s). Default: %%(default)s" %
                        ", ".join(SUPPORTED_TEST_TYPES))
            settings.register_option(section, key='type',
                                     default=SUPPORTED_TEST_TYPES[0],
                                     help_msg=help_msg)

            help_msg = ("Select the guest OS to be used. If --vt-config is "
                        "provided, this will be ignored. Default: %s" %
                        DEFAULT_GUEST_OS)
            settings.register_option(section, key='guest_os',
                                     default=DEFAULT_GUEST_OS,
                                     help_msg=help_msg)

            help_msg = ("List of space separated 'no' filters to be passed to "
                        "the config parser.")
            settings.register_option(section, key='no_filter', default='',
                                     help_msg=help_msg)

            help_msg = ("List of space separated 'only' filters to be passed "
                        "to the config  parser.")
            settings.register_option(section, key='only_filter', default='',
                                     help_msg=help_msg)

            help_msg = "List of 'key=value' pairs passed to cartesian parser."
            settings.register_option(section, key='extra_params', nargs='*',
                                     default=None, help_msg=help_msg)

            help_msg = ("Also list the available guests (this option ignores "
                        "the --vt-config and --vt-guest-os)")
            settings.register_option(section, key='list_guests', key_type=bool,
                                     default=False, help_msg=help_msg)
            help_msg = ("Also list the available arch/machines for the given "
                        "guest OS. (Use \"--vt-guest-os ''\" to see all "
                        "combinations; --vt-config --vt-machine-type and "
                        "--vt-arch args are ignored)")
            settings.register_option(section, key='list_archs', key_type=bool,
                                     default=False, help_msg=help_msg)

            # [vt.setup] section
            section = 'vt.setup'

            help_msg = 'Backup image before testing (if not already backed up)'
            settings.register_option(section, 'backup_image_before_test',
                                     help_msg=help_msg, key_type=bool,
                                     default=True)

            help_msg = 'Restore image after testing (if backup present)'
            settings.register_option(section, 'restore_image_after_test',
                                     help_msg=help_msg, key_type=bool,
                                     default=True)

            help_msg = 'Keep guest running between tests (faster, but unsafe)'
            settings.register_option(section, 'keep_guest_running',
                                     help_msg=help_msg, key_type=bool,
                                     default=False)

            # [vt.common] section
            section = 'vt.common'

            help_msg = ('Data dir path. If none specified, the default '
                        'virt-test data dir will be used')
            settings.register_option(section, 'data_dir',
                                     help_msg=help_msg,
                                     default='')

            help_msg = ('Make the temporary dir path persistent across jobs if'
                        ' needed. By default the data in the temporary '
                        'directory will be wiped after each test in some cases'
                        ' and after each job in others.')
            settings.register_option(section, 'tmp_dir',
                                     help_msg=help_msg,
                                     default='')

            help_msg = ('Enable only type specific tests. Shared tests will '
                        'not be tested')
            settings.register_option(section, 'type_specific_only',
                                     help_msg=help_msg, key_type=bool,
                                     default=False)

            help_msg = ('RAM dedicated to the main VM. Usually defaults to '
                        '1024, as set in "base.cfg", but can be a different '
                        'value depending on the various other configuration '
                        'files such as configuration files under "guest-os" '
                        'and test provider specific files')
            settings.register_option(section, 'mem',
                                     help_msg=help_msg,
                                     default=None)

            help_msg = 'Architecture under test'
            settings.register_option(section, 'arch',
                                     help_msg=help_msg,
                                     default=None)

            help_msg = 'Machine type under test'
            settings.register_option(section, 'machine_type',
                                     help_msg=help_msg,
                                     default=DEFAULT_MACHINE_TYPE)

            help_msg = 'Nettype (bridge, user, none)'
            settings.register_option(section, 'nettype',
                                     help_msg=help_msg,
                                     default='')

            help_msg = 'Bridge name to be used if you select bridge as a nettype'
            settings.register_option(section, 'netdst',
                                     help_msg=help_msg,
                                     default='virbr0')

            # [vt.qemu] section
            section = 'vt.qemu'

            try:
                default_qemu_bin_path = find_default_qemu_paths()[0]
            except (RuntimeError, utils_path.CmdNotFoundError):
                default_qemu_bin_path = None
            qemu_bin = get_settings_value(section, 'qemu_bin', default=None)
            if qemu_bin is None:  # Allow default to be None when not set in setting
                default_qemu_bin = None
            else:
                default_qemu_bin = qemu_bin
            help_msg = 'Path to a custom qemu binary to be tested'
            settings.register_option(section, 'qemu_bin',
                                     help_msg=help_msg,
                                     default=default_qemu_bin)

            help_msg = ('Path to a custom qemu binary to be tested for the '
                        'destination of a migration, overrides qemu_bin for '
                        'that particular purpose')
            settings.register_option(section, 'qemu_dst_bin',
                                     help_msg=help_msg,
                                     default=default_qemu_bin_path)

            help_msg = 'Accelerator used to run qemu (kvm or tcg)'
            settings.register_option(section, 'accel',
                                     help_msg=help_msg,
                                     default='kvm')

            help_msg = ('Whether to enable vhost for qemu (on/off/force). '
                        'Depends on nettype=bridge')
            settings.register_option(section, 'vhost',
                                     help_msg=help_msg,
                                     default='off')

            help_msg = 'Monitor type (human or qmp)'
            settings.register_option(section, 'monitor',
                                     help_msg=help_msg,
                                     default='')

            help_msg = 'Number of virtual cpus to use (1 or 2)'
            settings.register_option(section, 'smp',
                                     help_msg=help_msg,
                                     default='2')

            help_msg = 'Image format type to use (any valid qemu format)'
            settings.register_option(section, 'image_type',
                                     help_msg=help_msg,
                                     default=SUPPORTED_IMAGE_TYPES[0])

            help_msg = 'Guest network card model (any valid qemu card)'
            settings.register_option(section, 'nic_model',
                                     help_msg=help_msg,
                                     default=SUPPORTED_NIC_MODELS[0])

            help_msg = ('Guest disk bus for main image. One of ide, scsi, '
                        'virtio_blk, virtio_scsi, lsi_scsi, ahci, usb2 '
                        'or xenblk. Note: Older qemu versions and/or '
                        'operating systems (such as WinXP) might not support '
                        'virtio_scsi. Please use virtio_blk or ide instead.')
            settings.register_option(section, 'disk_bus',
                                     help_msg=help_msg,
                                     default=SUPPORTED_DISK_BUSES[0])

            help_msg = 'Enable qemu sandboxing (on/off)'
            settings.register_option(section, 'sandbox',
                                     help_msg=help_msg,
                                     default='on')

            help_msg = ('Prevent qemu from loading sysconfdir/qemu.conf '
                        'and sysconfdir/target-ARCH.conf at startup (yes/no)')
            settings.register_option(section, 'defconfig',
                                     help_msg=help_msg,
                                     default='yes')

            help_msg = ('Use MALLOC_PERTURB_ env variable set to 1 to help '
                        'catch memory allocation problems on qemu (yes/no)')
            settings.register_option(section, 'malloc_perturb',
                                     help_msg=help_msg,
                                     default='yes')

            # [vt.libvirt] section
            section = 'vt.libvirt'

            uri_current = get_settings_value(section, 'connect_uri',
                                             default=None)
            help_msg = ('Test connect URI for libvirt (qemu:///system, '
                        'lxc:///)')
            settings.register_option(section, 'connect_uri',
                                     help_msg=help_msg, default=uri_current)

            # [vt.debug] section
            help_msg = ('Do not clean up tmp files or VM processes at the end '
                        'of a virt-test execution')
            settings.register_option('vt.debug', 'no_cleanup',
                                     help_msg=help_msg, key_type=bool,
                                     default=False)

            # [vt.filter] section
            help_msg = ("Allows to selectively skip certain default filters. "
                        "This uses directly 'tests-shared.cfg' and instead of "
                        "'$provider/tests.cfg' and applies following lists of "
                        "default filters, unless they are specified as "
                        "arguments: no_9p_export,no_virtio_rng,"
                        "no_pci_assignable,smallpages,default_bios,ridge,"
                        "image_backend,multihost. This can be used to eg. run "
                        "hugepages tests by filtering 'smallpages' via this "
                        "option.")
            settings.register_option('vt.filter', key='default_filters',
                                     nargs='+', default=None,
                                     help_msg=help_msg)

            # [plugins.vtjoblock] section
            help_msg = 'Directory in which to write the lock file'
            settings.register_option('plugins.vtjoblock', 'dir',
                                     help_msg=help_msg,
                                     default='/tmp')

            virt_loader = getattr(importlib.import_module('avocado_vt.loader'),
                                  'VirtTestLoader')
            loader.register_plugin(virt_loader)