Lines Matching refs:self
111 def __init__(self, old_version, new_version, configuration): argument
124 self.repo_path = "."
125 self.log = None
126 self.verbose = configuration.verbose
127 self._setup_logger()
128 self.report_dir = os.path.abspath(configuration.report_dir)
129 self.keep_all_reports = configuration.keep_all_reports
130 self.can_remove_report_dir = not (os.path.exists(self.report_dir) or
131 self.keep_all_reports)
132 self.old_version = old_version
133 self.new_version = new_version
134 self.skip_file = configuration.skip_file
135 self.check_abi = configuration.check_abi
136 self.check_api = configuration.check_api
137 if self.check_abi != self.check_api:
139 self.check_storage_tests = configuration.check_storage
140 self.brief = configuration.brief
141 self.git_command = "git"
142 self.make_command = "make"
144 def _setup_logger(self): argument
145 self.log = logging.getLogger()
146 if self.verbose:
147 self.log.setLevel(logging.DEBUG)
149 self.log.setLevel(logging.INFO)
150 self.log.addHandler(logging.StreamHandler())
158 def _get_clean_worktree_for_git_revision(self, version): argument
163 self.log.debug(
169 [self.git_command, "fetch",
171 cwd=self.repo_path,
174 self.log.debug(fetch_output.decode("utf-8"))
177 self.log.debug("Checking out git worktree for revision {}".format(
182 [self.git_command, "worktree", "add", "--detach",
184 cwd=self.repo_path,
187 self.log.debug(worktree_output.decode("utf-8"))
189 [self.git_command, "rev-parse", "HEAD"],
193 self.log.debug("Commit is {}".format(version.commit))
196 def _update_git_submodules(self, git_worktree_path, version): argument
201 [self.git_command, "submodule", "update", "--init", '--recursive'],
205 self.log.debug(update_output.decode("utf-8"))
212 [self.git_command, "fetch", version.crypto_repository,
217 self.log.debug(fetch_output.decode("utf-8"))
223 [self.git_command, "checkout", crypto_rev],
227 self.log.debug(checkout_output.decode("utf-8"))
229 def _build_shared_libraries(self, git_worktree_path, version): argument
237 [self.make_command, "lib"],
242 self.log.debug(make_output.decode("utf-8"))
256 def _get_abi_dumps_from_shared_libraries(self, version): argument
262 self.report_dir, "{}-{}-{}.dump".format(
270 "-lver", self._pretty_revision(version),
276 self.log.debug(abi_dump_output.decode("utf-8"))
285 def _read_storage_tests(self, argument
313 test_case_data = self._normalize_storage_test_case_data(line)
341 def _get_storage_format_tests(self, version, git_worktree_path): argument
358 for filename in self._list_generated_test_data_files(git_worktree_path):
373 self._read_storage_tests(git_worktree_path,
378 def _cleanup_worktree(self, git_worktree_path): argument
382 [self.git_command, "worktree", "prune"],
383 cwd=self.repo_path,
386 self.log.debug(worktree_output.decode("utf-8"))
388 def _get_abi_dump_for_ref(self, version): argument
390 git_worktree_path = self._get_clean_worktree_for_git_revision(version)
391 self._update_git_submodules(git_worktree_path, version)
392 if self.check_abi:
393 self._build_shared_libraries(git_worktree_path, version)
394 self._get_abi_dumps_from_shared_libraries(version)
395 if self.check_storage_tests:
396 self._get_storage_format_tests(version, git_worktree_path)
397 self._cleanup_worktree(git_worktree_path)
399 def _remove_children_with_tag(self, parent, tag): argument
405 self._remove_children_with_tag(child, tag)
407 def _remove_extra_detail_from_report(self, report_root): argument
410 self._remove_children_with_tag(report_root, tag)
417 def _abi_compliance_command(self, mbed_module, output_path): argument
423 "-old", self.old_version.abi_dumps[mbed_module],
424 "-new", self.new_version.abi_dumps[mbed_module],
428 if self.skip_file:
429 abi_compliance_command += ["-skip-symbols", self.skip_file,
430 "-skip-types", self.skip_file]
431 if self.brief:
436 def _is_library_compatible(self, mbed_module, compatibility_report): argument
440 self.report_dir, "{}-{}-{}.html".format(
441 mbed_module, self.old_version.revision,
442 self.new_version.revision
447 self._abi_compliance_command(mbed_module, output_path),
453 if self.brief:
454 self.log.info(
458 self._remove_extra_detail_from_report(report_root)
459 self.log.info(ET.tostring(report_root).decode("utf-8"))
461 self.can_remove_report_dir = False
470 if not (self.keep_all_reports or self.brief):
505 def get_abi_compatibility_report(self): argument
510 self._pretty_revision(self.old_version),
511 self._pretty_revision(self.new_version)
515 if self.check_abi:
516 shared_modules = list(set(self.old_version.modules.keys()) &
517 set(self.new_version.modules.keys()))
519 if not self._is_library_compatible(mbed_module,
523 if self.check_storage_tests:
524 if not self._is_storage_format_compatible(
525 self.old_version.storage_tests,
526 self.new_version.storage_tests,
530 for version in [self.old_version, self.new_version]:
533 if self.can_remove_report_dir:
534 os.rmdir(self.report_dir)
535 self.log.info("\n".join(compatibility_report))
538 def check_for_abi_changes(self): argument
542 if self.check_api or self.check_abi:
543 self.check_abi_tools_are_installed()
544 self._get_abi_dump_for_ref(self.old_version)
545 self._get_abi_dump_for_ref(self.new_version)
546 return self.get_abi_compatibility_report()