5959# OSS-Fuzz $OUT dir.
6060OUT = pathlib .Path (os .getenv ("OUT" , "/out" ))
6161# OSS-Fuzz coverage info.
62- _COVERAGE_INFO_URL = ("https://storage.googleapis.com/oss-fuzz-coverage/"
63- f"latest_report_info/{ os .getenv ('PROJECT_NAME' )} .json" )
62+ _COVERAGE_INFO_URL = (
63+ "https://storage.googleapis.com/oss-fuzz-coverage/"
64+ f"latest_report_info/{ os .getenv ('PROJECT_NAME' )} .json"
65+ )
6466
6567
6668class RepositoryType (enum .StrEnum ):
@@ -139,6 +141,12 @@ class BinaryConfig:
139141
140142 binary_name : str
141143
144+ @property
145+ def uses_stdin (self ) -> bool :
146+ """Whether the binary uses stdin."""
147+ del self
148+ return False
149+
142150 @classmethod
143151 def from_dict (cls , config_dict : Mapping [str , Any ]) -> Self :
144152 """Deserializes the correct `BinaryConfig` subclass from a dict."""
@@ -188,6 +196,11 @@ class CommandLineBinaryConfig(BinaryConfig):
188196 # some targets like V8 require this to be false, see b/433718862.
189197 filter_compile_commands : bool = True
190198
199+ @property
200+ def uses_stdin (self ) -> bool :
201+ """Whether the binary uses stdin."""
202+ return manifest_constants .INPUT_FILE not in self .binary_args
203+
191204 @classmethod
192205 def from_dict (cls , config_dict : Mapping [str , Any ]) -> Self :
193206 """Deserializes the `CommandLineBinaryConfig` from a dict."""
@@ -491,7 +504,8 @@ def _save_dir(
491504
492505
493506def report_missing_source_files (
494- binary_name : str , copied_files : list [str ], tar : tarfile .TarFile ):
507+ binary_name : str , copied_files : list [str ], tar : tarfile .TarFile
508+ ):
495509 """Saves a report of missing source files to the snapshot tarball."""
496510 copied_files = {_get_comparable_path (file ) for file in copied_files }
497511 covered_files = {
@@ -502,9 +516,7 @@ def report_missing_source_files(
502516 if not missing :
503517 return
504518 logging .info ("Reporting missing files: %s" , missing )
505- missing_report_lines = sorted ([
506- covered_files [k ] for k in missing
507- ])
519+ missing_report_lines = sorted ([covered_files [k ] for k in missing ])
508520 report_name = f"{ binary_name } _missing_files.txt"
509521 tar_info = tarfile .TarInfo (name = report_name )
510522 missing_report = " " .join (missing_report_lines )
@@ -524,15 +536,19 @@ def get_covered_files(target: str) -> Sequence[str]:
524536 latest_info = json .load (resp )
525537
526538 stats_url = latest_info .get ("fuzzer_stats_dir" ).replace (
527- "gs://" , "https://storage.googleapis.com/" )
539+ "gs://" , "https://storage.googleapis.com/"
540+ )
528541
529542 target_url = f"{ stats_url } /{ target } .json"
530543 with urllib .request .urlopen (target_url ) as resp :
531544 target_cov = json .load (resp )
532545
533546 files = target_cov ["data" ][0 ]["files" ]
534- return [file ["filename" ]
535- for file in files if file ["summary" ]["regions" ]["covered" ]]
547+ return [
548+ file ["filename" ]
549+ for file in files
550+ if file ["summary" ]["regions" ]["covered" ]
551+ ]
536552
537553
538554def _get_mapped (
0 commit comments