Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92179f6

Browse files
authored
Ignore coverage in files that do not exist in source tree (#239)
1 parentec7832f commit92179f6

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

‎src/funfuzz/ccoverage/gatherer.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def gather_coverage(dirpath, rev, run_cov_time, system_grcov=False):
5757
"--commit-sha",rev,
5858
"--token","NONE",
5959
"--guess-directory-when-missing",
60-
"-p",str(path_prefix)],
60+
"--ignore-not-existing",
61+
"-p",str(path_prefix),
62+
"-s",str(dirpath/f"mozilla-central-{rev}")],
6163
check=True,
6264
stdout=f)
6365
RUN_COV_LOG.info("Finished generating grcov data")

‎src/funfuzz/ccoverage/get_build.py‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
importio
1111
importlogging
12-
frompathlibimportPath
1312
importplatform
1413
importtarfile
14+
importzipfile
15+
frompathlibimportPath
1516

1617
importfuzzfetch
1718
importrequests
@@ -74,6 +75,39 @@ def get_coverage_build(dirpath, rev):
7475
returnjs_cov_bin
7576

7677

78+
defget_source_archive(dirpath,rev):
79+
"""Gets a source archive for the specified revision.
80+
81+
Args:
82+
dirpath (Path): Directory in which archive is to be downloaded in.
83+
rev (str): Mercurial hash of the required revision
84+
85+
Returns:
86+
Path: Path to the source archive
87+
"""
88+
url=f"https://hg.mozilla.org/mozilla-central/archive/{rev}.zip"
89+
resp=requests.get(url,stream=True)
90+
resp.raise_for_status()
91+
92+
RUN_COV_LOG.info("Downloading source archive: %s",url)
93+
zip_dest=Path(dirpath/f"{rev}.zip")
94+
withzip_dest.open("wb")asfile:
95+
forchunkinresp.iter_content(chunk_size=128*1024):
96+
file.write(chunk)
97+
98+
RUN_COV_LOG.info("Extracting source archive")
99+
try:
100+
withzipfile.ZipFile(zip_dest)asarchive:
101+
archive.extractall(path=dirpath)
102+
finally:
103+
zip_dest.unlink()
104+
105+
archive_dir=dirpath/f"mozilla-central-{rev}"
106+
assertarchive_dir.is_dir()
107+
108+
returnarchive_dir
109+
110+
77111
defget_grcov(dirpath,args):
78112
"""Gets a grcov binary.
79113

‎src/funfuzz/run_ccoverage.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def main(argparse_args=None):
7373
cov_revision_str=cov_revision_request.content.rstrip().decode("utf-8",errors="replace")
7474

7575
get_build.get_coverage_build(dirpath,cov_revision_str)
76+
get_build.get_source_archive(dirpath,cov_revision_str)
7677
ifargs.grcov_ver!="system":
7778
get_build.get_grcov(dirpath,args)
7879
cov_result_file=gatherer.gather_coverage(dirpath,cov_revision_str,args.target_time,args.grcov_ver=="system")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp