コード例 #1
0
def bootstrap_tests(options):
    """
    Bootstrap process (download the appropriate JeOS file to data dir).

    This function will check whether the JeOS is in the right location of the
    data dir, if not, it will download it non interactively.

    @param options: OptParse object with program command line options.
    """
    test_dir = os.path.dirname(sys.modules[__name__].__file__)

    if options.type:
        test_dir = os.path.abspath(
            os.path.join(os.path.dirname(test_dir), options.type))
    elif options.config:
        test_dir = os.path.dirname(os.path.dirname(options.config))
        test_dir = os.path.abspath(test_dir)

    check_modules = [
        "kvm", "kvm-%s" % utils_misc.get_cpu_vendor(verbose=False)
    ]
    online_docs_url = "https://github.com/autotest/virt-test/wiki"

    kwargs = {
        'test_name': options.type,
        'test_dir': test_dir,
        'base_dir': data_dir.get_data_dir(),
        'default_userspace_paths': None,
        'check_modules': check_modules,
        'online_docs_url': online_docs_url,
        'restore_image': options.restore,
        'interactive': False
    }

    # Tolerance we have without printing a message for the user to wait (3 s)
    tolerance = 3
    failed = False
    wait_message_printed = False

    bg = utils.InterruptedThread(bootstrap.bootstrap, kwargs=kwargs)
    t_begin = time.time()
    bg.start()

    while bg.isAlive():
        t_elapsed = time.time() - t_begin
        if t_elapsed > tolerance and not wait_message_printed:
            print_stdout("Running setup. Please wait...")
            wait_message_printed = True
            sys.stdout.switch()
        time.sleep(0.1)

    if wait_message_printed:
        sys.stdout.switch()

    reason = None
    try:
        bg.join()
    except Exception, e:
        failed = True
        reason = e
コード例 #2
0
ファイル: standalone_test.py プロジェクト: vi-patel/virt-test
def bootstrap_tests(options):
    """
    Bootstrap process (download the appropriate JeOS file to data dir).

    This function will check whether the JeOS is in the right location of the
    data dir, if not, it will download it non interactively.

    @param options: OptParse object with program command line options.
    """
    test_dir = os.path.dirname(sys.modules[__name__].__file__)

    if options.type:
        test_dir = os.path.abspath(os.path.join(os.path.dirname(test_dir), options.type))
    elif options.config:
        test_dir = os.path.dirname(os.path.dirname(options.config))
        test_dir = os.path.abspath(test_dir)

    if options.type == "qemu":
        check_modules = ["kvm", "kvm-%s" % utils_misc.get_cpu_vendor(verbose=False)]
    else:
        check_modules = None
    online_docs_url = "https://github.com/autotest/virt-test/wiki"

    kwargs = {
        "test_name": options.type,
        "test_dir": test_dir,
        "base_dir": data_dir.get_data_dir(),
        "default_userspace_paths": None,
        "check_modules": check_modules,
        "online_docs_url": online_docs_url,
        "restore_image": options.restore,
        "interactive": False,
    }

    # Tolerance we have without printing a message for the user to wait (3 s)
    tolerance = 3
    failed = False
    wait_message_printed = False

    bg = utils.InterruptedThread(bootstrap.bootstrap, kwargs=kwargs)
    t_begin = time.time()
    bg.start()

    while bg.isAlive():
        t_elapsed = time.time() - t_begin
        if t_elapsed > tolerance and not wait_message_printed:
            print_stdout("Running setup. Please wait...")
            wait_message_printed = True
            sys.stdout.switch()
        time.sleep(0.1)

    if wait_message_printed:
        sys.stdout.switch()

    reason = None
    try:
        bg.join()
    except Exception, e:
        failed = True
        reason = e
コード例 #3
0
    def test_cpu_vendor_intel(self):
        cpu_info = """processor : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
"""
        vendor = utils_misc.get_cpu_vendor(cpu_info, False)
        self.assertEqual(vendor, 'GenuineIntel')
コード例 #4
0
    def test_cpu_vendor_amd(self):
        cpu_info = """processor : 3
vendor_id       : AuthenticAMD
cpu family      : 21
model           : 16
model name      : AMD A10-5800K APU with Radeon(tm) HD Graphics
"""
        vendor = utils_misc.get_cpu_vendor(cpu_info, False)
        self.assertEqual(vendor, 'AuthenticAMD')
コード例 #5
0
    def test_cpu_vendor_intel(self):
        cpu_info = """processor : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
"""
        vendor = utils_misc.get_cpu_vendor(cpu_info, False)
        self.assertEqual(vendor, 'GenuineIntel')
コード例 #6
0
    def test_cpu_vendor_amd(self):
        cpu_info = """processor : 3
vendor_id       : AuthenticAMD
cpu family      : 21
model           : 16
model name      : AMD A10-5800K APU with Radeon(tm) HD Graphics
"""
        vendor = utils_misc.get_cpu_vendor(cpu_info, False)
        self.assertEqual(vendor, 'AuthenticAMD')
コード例 #7
0
 def test_cpu_vendor_intel(self):
     flags = ['fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce',
              'cx8', 'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov',
              'pat', 'pse36', 'clflush', 'dts', 'acpi', 'mmx', 'fxsr',
              'sse', 'sse2', 'ss', 'ht', 'tm', 'pbe', 'syscall', 'nx',
              'lm', 'constant_tsc', 'arch_perfmon', 'pebs', 'bts',
              'rep_good', 'aperfmperf', 'pni', 'dtes64', 'monitor',
              'ds_cpl', 'vmx', 'smx', 'est', 'tm2', 'ssse3', 'cx16',
              'xtpr', 'pdcm', 'sse4_1', 'xsave', 'lahf_lm', 'ida',
              'tpr_shadow', 'vnmi', 'flexpriority']
     vendor = utils_misc.get_cpu_vendor(flags, False)
     self.assertEqual(vendor, 'intel')
コード例 #8
0
ファイル: base_installer.py プロジェクト: vi-patel/virt-test
    def __init__(self, mode, name, test=None, params=None):
        """
        If no previous install test ran, try to figure out modules to load.

        @param mode (str): Install mode (yum, git, etc).
        @param name (str): Installer name.
        @param test: Virt test object.
        @param params: Dict with test params.
        """
        if params["vm_type"] == "kvm":
            params["module_list"] = "kvm kvm-%s" % utils_misc.get_cpu_vendor(verbose=False)
        super(NoopInstaller, self).__init__(mode, name, test, params)
コード例 #9
0
 def test_cpu_vendor_intel(self):
     flags = [
         'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8',
         'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse36',
         'clflush', 'dts', 'acpi', 'mmx', 'fxsr', 'sse', 'sse2', 'ss', 'ht',
         'tm', 'pbe', 'syscall', 'nx', 'lm', 'constant_tsc', 'arch_perfmon',
         'pebs', 'bts', 'rep_good', 'aperfmperf', 'pni', 'dtes64',
         'monitor', 'ds_cpl', 'vmx', 'smx', 'est', 'tm2', 'ssse3', 'cx16',
         'xtpr', 'pdcm', 'sse4_1', 'xsave', 'lahf_lm', 'ida', 'tpr_shadow',
         'vnmi', 'flexpriority'
     ]
     vendor = utils_misc.get_cpu_vendor(flags, False)
     self.assertEqual(vendor, 'intel')
コード例 #10
0
    def __init__(self, mode, name, test=None, params=None):
        '''
        If no previous install test ran, try to figure out modules to load.

        @param mode (str): Install mode (yum, git, etc).
        @param name (str): Installer name.
        @param test: Virt test object.
        @param params: Dict with test params.
        '''
        if params['vm_type'] == 'kvm':
            params['module_list'] = ("kvm kvm-%s" %
                                     utils_misc.get_cpu_vendor(verbose=False))
        super(NoopInstaller, self).__init__(mode, name, test, params)
コード例 #11
0
 def test_cpu_vendor_amd(self):
     flags = [
         'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8',
         'apic', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse36', 'clflush',
         'mmx', 'fxsr', 'sse', 'sse2', 'ht', 'syscall', 'nx', 'mmxext',
         'fxsr_opt', 'pdpe1gb', 'rdtscp', 'lm', '3dnowext', '3dnow',
         'constant_tsc', 'rep_good', 'nonstop_tsc', 'extd_apicid',
         'aperfmperf', 'pni', 'monitor', 'cx16', 'popcnt', 'lahf_lm',
         'cmp_legacy', 'svm', 'extapic', 'cr8_legacy', 'abm', 'sse4a',
         'misalignsse', '3dnowprefetch', 'osvw', 'ibs', 'skinit', 'wdt',
         'cpb', 'npt', 'lbrv', 'svm_lock', 'nrip_save'
     ]
     vendor = utils_misc.get_cpu_vendor(flags, False)
     self.assertEqual(vendor, 'amd')
コード例 #12
0
 def test_cpu_vendor_amd(self):
     flags = ['fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce',
              'cx8', 'apic', 'mtrr', 'pge', 'mca', 'cmov', 'pat',
              'pse36', 'clflush', 'mmx', 'fxsr', 'sse', 'sse2',
              'ht', 'syscall', 'nx', 'mmxext', 'fxsr_opt', 'pdpe1gb',
              'rdtscp', 'lm', '3dnowext', '3dnow', 'constant_tsc',
              'rep_good', 'nonstop_tsc', 'extd_apicid', 'aperfmperf',
              'pni', 'monitor', 'cx16', 'popcnt', 'lahf_lm',
              'cmp_legacy', 'svm', 'extapic', 'cr8_legacy', 'abm',
              'sse4a', 'misalignsse', '3dnowprefetch', 'osvw', 'ibs',
              'skinit', 'wdt', 'cpb', 'npt', 'lbrv', 'svm_lock',
              'nrip_save']
     vendor = utils_misc.get_cpu_vendor(flags, False)
     self.assertEqual(vendor, 'amd')
コード例 #13
0
 def test_vendor_unknown(self):
     flags = ['non', 'sense', 'flags']
     vendor = utils_misc.get_cpu_vendor(flags, False)
     self.assertEqual(vendor, 'unknown')
コード例 #14
0
ファイル: standalone_test.py プロジェクト: bonzini/virt-test
def bootstrap_tests(options):
    """
    Bootstrap process (download the appropriate JeOS file to data dir).

    This function will check whether the JeOS is in the right location of the
    data dir, if not, it will download it non interactively.

    @param options: OptParse object with program command line options.
    """
    test_dir = os.path.dirname(sys.modules[__name__].__file__)

    if options.type:
        test_dir = os.path.abspath(os.path.join(os.path.dirname(test_dir),
                                                options.type))
    elif options.config:
        parent_config_dir = os.path.dirname(os.path.dirname(options.config))
        parent_config_dir = os.path.dirname(parent_config_dir)
        options.type = parent_config_dir
        test_dir = os.path.abspath(parent_config_dir)

    if options.type == 'qemu':
        check_modules = ["kvm",
                         "kvm-%s" % utils_misc.get_cpu_vendor(verbose=False)]
    else:
        check_modules = None
    online_docs_url = "https://github.com/autotest/virt-test/wiki"

    kwargs = {'test_name': options.type,
              'test_dir': test_dir,
              'base_dir': data_dir.get_data_dir(),
              'default_userspace_paths': None,
              'check_modules': check_modules,
              'online_docs_url': online_docs_url,
              'restore_image': options.restore,
              'interactive': False}

    # Tolerance we have without printing a message for the user to wait (3 s)
    tolerance = 3
    failed = False
    wait_message_printed = False

    bg = utils.InterruptedThread(bootstrap.bootstrap, kwargs=kwargs)
    t_begin = time.time()
    bg.start()

    while bg.isAlive():
        t_elapsed = time.time() - t_begin
        if t_elapsed > tolerance and not wait_message_printed:
            print_stdout("Running setup. Please wait...")
            wait_message_printed = True
            # if bootstrap takes too long, we temporarily make stdout verbose
            # again, so the user can see what's taking so long
            sys.stdout.restore()
        time.sleep(0.1)

    # in case stdout was restored above, redirect it again
    sys.stdout.redirect()

    reason = None
    try:
        bg.join()
    except Exception, e:
        failed = True
        reason = e
コード例 #15
0
 def test_vendor_unknown(self):
     cpu_info = "this is an unknown cpu"
     vendor = utils_misc.get_cpu_vendor(cpu_info, False)
     self.assertEqual(vendor, 'unknown')
コード例 #16
0
 def test_vendor_unknown(self):
     cpu_info = "this is an unknown cpu"
     vendor = utils_misc.get_cpu_vendor(cpu_info, False)
     self.assertEqual(vendor, 'unknown')
コード例 #17
0
 def test_vendor_unknown(self):
     flags = ['non', 'sense', 'flags']
     vendor = utils_misc.get_cpu_vendor(flags, False)
     self.assertEqual(vendor, 'unknown')