1import logging, os, sys, fcntl 2kvm_test_dir = "/usr/local/autotest/client/tests/kvm" 3from autotest_lib.client.common_lib import cartesian_config 4 5def get_control(params, custom_cfg): 6 control = ''' 7import sys, os, logging 8os.environ['LANG'] = 'en_US.UTF-8' 9kvm_test_dir = os.path.join(os.environ['AUTODIR'],'tests', 'kvm') 10sys.path.append(kvm_test_dir) 11from autotest_lib.client.common_lib import cartesian_config 12from autotest_lib.client.virt import virt_utils 13 14kernel_install_params = %s 15custom_cfg = %s 16 17def step_init(): 18 job.next_step([step_test]) 19 virt_utils.install_host_kernel(job, kernel_install_params) 20 21def step_test(): 22 parser = cartesian_config.Parser() 23 parser.parse_file(os.path.join(kvm_test_dir, "redhat.cfg")) 24 for line in custom_cfg: 25 parser.parse_string(line) 26 virt_utils.run_tests(parser, job) 27''' % (params, custom_cfg) 28 return control 29 30def run(machine): 31 parser = cartesian_config.Parser() 32 parser.parse_file(os.path.join(kvm_test_dir, "redhat.cfg")) 33 custom_cfg = $custom_job_cfg 34 for line in custom_cfg: 35 parser.parse_string(line) 36 generator = parser.get_dicts() 37 params = generator.next() 38 host = hosts.create_host(machine) 39 profile = params.get('host_install_profile') 40 timeout = int(params.get('host_install_timeout', 3600)) 41 if profile: 42 host.install(profile=profile, timeout=timeout) 43 at = autotest.Autotest(host) 44 control = get_control(params, custom_cfg) 45 at.run(control) 46 47job.parallel_simple(run, machines) 48