| OLD | NEW |
| 1 AUTHOR = """ | 1 AUTHOR = """ |
| 2 uril@redhat.com (Uri Lublin) | 2 uril@redhat.com (Uri Lublin) |
| 3 drusso@redhat.com (Dror Russo) | 3 drusso@redhat.com (Dror Russo) |
| 4 mgoldish@redhat.com (Michael Goldish) | 4 mgoldish@redhat.com (Michael Goldish) |
| 5 dhuff@redhat.com (David Huff) | 5 dhuff@redhat.com (David Huff) |
| 6 aeromenk@redhat.com (Alexey Eromenko) | 6 aeromenk@redhat.com (Alexey Eromenko) |
| 7 mburns@redhat.com (Mike Burns) | 7 mburns@redhat.com (Mike Burns) |
| 8 """ | 8 """ |
| 9 TIME = 'MEDIUM' | 9 TIME = 'MEDIUM' |
| 10 NAME = 'KVM test' | 10 NAME = 'KVM test' |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 import kvm_utils, kvm_config | 28 import kvm_utils, kvm_config |
| 29 | 29 |
| 30 # set English environment (command output might be localized, need to be safe) | 30 # set English environment (command output might be localized, need to be safe) |
| 31 os.environ['LANG'] = 'en_US.UTF-8' | 31 os.environ['LANG'] = 'en_US.UTF-8' |
| 32 | 32 |
| 33 str = """ | 33 str = """ |
| 34 # This string will be parsed after build.cfg. Make any desired changes to the | 34 # This string will be parsed after build.cfg. Make any desired changes to the |
| 35 # build configuration here. For example: | 35 # build configuration here. For example: |
| 36 #release_tag = 84 | 36 #release_tag = 84 |
| 37 """ | 37 """ |
| 38 build_cfg = kvm_config.config() | 38 |
| 39 # As the base test config is quite large, in order to save memory, we use the | 39 parser = kvm_config.Parser() |
| 40 # fork_and_parse() method, that creates another parser process and destroys it | 40 parser.parse_file(os.path.join(kvm_test_dir, "build.cfg")) |
| 41 # at the end of the parsing, so the memory spent can be given back to the OS. | 41 parser.parse_string(str) |
| 42 build_cfg_path = os.path.join(kvm_test_dir, "build.cfg") | 42 if not kvm_utils.run_tests(parser.get_dicts(), job): |
| 43 build_cfg.fork_and_parse(build_cfg_path, str) | |
| 44 if not kvm_utils.run_tests(build_cfg.get_generator(), job): | |
| 45 logging.error("KVM build step failed, exiting.") | 43 logging.error("KVM build step failed, exiting.") |
| 46 sys.exit(1) | 44 sys.exit(1) |
| 47 | 45 |
| 48 str = """ | 46 str = """ |
| 49 # This string will be parsed after tests.cfg. Make any desired changes to the | 47 # This string will be parsed after tests.cfg. Make any desired changes to the |
| 50 # test configuration here. For example: | 48 # test configuration here. For example: |
| 51 #display = sdl | 49 #display = sdl |
| 52 #install|setup: timeout_multiplier = 3 | 50 #install, setup: timeout_multiplier = 3 |
| 53 """ | 51 """ |
| 54 tests_cfg = kvm_config.config() | 52 |
| 55 tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg") | 53 parser = kvm_config.Parser() |
| 54 parser.parse_file(os.path.join(kvm_test_dir, "tests.cfg")) |
| 56 | 55 |
| 57 if args: | 56 if args: |
| 58 # We get test parameters from command line | 57 # We get test parameters from command line |
| 59 for arg in args: | 58 for arg in args: |
| 60 try: | 59 try: |
| 61 (key, value) = re.findall("(.*)=(.*)", arg)[0] | 60 (key, value) = re.findall("(.*)=(.*)", arg)[0] |
| 62 if key == "only": | 61 if key == "only": |
| 63 str += "only %s\n" % value | 62 str += "only %s\n" % value |
| 64 elif key == "no": | 63 elif key == "no": |
| 65 str += "no %s\n" % value | 64 str += "no %s\n" % value |
| 66 else: | 65 else: |
| 67 str += "%s = %s\n" % (key, value) | 66 str += "%s = %s\n" % (key, value) |
| 68 except IndexError: | 67 except IndexError: |
| 69 pass | 68 pass |
| 70 tests_cfg.fork_and_parse(tests_cfg_path, str) | 69 parser.parse_string(str) |
| 71 | 70 |
| 72 # Run the tests | 71 logging.info("Selected tests:") |
| 73 kvm_utils.run_tests(tests_cfg.get_generator(), job) | 72 for i, d in enumerate(parser.get_dicts()): |
| 73 logging.info("Test %4d: %s" % (i + 1, d["shortname"])) |
| 74 kvm_utils.run_tests(parser.get_dicts(), job) |
| 74 | 75 |
| 75 # Generate a nice HTML report inside the job's results dir | 76 # Generate a nice HTML report inside the job's results dir |
| 76 kvm_utils.create_report(kvm_test_dir, job.resultdir) | 77 kvm_utils.create_report(kvm_test_dir, job.resultdir) |
| 77 | |
| OLD | NEW |