Bug 13599 - Scripts to generate coverage information for WebKit
Summary: Scripts to generate coverage information for WebKit
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-05 12:44 PDT by Holger Freyther
Modified: 2007-05-28 13:28 PDT (History)
2 users (show)

See Also:


Attachments
README (860 bytes, text/plain)
2007-05-05 12:46 PDT, Holger Freyther
no flags Details
cov.py (7.59 KB, text/plain)
2007-05-05 12:48 PDT, Holger Freyther
no flags Details
run-generate-coverage-data (8.48 KB, text/plain)
2007-05-05 12:50 PDT, Holger Freyther
no flags Details
regenerate-coverage-display (14.51 KB, text/plain)
2007-05-05 12:54 PDT, Holger Freyther
no flags Details
image for coverage information - color amber (127 bytes, image/x-png)
2007-05-07 05:24 PDT, Björn Schmid
no flags Details
image for coverage information - color emerald (127 bytes, image/x-png)
2007-05-07 05:25 PDT, Björn Schmid
no flags Details
image for coverage information - color white (127 bytes, image/x-png)
2007-05-07 05:25 PDT, Björn Schmid
no flags Details
image for coverage information - color ruby (127 bytes, image/x-png)
2007-05-07 05:26 PDT, Björn Schmid
no flags Details
image for coverage information - color white (127 bytes, image/x-png)
2007-05-07 05:26 PDT, Björn Schmid
no flags Details
css for coverage information (1.62 KB, text/css)
2007-05-07 09:00 PDT, Björn Schmid
no flags Details
Script, CSS and images to generate coverage information (38.73 KB, patch)
2007-05-15 07:05 PDT, Holger Freyther
no flags Details | Formatted Diff | Diff
Generate coverage data (38.66 KB, patch)
2007-05-18 02:36 PDT, Holger Freyther
no flags Details | Formatted Diff | Diff
--coverage flags for build-webkit / run-jsc-tests (3.38 KB, patch)
2007-05-18 06:16 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff
Patch to add CoverageTools (46.62 KB, patch)
2007-05-18 14:21 PDT, Holger Freyther
mrowe: review-
Details | Formatted Diff | Diff
Scripts to generate coverage data (45.51 KB, patch)
2007-05-20 14:56 PDT, Holger Freyther
no flags Details | Formatted Diff | Diff
Scripts to generate coverage data (45.53 KB, patch)
2007-05-24 02:19 PDT, Holger Freyther
sam: review-
Details | Formatted Diff | Diff
Scripts to generate coverage data (46.64 KB, patch)
2007-05-28 03:15 PDT, Holger Freyther
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Freyther 2007-05-05 12:44:20 PDT
As posted on the mailing-list I will post the scripts peau-a-peau. For ease of reading I will post the scripts and no diff containing the scripts.

I understand apple needs to take care of the licenses. The original author of cov.py and regenerate-coverage-display is Nathaniel Smith of the monotone project. His original work can be found in the org.vorpus.monotone-cov branch pull'able from venge.net. I have mailed him and the question is if this enough or if you need more.

"""
>	-What is the original license of these files

GPLv2+

>	-Would you object relicensing to a BSD license

Not really.  Do you need more from me than those two words to make it
actually happen?

"""
Comment 1 Holger Freyther 2007-05-05 12:46:22 PDT
Created attachment 14363 [details]
README

Describes how to use the scripts to generate coverage data. I assume WebKitTools/Coverage contains these files.
Comment 2 Holger Freyther 2007-05-05 12:48:54 PDT
Created attachment 14364 [details]
cov.py

This script parses tries to match source file with one or more .gcov files and counts the line numbers. It is capable of combining the gcov files and writes the result into a .csv files
Comment 3 Holger Freyther 2007-05-05 12:50:21 PDT
Created attachment 14365 [details]
run-generate-coverage-data

Collect source files from depends (.d) files and try to execute gcov from the found directories with the found source files.
Comment 4 Holger Freyther 2007-05-05 12:54:09 PDT
Created attachment 14366 [details]
regenerate-coverage-display

This grabs the .csv files generate by the run- script and plots the coverage changes (matplotlib is required for that feature) and generates HTML like files.
Comment 5 Holger Freyther 2007-05-05 13:01:15 PDT
I have found someone to generate a css and the three images to avoid the lgcov GPL license issue. With a bit of luck he might finish them by tomorrow.

Oh and btw please don't ask to redo these scripts using perl.
Comment 6 Björn Schmid 2007-05-07 05:24:40 PDT
Created attachment 14387 [details]
image for coverage information - color amber
Comment 7 Björn Schmid 2007-05-07 05:25:08 PDT
Created attachment 14388 [details]
image for coverage information - color emerald
Comment 8 Björn Schmid 2007-05-07 05:25:32 PDT
Created attachment 14389 [details]
image for coverage information - color white
Comment 9 Björn Schmid 2007-05-07 05:26:18 PDT
Created attachment 14390 [details]
image for coverage information - color ruby
Comment 10 Björn Schmid 2007-05-07 05:26:46 PDT
Created attachment 14391 [details]
image for coverage information - color white
Comment 11 Holger Freyther 2007-05-07 08:08:49 PDT
Only the css is missing but Björn did create one already but forgot to attach it. I will ask him to attach it.
Comment 12 Björn Schmid 2007-05-07 09:00:16 PDT
Created attachment 14396 [details]
css for coverage information
Comment 13 Holger Freyther 2007-05-15 07:05:29 PDT
Created attachment 14565 [details]
Script, CSS and images to generate coverage information

Changed the directory to WebKitTools/CodeCoverage, updated the README and created a patch from the previous files.
Comment 14 Nikolas Zimmermann 2007-05-16 16:06:25 PDT
Comment on attachment 14565 [details]
Script, CSS and images to generate coverage information

Nice work Holger!
bdash is going to create a "build slave" (build.webkit.org) to do periodically runs of your stuff.
Comment 15 Mark Rowe (bdash) 2007-05-16 16:14:51 PDT
It'd be great if there was some simple interface exposed to make this easier to use.  Setting up a build slave to run a bunch of commands itself is a bit tricky, especially when some of them depend on output from previous steps as at least one of the coverage-related ones appears to.
Comment 16 Holger Freyther 2007-05-17 02:41:12 PDT
(In reply to comment #15)
> It'd be great if there was some simple interface exposed to make this easier to
> use.  Setting up a build slave to run a bunch of commands itself is a bit
> tricky, especially when some of them depend on output from previous steps as at
> least one of the coverage-related ones appears to.
> 

Simple interface as in one script to compile, run the tests, collect the data and upload?
Comment 17 David Kilzer (:ddkilzer) 2007-05-17 08:46:17 PDT
(In reply to comment #16)
> Simple interface as in one script to compile, run the tests, collect the data
> and upload?

Yes, I'm pretty sure that's what Mark meant.  That way it's easy to make it run periodically with no manual intervention.

Comment 18 Mark Rowe (bdash) 2007-05-18 02:10:06 PDT
Yes, that's what I meant.  The uploading part isn't strictly necessary, but automating the other steps would definitely simplify things.
Comment 19 Mark Rowe (bdash) 2007-05-18 02:10:50 PDT
I'll land things as-is, we can track further enhancements in a future bug report.
Comment 20 Mark Rowe (bdash) 2007-05-18 02:14:30 PDT
Ouch, it seems svn-create-patch doesn't override the LANG setting of 'svn' so your attached patch contains some non-English strings where svn-apply expects the English strings.  When applying the patch, it omits all of the binary files :-(  Can you please regenerate this patch with LANG set to C or en_US?  I guess this is something that svn-create-patch should be doing internally...
Comment 21 Holger Freyther 2007-05-18 02:36:33 PDT
Created attachment 14602 [details]
Generate coverage data

Now generated with LC_ALL WebKitTools/Script/svn-createPatch. But please don't apply yet, I will write this small script to execute the commands from the README.
Comment 22 Mark Rowe (bdash) 2007-05-18 02:48:10 PDT
Comment on attachment 14602 [details]
Generate coverage data

Thanks!
Comment 23 Nikolas Zimmermann 2007-05-18 06:16:31 PDT
Created attachment 14604 [details]
--coverage flags for build-webkit / run-jsc-tests

Hey Holger,

I already started a script, it may be a starting point for you.
I basically added a "--coverage" option to both build-webkit & run-javascriptcore-tests.

All we need is a new script "run-coverage" which executes the commands from your
README (best would be to copy the build-webkit script and modify it.)

Greetings,
Niko
Comment 24 Holger Freyther 2007-05-18 14:21:03 PDT
Created attachment 14613 [details]
Patch to add CoverageTools

Changes:
   -Only use matplotlib.date2num but do not plot images
   -Incorporate niko's --coverage param
   -Provide another script that calls WebKitTools/Scripts/build-webkit and calls the test cases
   -A small hack check-global-initializer to not error out on coverage builds. UserObjectImpl.o of JavaScriptGlue has a global initializer and I didn't feel like adding it to the whitelist.
  -The result will be stored in WebKitBuild/Coverage/html which can be scp'ed somewhere else

Requirements:
   easy_install numpy
   easy_install matplotlib
Comment 25 Nikolas Zimmermann 2007-05-19 16:00:35 PDT
Hey Holger!

Patch looks perfect to me - though I can't give official r+, as parts of it are my stuff.
Will ask Oliver to check it..

Greetings,
Niko
Comment 26 Mark Rowe (bdash) 2007-05-19 16:13:32 PDT
Comment on attachment 14613 [details]
Patch to add CoverageTools

Code like:
die unless (system "...") eq 0;

feels quite unnatural.  It would read better if it were:
system("..") == 0 or die;

Is it really necessary to do find . -name '*.gc*' at the top of the WebKit source tree?  Are the *.gc* files not limited to certain directories?  Even if not, omitting LayoutTests from the search path would make this step a bit quicker.


+my $resultName = $svnVersion."-".join('_', @timeData);
Whitespace between operators would be great.

Other than these stylistic issues I see no major issues.
Comment 27 Holger Freyther 2007-05-20 14:56:09 PDT
Created attachment 14636 [details]
Scripts to generate coverage data

-Add space between the string concatination operator
-Use another way to die
-Only delete .gcda files from WebKitBuild

-Fix a bug in regenerate-coverage-display when a file got removed

Now only a rm -rf WebKitBuild/Coverage can be considered.
Comment 28 Holger Freyther 2007-05-24 02:19:01 PDT
Created attachment 14699 [details]
Scripts to generate coverage data

Run run-webkit-tests with --no-launch-safari.
Comment 29 Mark Rowe (bdash) 2007-05-27 13:17:38 PDT
Comment on attachment 14699 [details]
Scripts to generate coverage data

r=me.  Sorry I didn't get back to this sooner.
Comment 30 Sam Weinig 2007-05-27 18:47:38 PDT
Comment on attachment 14699 [details]
Scripts to generate coverage data

I would love to land this but it really needs a ChangeLog.  If you update it with one I will land ASAP.
Comment 31 Holger Freyther 2007-05-28 01:42:53 PDT
(In reply to comment #30)
> (From update of attachment 14699 [details] [edit])
> I would love to land this but it really needs a ChangeLog.  If you update it
> with one I will land ASAP.
> 
Hmm, http://bugs.webkit.org/attachment.cgi?id=14613 had the ChaneLog I don't know how I removed it, I will readd it.

Comment 32 Holger Freyther 2007-05-28 03:15:51 PDT
Created attachment 14753 [details]
Scripts to generate coverage data

This re-adds the ChangeLog entry.
Comment 33 Sam Weinig 2007-05-28 13:28:27 PDT
Landed in r21848.