Lines Matching +full:test +full:- +full:suite
3 # Use of this source code is governed by a BSD-style license that can be
30 from autotest_lib.server.cros.dynamic_suite import suite, constants
46 _SUITE_REGEX = r'suite:(.*)'
65 """Raise when there is an issue the specified test's control file."""
74 parser.add_argument('tests', nargs='+', metavar='TEST',
75 help='Run given test(s). Use suite:SUITE to specify '
76 'test suite. Use e:[NAME_PATTERN] to specify a '
77 'NAME-matching regular expression. Use '
82 parser.add_argument('--fast', action='store_true', dest='fast_mode',
87 parser.add_argument('--args', metavar='ARGS',
89 'through to test. Only supported for runs '
91 "e.g. --args='foo=bar cat=\"in a hat\"'.")
92 parser.add_argument('--results_dir', metavar='RESULTS_DIR', default=None,
96 parser.add_argument('--pretend', action='store_true', default=False,
99 parser.add_argument('--no-experimental',
104 parser.add_argument('--enforce-deps', action='store_true',
108 parser.add_argument('--debug', action='store_true',
113 parser.add_argument('--iterations', action='store', type=int, default=1,
115 parser.add_argument('--ssh_verbosity', action='store', type=int,
119 parser.add_argument('--ssh_options', action='store', default=None,
124 class LocalSuite(suite.Suite):
125 """Subclass of Suite with methods for running locally"""
132 @param results_dir: absolute path where test results were stored.
137 logging.debug('Parsing test results for job %s',job_id)
158 Retry a test job by id.
167 test = self._jobs_to_tests[job_id]
168 logging.debug('Attempting to retry job %s, test %s', job_id, test.name)
169 test.fast = False
171 record=record, test=test, retry_for=job_id)
177 """Find the name of the test run by a job with a given job ID."""
202 logging.info('autoserv| %s', message.rstrip().decode('utf-8'))
230 @param autoserv_verbose: If true, pass the --verbose flag to autoserv.
239 results_directory = os.path.join(results_directory, 'results-provision')
247 extra_args=['--provision', '--job-labels', provision_label],
251 raise TestThatProvisioningError('Command returns non-zero code: %s ' %
273 Shell out to autoserv to run an individual test job.
276 relevent metadata for this test.
277 @param host: Hostname of DUT to run test against.
284 0-padded to when formatting as a string for results
289 and then ultimitely to test itself.
292 @param autoserv_verbose: If true, pass the --verbose flag to autoserv.
293 @param companion_hosts: Companion hosts for the test.
294 @param dut_servers: DUT servers for the test.
304 name_tail = job.ctrlname.split('/')[-1]
306 'results-%0*d-%s' % (id_digits, job.id,
322 extra_args.extend(['--args', args])
360 def get_predicate_for_test_arg(test): argument
362 Gets a suite predicte function for a given command-line argument.
364 @param test: String. An individual TEST command line argument, e.g.
365 'login_CryptohomeMounted' or 'suite:smoke'
366 @returns: A (predicate, string) tuple with the necessary suite
367 predicate, and a description string of the suite that
370 suitematch = re.match(_SUITE_REGEX, test)
371 name_pattern_match = re.match(r'e:(.*)', test)
372 file_pattern_match = re.match(r'f:(.*)', test)
375 return (suite.name_in_tag_predicate(suitename),
376 'suite named %s' % suitename)
379 return (suite.test_name_matches_pattern_predicate(pattern),
380 'suite to match name pattern %s' % pattern)
383 return (suite.test_file_matches_pattern_predicate(pattern),
384 'suite to match file name pattern %s' % pattern)
385 return (suite.test_name_equals_predicate(test),
386 'job named %s' % test)
389 def get_predicate_for_possible_test_arg(test): argument
391 Gets a suite predicte function to calculate the similarity of given test
394 @param test: String. An individual TEST command line argument, e.g.
395 'login_CryptohomeMounted' or 'suite:smoke'
396 @returns: A (predicate, string) tuple with the necessary suite
397 predicate, and a description string of the suite that
400 suitematch = re.match(_SUITE_REGEX, test)
401 name_pattern_match = re.match(r'e:(.*)', test)
402 file_pattern_match = re.match(r'f:(.*)', test)
405 return (suite.name_in_tag_similarity_predicate(suitename),
406 'suite name similar to %s' % suitename)
409 return (suite.test_name_similarity_predicate(pattern),
413 return (suite.test_file_similarity_predicate(pattern),
414 'suite to match file name similar to %s' % pattern)
415 return (suite.test_name_similarity_predicate(test),
416 'job name similar to %s' % test)
431 # world-readable. Otherwise, ssh-add complains.
436 p = subprocess.Popen(['ssh-add', key_copy_path],
442 logging.warning('There appears to be no running ssh-agent. Attempting '
443 'to continue without running ssh-add, but ssh commands '
450 Note that the label of board will not be auto-detected.
462 def get_all_control_files(test, autotest_path): argument
463 """Get all control files for specified test in the given autotest_path.
465 @param test: name of the test or suite to fetch
468 (predicate, description) = get_predicate_for_test_arg(test)
469 logging.info('Fetching suite for %s...', description)
473 def get_possible_tests(test, autotest_path): argument
474 fs_getter = suite.create_fs_getter(autotest_path)
477 similarity_description) = (get_predicate_for_possible_test_arg(test))
479 logging.error('No test found, searching for possible tests with %s',
481 possible_tests = suite.find_possible_tests(fs_getter, similarity_predicate)
482 raise SystemExit('Found no tests. Check your suite name, test name, '
483 'or test matching wildcard.\nDid you mean any of '
512 This method enforces satisfaction of test dependencies for tests that are
513 run as a part of a suite.
516 custom autotest path set by --autotest_dir.
517 @param tests: List of strings naming tests and suites to run. Suite strings
518 should be formed like "suite:smoke".
525 and then ultimitely to test itself.
534 @param autoserv_verbose: If true, pass the --verbose flag to autoserv.
538 @param companion_hosts: companion hosts for the test.
539 @param dut_servers: dut servers for the test.
551 u'cros-version:ad_hoc_build',
556 logging.info('Auto-detecting labels for %s', remote)
557 # Auto-detected labels may duplicate explicitly set ones.
566 # TODO: Determine if we want to auto-detect labels, and/or expose
573 logging.info('Auto-detecting labels for %s', chost)
574 # Auto-detected labels may duplicate explicitly set ones.
590 for test in tests:
591 ctrl_files = get_all_control_files(test, autotest_path)
593 get_possible_tests(test, autotest_path)
618 logging.debug('Running job %s of test %s', job.id, (job.name))
669 #pylint: disable-msg=C0111
742 """Parse the test result files in the given directory into a report.
752 # Experimental test results do not influence the exit code.
753 test_report_command.append('--ignore_experimental_tests')
755 test_report_command.append('--cft')
757 test_report_command.append('--html')
758 test_report_command.append('--html-report-dir=%s' % directory)
760 test_report_command.append('--allow_chrome_crashes')
762 test_report_command.append('--just_status_code')
802 of a test run that come after the bootstrap into |autotest_path|.
806 @param tests: List of strings naming tests and suites to run. Suite strings
807 should be formed like "suite:smoke".
813 and then ultimitely to test itself.
816 @param ignore_deps: If True, test dependencies will be ignored.
823 @param autoserv_verbose: If true, pass the --verbose flag to autoserv.
830 @param companion_hosts: companion hosts for the test.
831 @param dut_servers: dut servers for the test.
952 "Test py_version not compatible. Expected 2 or 3 got %s" %
964 If not, set it to 2. If 2 is set, lock the entire suite into 2.
965 Different versions in the same suite is *not* supported.
978 cf_getter = suite.create_fs_getter(autotest_path)
979 return list(suite.find_and_parse_tests(cf_getter, pred))