53 """Searches for regressions.
55 Will only write a checkpoint when first run, and on all subsequent runs
56 a comparison is done against the last checkpoint.
59 Exit code for the script: 0 if no significant changes are found; 1 if
60 there was an error in the comparison; 3 if there was a regression; 4 if
61 there was an improvement and no regression.
63 pdfium_src_dir = os.path.join(
64 os.path.dirname(__file__), os.path.pardir, os.path.pardir)
65 os.chdir(pdfium_src_dir)
67 branch_to_restore = self.
git.GetCurrentBranchName()
69 if not self.
args.no_checkout:
70 self.
git.FetchOriginMaster()
71 self.
git.Checkout(
'origin/main')
74 if not os.path.exists(self.
context.results_dir):
75 os.makedirs(self.
context.results_dir)
77 if not os.path.exists(self.
context.last_revision_covered_file):
80 with open(self.
context.last_revision_covered_file)
as f:
81 last_revision_covered = f.read().strip()
84 self.
git.Checkout(branch_to_restore)
104 """Incremental run, compare against last checkpoint and update it.
107 last_revision_covered: String with hash for last checkpoint.
110 Exit code for the script.
112 current = self.
git.GetCurrentBranchHash()
114 PrintWithTime(
'Incremental run, current is %s, last is %s' %
115 (current, last_revision_covered))
117 if not os.path.exists(self.
context.run_output_dir):
118 os.makedirs(self.
context.run_output_dir)
120 if current == last_revision_covered:
121 PrintWithTime(
'No changes seen, finishing job')
131 'testing/tools/safetynet_compare.py',
'--this-repo',
132 '--machine-readable',
133 '--branch-before=%s' % last_revision_covered,
134 '--output-dir=%s' % self.
context.run_output_dir
136 cmd.extend(self.
args.input_paths)
138 json_output = RunCommandPropagateErr(cmd)
140 if json_output
is None:
143 output_info = json.loads(json_output)
146 output_info.setdefault(
'metadata', {}).update(run_metadata)
149 PrintConclusionsDictHumanReadable(
151 colored=(
not self.
args.output_to_log
and not self.
args.no_color),
156 if output_info[
'summary'][
'improvement']:
157 PrintWithTime(
'Improvement detected.')
160 if output_info[
'summary'][
'regression']:
161 PrintWithTime(
'Regression detected.')
165 PrintWithTime(
'Nothing detected.')