From 94e66b3075931b3e476aa1c432721fd1cc508ea9 Mon Sep 17 00:00:00 2001 From: Joel Maher Date: Thu, 31 Mar 2011 13:08:05 -0400 Subject: [PATCH] Bug 473817 - allow conditional 'include' in reftest manifests. r=dbaron, a=test-only --- layout/tools/reftest/README.txt | 10 +++++++++- layout/tools/reftest/reftest.js | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/layout/tools/reftest/README.txt b/layout/tools/reftest/README.txt index 3ad684dba602..b8f846554aea 100644 --- a/layout/tools/reftest/README.txt +++ b/layout/tools/reftest/README.txt @@ -40,7 +40,15 @@ must be one of the following: 1. Inclusion of another manifest - include + * include + + is the same as listed below for a test item. As for + test items, multiple failure types listed on the same line are + combined by using the last matching failure type listed. However, + the failure type on a manifest is combined with the failure type on + the test (or on a nested manifest) with the rule that the last in the + following list wins: fails, random, skip. (In other words, skip + always wins, and random beats fails.) 2. A test item diff --git a/layout/tools/reftest/reftest.js b/layout/tools/reftest/reftest.js index 7d2d40cfdd3e..db1604d87676 100644 --- a/layout/tools/reftest/reftest.js +++ b/layout/tools/reftest/reftest.js @@ -121,6 +121,12 @@ const TYPE_LOAD = 'load'; // test without a reference (just test that it doe // not assert, crash, hang, or leak) const TYPE_SCRIPT = 'script'; // test contains individual test results +// The order of these constants matters, since when we have a status +// listed for a *manifest*, we combine the status with the status for +// the test by using the *larger*. +// FIXME: In the future, we may also want to use this rule for combining +// statuses that are on the same line (rather than making the last one +// win). const EXPECTED_PASS = 0; const EXPECTED_FAIL = 1; const EXPECTED_RANDOM = 2; @@ -505,12 +511,12 @@ function ReadTopManifest(aFileURL) var url = gIOService.newURI(aFileURL, null, null); if (!url) throw "Expected a file or http URL for the manifest."; - ReadManifest(url); + ReadManifest(url, EXPECTED_PASS); } // Note: If you materially change the reftest manifest parsing, // please keep the parser in print-manifest-dirs.py in sync. -function ReadManifest(aURL) +function ReadManifest(aURL, inherited_status) { var secMan = CC[NS_SCRIPTSECURITYMANAGER_CONTRACTID] .getService(CI.nsIScriptSecurityManager); @@ -558,6 +564,7 @@ function ReadManifest(aURL) var maxAsserts = 0; var needs_focus = false; var slow = false; + while (items[0].match(/^(fails|needs-focus|random|skip|asserts|slow|silentfail)/)) { var item = items.shift(); var stat; @@ -613,6 +620,8 @@ function ReadManifest(aURL) } } + expected_status = Math.max(expected_status, inherited_status); + if (minAsserts > maxAsserts) { throw "Bad range in manifest file " + aURL.spec + " line " + lineNo; } @@ -649,7 +658,7 @@ function ReadManifest(aURL) var incURI = gIOService.newURI(items[1], null, listURL); secMan.checkLoadURI(aURL, incURI, CI.nsIScriptSecurityManager.DISALLOW_SCRIPT); - ReadManifest(incURI); + ReadManifest(incURI, expected_status); } else if (items[0] == TYPE_LOAD) { if (items.length != 2 || (expected_status != EXPECTED_PASS &&