Bug 1606960 - Add isLcovEnabled() shell function. r=nbp

Also remove the test blacklist from jit_test.py and use 'skip-if' directives
in the relevant tests instead.

Differential Revision: https://phabricator.services.mozilla.com/D58714

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ted Campbell 2020-01-06 11:19:37 +00:00
Родитель e6ba13329d
Коммит 1d9a2cd5de
15 изменённых файлов: 42 добавлений и 25 удалений

Просмотреть файл

@ -441,6 +441,12 @@ static bool GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
static bool IsLCovEnabled(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(coverage::IsLCovEnabled());
return true;
}
static bool ReturnStringCopy(JSContext* cx, CallArgs& args,
const char* message) {
JSString* str = JS_NewStringCopyZ(cx, message);
@ -6258,6 +6264,10 @@ static const JSFunctionSpecWithHelp TestingFunctions[] = {
" Return an object describing some of the configuration options SpiderMonkey\n"
" was built with."),
JS_FN_HELP("isLcovEnabled", ::IsLCovEnabled, 0, 0,
"getBuildConfiguration()",
" Return true if JS LCov support is enabled."),
JS_FN_HELP("hasChild", HasChild, 0, 0,
"hasChild(parent, child)",
" Return true if |child| is a child of |parent|, as determined by a call to\n"

Просмотреть файл

@ -256,28 +256,6 @@ def main(argv):
if read_all:
test_list = jittests.find_tests(run_binast=options.run_binast)
# Exclude tests when code coverage is enabled.
# This part is equivalent to:
# skip-if = ccov
if os.getenv('JS_CODE_COVERAGE_OUTPUT_DIR') is not None:
# JSVM errors.
options.exclude += [os.path.join('basic', 'functionnames.js')] # Bug 1369783
options.exclude += [os.path.join('debug', 'Debugger-findScripts-23.js')]
options.exclude += [os.path.join('debug', 'bug1160182.js')]
options.exclude += [os.path.join('xdr', 'incremental-encoder.js')]
options.exclude += [os.path.join('xdr', 'bug1186973.js')] # Bug 1369785
options.exclude += [os.path.join('xdr', 'relazify.js')]
options.exclude += [os.path.join('basic', 'werror.js')]
# Prevent code coverage test that expects coverage
# to be off when it starts.
options.exclude += [os.path.join('debug', 'Script-getOffsetsCoverage-02.js')]
# These tests expect functions to be parsed lazily, but lazy parsing
# is disabled on coverage build.
options.exclude += [os.path.join('debug', 'Debugger-findScripts-uncompleted-01.js')]
options.exclude += [os.path.join('debug', 'Debugger-findScripts-uncompleted-02.js')]
if options.exclude_from:
with open(options.exclude_from) as fh:
for line in fh:

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| skip-if: isLcovEnabled()
/*
* Most of these test cases are adapted from:
* http://johnjbarton.github.com/nonymous/index.html

Просмотреть файл

@ -1,4 +1,5 @@
// |jit-test| error: unreachable code
// |jit-test| error: unreachable code; skip-if: isLcovEnabled()
function f() {
return 1;
return 2;

Просмотреть файл

@ -0,0 +1 @@
// |jit-test| skip-if: isLcovEnabled()

Просмотреть файл

@ -0,0 +1 @@
// |jit-test| skip-if: isLcovEnabled()

Просмотреть файл

@ -0,0 +1,5 @@
// |jit-test| --code-coverage
// Use the `--code-coverage` shell argument must enable JS code-coverage support
// for the process.
assertEq(isLcovEnabled(), true);

Просмотреть файл

@ -0,0 +1,7 @@
// Setting the `JS_CODE_COVERAGE_OUTPUT_DIR` for will also enable coverage for
// the process.
if (os.getenv("JS_CODE_COVERAGE_OUTPUT_DIR")) {
assertEq(isLcovEnabled(), true);
}

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| skip-if: isLcovEnabled()
// If a script is (re)lazified, findScripts should not delazify it.
var dbg = new Debugger();

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| skip-if: isLcovEnabled()
// Uncompleted scripts and their inner scripts shouldn't be found in
// findScripts.

Просмотреть файл

@ -1,4 +1,4 @@
// |jit-test| --ion-pgo=off;
// |jit-test| --ion-pgo=off; skip-if: isLcovEnabled()
// This script check that when we enable / disable the code coverage collection,
// then we have different results for the getOffsetsCoverage methods.

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| skip-if: isLcovEnabled()
var g = newGlobal({newCompartment: true});
g.eval("(" + function() {
var o = {get x() {}};

Просмотреть файл

@ -1,4 +1,6 @@
// |jit-test| error: cache does not have the same size
// |jit-test| error: cache does not have the same size; skip-if: isLcovEnabled()
load(libdir + 'bytecode-cache.js');
var test = (function () {

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| skip-if: isLcovEnabled()
load(libdir + 'bytecode-cache.js');
var test = "";

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| skip-if: isLcovEnabled()
load(libdir + 'bytecode-cache.js');
var test = "";
gczeal(0);