1AUTHOR = """
2uril@redhat.com (Uri Lublin)
3drusso@redhat.com (Dror Russo)
4mgoldish@redhat.com (Michael Goldish)
5dhuff@redhat.com (David Huff)
6aeromenk@redhat.com (Alexey Eromenko)
7mburns@redhat.com (Mike Burns)
8"""
9TIME = 'MEDIUM'
10NAME = 'KVM test'
11TEST_TYPE = 'client'
12TEST_CLASS = 'Virtualization'
13TEST_CATEGORY = 'Functional'
14
15DOC = """
16Executes the KVM test framework on a given host. This module is separated in
17minor functions, that execute different tests for doing Quality Assurance on
18KVM (both kernelspace and userspace) code.
19
20For online docs, please refer to http://www.linux-kvm.org/page/KVM-Autotest
21"""
22
23import sys, os, logging
24from autotest_lib.client.common_lib import cartesian_config
25from autotest_lib.client.virt import virt_utils
26
27# set English environment (command output might be localized, need to be safe)
28os.environ['LANG'] = 'en_US.UTF-8'
29
30str = """
31# This string will be parsed after build.cfg.  Make any desired changes to the
32# build configuration here.  For example:
33#release_tag = 84
34"""
35
36parser = cartesian_config.Parser()
37kvm_test_dir = os.path.join(os.environ['AUTODIR'],'tests/kvm')
38parser.parse_file(os.path.join(kvm_test_dir, "build.cfg"))
39parser.parse_string(str)
40if not virt_utils.run_tests(parser, job):
41    logging.error("KVM build step failed, exiting.")
42    sys.exit(1)
43
44str = """
45# This string will be parsed after tests.cfg.  Make any desired changes to the
46# test configuration here.  For example:
47#display = sdl
48#install, setup: timeout_multiplier = 3
49"""
50
51parser = cartesian_config.Parser()
52parser.parse_file(os.path.join(kvm_test_dir, "tests.cfg"))
53
54if args:
55    # We get test parameters from command line
56    for arg in args:
57        try:
58            (key, value) = re.findall("^(\w+)=(.*)", arg)[0]
59            if key == "only":
60                str += "only %s\n" % value
61            elif key == "no":
62                str += "no %s\n" % value
63            else:
64                str += "%s = %s\n" % (key, value)
65        except IndexError:
66            pass
67parser.parse_string(str)
68
69virt_utils.run_tests(parser, job)
70