|
|
Line 53: |
Line 53: |
|
| |
|
|
| |
|
| As of now, there is a bug https://bugzilla.mozilla.org/show_bug.cgi?id=461270 which prevents the NSPR from getting linked in the code coverage mode.
| |
|
| |
|
|
| |
| The work around to address this problem is as follows:
| |
|
| |
|
| |
| Modify [ in the trunk you checked out ] src/nsprpub/config/rules.mk on line #352
| |
| Change it
| |
| from $(MKSHLIB) $(OBJS) $(RES) $(EXTRA_LIBS)
| |
| to $(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(EXTRA_LIBS)
| |
|
| |
|
| |
| Execute the usual build command 'make -f client.mk build'
| |
|
| |
|
| |
| Please make sure that you have all the build dependencies installed properly before attempting the build.
| |
|
| |
|
| |
| A bunch of javascript files gets ‘jar’ed’ into the
| |
|
| |
| Once the build is ready , all you have to do is to go into ~/mozcentral-dbg/dist/bin/chrome directory.
| |
|
| |
|
| |
| You have to unjar all the java script files and modify the jar manifest files to point to appropriate un-jarred directories instead of jar files.
| |
|
| |
|
| |
| Sounds confusing !! Don’t worry, please execute the following perl script expandJar.pl to do all that job for you.
| |
|
| |
|
| |
| Syntax : perl expandJar.pl ~/mozcentral-dbg/dist/bin/chrome
| |
|
| |
|
| |
| Now, we have to instrument the javascript files.
| |
|
| |
|
| |
| Code coverage for the Javascript part of the Firefox can be done in multiple ways. But using JSCoverage as the tool seemed to be the best way as JSCoverage is an open source tool.
| |
|
| |
|
| |
| I wish to fully acknowledge the great help Ed Kelly , who maintains the JSCoverage tool , provided in this instrumentation exercise. Ed was very generous in spending cycles to provide enhancements to the JSCoverage tool to meet Firefox instrumentation requirements.
| |
|
| |
|
| |
| So ... here is how to instrument the javascript portion of Firefox.
| |
|
| |
|
| |
| Do not download the binary of the JScoverage from
| |
| http://siliconforks.com/jscoverage/
| |
|
| |
| You should check out the source code from its public Subversion repository:
| |
|
| |
| svn co http://svn.siliconforks.com/jscoverage/trunk jscoverage
| |
| To compile, run bootstrap.sh (requires Automake and Autoconf):
| |
|
| |
| ./bootstrap.sh
| |
| Then run make as usual.
| |
| Finally execute the make install command so that jscoverage is
| |
| installed in the /usr/local/bin
| |
|
| |
|
| |
| Why not use the binary from the site and why to build our own jscoverage !!
| |
|
| |
|
| |
| The following enhancements are present in our own build with latest revision.
| |
|
| |
| 1. Instrumenting symbolic links in the case where the destination is a regular file.
| |
|
| |
| For those who are curious, JSCoverage does not instrument javascript files that are symbolically referenced.
| |
|
| |
| 2. It copies file permissions (so that executable files stay executable).
| |
|
| |
| 3. It has the --mozilla option to copy the jscoverage.html file directly into Firefox's chrome.
| |
|
| |
| The --mozilla option automatically sets the JavaScript version to 180,so it is not necessary to use both --mozilla and --js-version at the same time.
| |
|
| |
| NOTE: --js-version=180 would allow instrumenting the symbolic links
| |
|
| |
|
| |
| So, starting from the top of the Firefox build (~/mozcentral-dbg )directory , here are the commands to instrument the whole Firefox directory and run the mochitests with the instrumented version:
| |
|
| |
|
| |
| cd /dist
| |
| mv bin bin-original
| |
| jscoverage \
| |
| --mozilla \
| |
| --no-instrument=defaults \
| |
| --no-instrument=greprefs \
| |
| bin-original bin
| |
|
| |
|
| |
| HINT: If you find a foobar.js file failing in the javascript instrumentation exercise, please add it to the no-instrument list using the following syntax --no-instrument=/path/to/foobar.js
| |
|
| |
|
| |
| It seems that it is necessary to use --no-instrument on the entire defaults and prefs directories because the preferences .js files should not contain arbitrary JavaScript.
| |
|
| |
|
|
| |
|