Lines Matching +full:test +full:- +full:path
1 #!/usr/bin/python2 -u
45 # client side test control, as saved in old Autotest paths.
47 # server side test control, as saved in old Autotest paths.
58 parser.add_option("-m", help="Send mail for FAILED tests",
60 parser.add_option("-r", help="Reparse the results of a job",
62 parser.add_option("-o", help="Parse a single results directory",
64 parser.add_option("-l", help=("Levels of subdirectories to include "
67 parser.add_option("-n", help="No blocking on an existing parse",
69 parser.add_option("-s", help="Database server hostname",
71 parser.add_option("-u", help="Database username", dest="db_user",
73 parser.add_option("-p", help="Database password", dest="db_pass",
75 parser.add_option("-d", help="Database name", dest="db_name",
77 parser.add_option("--dry-run", help="Do not actually commit any results.",
80 "--detach", action="store_true",
84 parser.add_option("--write-pidfile",
88 parser.add_option("--record-duration",
92 parser.add_option("--suite-report",
98 parser.add_option("--datastore-creds",
99 help=("The path to gcloud datastore credentials file, "
104 parser.add_option("--export-to-gcloud-path",
105 help=("The path to export_to_gcloud script. Please find "
106 "chromite path on your server. The script is under "
110 parser.add_option("--disable-perf-upload",
131 # If it is a lab server, the script is under ~chromeos-test/
132 if os.path.exists(os.path.expanduser('~chromeos-test/%s' %
134 path = os.path.expanduser('~chromeos-test/%s' % export_script)
136 elif os.path.exists(os.path.expanduser('~/%s' % export_script)):
137 path = os.path.expanduser('~/%s' % export_script)
140 path = None
141 options.export_to_gcloud_path = path
152 @param testname: String representing the test name.
153 @param status: String representing the test status.
158 format_string = "%-12s %-20s %-12s %-10s %s"
175 "Test name", "FAIL/WARN",
189 job's test results, such that the consumers of the tko database
207 test_idx| job_idx | test | ... | invalid | invalidates_test_idx
233 orig_tests = tko_models.Test.objects.filter(job__job_idx=orig_job_idx)
234 retry_tests = tko_models.Test.objects.filter(job__job_idx=retry_job_idx)
239 # Maintain a dictionary that maps (test, subdir) to original tests.
240 # Note that within the scope of a job, (test, subdir) uniquelly
241 # identifies a test run, but 'test' does not.
242 # In a control file, one could run the same test with different
247 # (test='dummy_Fail.Error', subdir='dummy_Fail.Error.subdir_1')
248 # (test='dummy_Fail.Error', subdir='dummy_Fail.Error.subdir_2')
249 invalidated_tests = {(orig_test.test, orig_test.subdir): orig_test
252 # It is possible that (retry.test, retry.subdir) doesn't exist
257 orig_test = invalidated_tests.get((retry.test, retry.subdir), None)
264 def _throttle_result_size(path): argument
265 """Limit the total size of test results for the given path.
267 @param path: Path of the result directory.
272 path)
275 max_result_size_KB = _max_result_size_from_control(path)
280 result_utils.execute(path, max_result_size_KB)
284 (path, traceback.format_exc()))
287 def _max_result_size_from_control(path): argument
293 control = os.path.join(path, control_file)
294 if not os.path.exists(control):
318 @param filename: The path to the results to be parsed.
326 def parse_one(db, pid_file_manager, jobname, path, parse_options): argument
332 e.g. '1234-chromeos-test/host1'
333 @param path: The path to the results to be parsed.
343 tko_utils.dprint("\nScanning %s (%s)" % (jobname, path))
350 job_keyval = models.job.read_keyval(path)
354 job = parser.make_job(path)
355 tko_utils.dprint("+ Parsing dir=%s, jobname=%s" % (path, jobname))
356 status_log_path = _find_status_log_path(path)
388 _throttle_result_size(path)
390 # Record test result size to job_keyvals
393 path, log=tko_utils.dprint)
395 (time.time()-start_time))
403 for test in job.tests:
404 if not test.subdir:
407 % (test.testname, test.subdir, test.status,
408 test.reason))
409 if test.status not in ('GOOD', 'WARN'):
413 jobname, test.kernel.base, test.subdir,
414 test.status, test.reason))
430 for test in job.tests:
431 perf_uploader.upload_test(job, test, jobname)
472 binary_file_name = os.path.join(path, "job.serialize")
481 # jobname will be <JOB_ID>-<USERNAME>/hostless, the suite field will not be
488 timing_log = os.path.join(path, 'suite_timing.log')
490 "--output='%s' --debug" %
495 dump_cmd += " --provision_job_id=%d" % int(provision_job_id)
501 and os.path.exists(export_to_gcloud_path)):
503 timing_log, '--parent_key',
519 # Check if we should not offload this test's results.
522 gs_instructions_file = os.path.join(
523 path, constants.GS_OFFLOADER_INSTRUCTIONS)
525 if os.path.exists(gs_instructions_file):
550 for test in job.tests:
551 db.insert_test(job, test)
554 def _find_status_log_path(path): argument
555 if os.path.exists(os.path.join(path, "status.log")):
556 return os.path.join(path, "status.log")
557 if os.path.exists(os.path.join(path, "status")):
558 return os.path.join(path, "status")
570 for test in tests:
571 if test not in already_added:
572 already_added.add(test)
573 job.tests.append(test)
582 raw_old_tests = db.select("test_idx,subdir,test", "tko_tests",
585 old_tests = dict(((test, subdir), test_idx)
586 for test_idx, subdir, test in raw_old_tests)
590 for test in job.tests:
591 test_idx = old_tests.pop((test.testname, test.subdir), None)
593 test.test_idx = test_idx
595 tko_utils.dprint("! Reparse returned new test "
597 (test.testname, test.subdir))
612 def _get_job_subdirs(path): argument
614 Returns a list of job subdirectories at path. Returns None if the test
618 machine_list = os.path.join(path, ".machines")
619 if os.path.exists(machine_list):
622 if os.path.exists(os.path.join(path, subdir)))
627 contents = set(os.listdir(path))
630 os.path.isdir(os.path.join(path, sub)))
638 def parse_leaf_path(db, pid_file_manager, path, level, parse_options): argument
639 """Parse a leaf path.
643 @param path: The path to the results to be parsed.
647 @returns: The job name of the parsed job, e.g. '123-chromeos-test/host1'
649 job_elements = path.split("/")[-level:]
651 db.run_with_retry(parse_one, db, pid_file_manager, jobname, path,
656 def parse_path(db, pid_file_manager, path, level, parse_options): argument
657 """Parse a path
661 @param path: The path to the results to be parsed.
666 set(['123-chromeos-test/host1', '123-chromeos-test/host2'])
669 job_subdirs = _get_job_subdirs(path)
671 # parse status.log in current directory, if it exists. multi-machine
674 if os.path.exists(os.path.join(path, 'status.log')):
675 new_job = parse_leaf_path(db, pid_file_manager, path, level,
678 # multi-machine job
680 jobpath = os.path.join(path, subdir)
686 new_job = parse_leaf_path(db, pid_file_manager, path, level,
729 results_dir = os.path.abspath(args[0])
730 assert os.path.exists(results_dir)
750 jobs_list = [os.path.join(results_dir, subdir)
759 for path in jobs_list:
760 lockfile = open(os.path.join(path, ".parse.lock"), "w")
774 new_jobs = parse_path(db, pid_file_manager, path, options.level,
793 @param test_results_dir: path to test results dir.
800 config_dir = os.path.join(test_results_dir, os.pardir)
819 tko_utils.dprint("No side_effects.Config found in %s - "