diff --git a/edk2toolext/environment/reporttypes/coverage_report.py b/edk2toolext/environment/reporttypes/coverage_report.py index 35ed2dae..1f7bf8b5 100644 --- a/edk2toolext/environment/reporttypes/coverage_report.py +++ b/edk2toolext/environment/reporttypes/coverage_report.py @@ -37,6 +37,11 @@ AND id = ?; """ +PACKAGE_LIST_QUERY = """ +SELECT name +FROM package; +""" + ID_QUERY = """ SELECT id FROM environment @@ -72,6 +77,11 @@ def add_cli_options(self, parserobj: ArgumentParser): def run_report(self, db: Edk2DB, args: Namespace) -> None: """Generate the Coverage report.""" self.args = args + + # If not packages are specified, use all packages in the database + self.args.package_list = self.args.package_list or \ + [pkg for pkg, in db.connection.execute(PACKAGE_LIST_QUERY).fetchall()] + files = self._build_file_dict(args.xml) if args.scope == "inf": @@ -120,7 +130,7 @@ def _get_inf_cov(self, files: dict, db: Edk2DB, library_only: bool): # If library_only, filter out INFs that do not have a library_class entry_dict = {} for inf, library_class, source in db.connection.execute(SOURCE_QUERY, (env_id,)): - if library_only and library_class == "": + if library_only and library_class is None: continue if inf not in entry_dict: entry_dict[inf] = [source] @@ -135,7 +145,7 @@ def _get_inf_cov(self, files: dict, db: Edk2DB, library_only: bool): source.text = self.args.workspace for pp in pp_list: source = ET.SubElement(sources, "source") - source.text = pp + source.text = Path(str(self.args.workspace, pp)) packages = ET.SubElement(root, "packages") for path, source_list in entry_dict.items():