Bug 751842 part 5 - Put testharness.js expected fails in one file per test; r=jhammel

--HG--
rename : dom/imptests/testharnessreport.js.in => dom/imptests/testharnessreport.js
This commit is contained in:
Aryeh Gregor 2012-05-15 09:35:31 +03:00
parent a19ab745bc
commit c2de3df2b1
23 changed files with 142 additions and 128 deletions

View File

@ -9,6 +9,9 @@ VPATH = @srcdir@
relativesrcdir = dom/imported-tests
DIRS = \
failures/webapps/WebStorage/tests/submissions/Ms2ger \
failures/webapps/WebStorage/tests/submissions/Infraware \
failures/webapps/DOMCore/tests/submissions/Opera \
$(NULL)
include $(srcdir)/html.mk
@ -24,8 +27,5 @@ _SUPPORT_FILES = \
WebIDLParser.js \
$(NULL)
testharnessreport.js: testharnessreport.js.in writeReporter.py failures.txt html.json webapps.json
$(PYTHON_PATH) $(srcdir)/writeReporter.py $<
libs:: $(_SUPPORT_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/resources

View File

@ -38,7 +38,7 @@ Source; Usage and purpose; License
<https://bitbucket.org/ms2ger/test-runner/raw/tip/manifests.txt>.
MIT License
* testharnessreport.js.in
* testharnessreport.js
Glue between testharness.js and our Mochitest runner.
MPL
@ -54,11 +54,10 @@ Source; Usage and purpose; License
includes a .mk file for each repository.
MPL
* failures.txt
List of JSON files with expected failures.
* html.json / webapps.json / ...
Expected failures for tests in the webapps repository.
* failures/
Expected failures for tests in each repository. Each test's failures, if
any, are in a file with the same path and name with .json appended. New
expected fail files currently needed to be added manually to makefiles.
* html.mk / webapps.mk / ...
Generated by importTestsuite.py from webapps.txt.
@ -74,11 +73,6 @@ Source; Usage and purpose; License
Actual tests.
W3C Test Suite License / W3C 3-clause BSD License
* writeReporter.py
Generates testharness.js from testharnessreport.js.in and the JSON files for
repositories listed in failures.txt.
MPL
=====================================================================
Importing an additional directory from an already-imported repository
@ -94,4 +88,5 @@ Importing a new test suite
==========================
Create a data file in the format documented above, and run the
importTestsuite.py script, passing the data file as its argument.
importTestsuite.py script, passing the data file as its argument. Add any
necessary files in failures/.

View File

@ -1,2 +0,0 @@
html
webapps

View File

@ -0,0 +1,20 @@
DEPTH = ../../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/imptests/failures/webapps/DOMCore/tests/submissions/Opera
DIRS = \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_getElementsByClassName-10.xml.json \
test_getElementsByClassName-11.xml.json \
$(NULL)
libs:: $(_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,3 @@
{
"document.getElementsByClassName(): compound": true
}

View File

@ -0,0 +1,3 @@
{
"document.getElementsByClassName(): \"tricky\" compound": true
}

View File

@ -0,0 +1,20 @@
DEPTH = ../../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/imptests/failures/webapps/WebStorage/tests/submissions/Infraware
DIRS = \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_event_constructor.html.json \
test_storage_local_security.html.json \
$(NULL)
libs:: $(_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,3 @@
{
"storageeventinit test": true
}

View File

@ -0,0 +1,3 @@
{
"storage local security test": true
}

View File

@ -0,0 +1,27 @@
DEPTH = ../../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/imptests/failures/webapps/WebStorage/tests/submissions/Ms2ger
DIRS = \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_event_constructor_js.html.json \
test_storage_local_getitem_js.html.json \
test_storage_local_index_js.html.json \
test_storage_local_in_js.html.json \
test_storage_local_removeitem_js.html.json \
test_storage_session_getitem_js.html.json \
test_storage_session_index_js.html.json \
test_storage_session_in_js.html.json \
test_storage_session_removeitem_js.html.json \
$(NULL)
libs:: $(_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,3 @@
{
"StorageEvent constructor and nulls": true
}

View File

@ -0,0 +1,5 @@
{
"All 3 items should be added.": true,
"array access should be correct": true,
"getItem should be correct": true
}

View File

@ -0,0 +1,3 @@
{
"Web Storage 1": true
}

View File

@ -0,0 +1,5 @@
{
"Web Storage 1": true,
"Web Storage 2": true,
"Web Storage 3": true
}

View File

@ -0,0 +1,4 @@
{
"Web Storage 2": true,
"Web Storage 3": true
}

View File

@ -0,0 +1,5 @@
{
"All 3 items should be added.": true,
"array access should be correct": true,
"getItem should be correct": true
}

View File

@ -0,0 +1,3 @@
{
"Web Storage 1": true
}

View File

@ -0,0 +1,5 @@
{
"Web Storage 1": true,
"Web Storage 2": true,
"Web Storage 3": true
}

View File

@ -0,0 +1,4 @@
{
"Web Storage 2": true,
"Web Storage 3": true
}

View File

@ -1,2 +0,0 @@
{
}

View File

@ -9,10 +9,8 @@ var W3CTest = {
* names to either the boolean |true|, or the string "debug". The former
* means that this test is expected to fail in all builds, and the latter
* that it is only expected to fail in debug builds.
*
* This is filled in by the writeReporter.py script.
*/
"expectedFailures": ${expectations},
"expectedFailures": {},
/**
* List of test results, needed by TestRunner to update the UI.
@ -68,14 +66,11 @@ var W3CTest = {
/**
* Returns true if this test is expected to fail, and false otherwise.
*/
"_todo": function(url, test) {
if (!(url in this.expectedFailures)) {
return false;
}
if (this.expectedFailures[url] === "all") {
"_todo": function(test) {
if (this.expectedFailures === "all") {
return true;
}
var value = this.expectedFailures[url][test.name];
var value = this.expectedFailures[test.name];
return value === true || (value === "debug" && !!SpecialPowers.isDebugBuild);
},
@ -88,7 +83,7 @@ var W3CTest = {
this.report({
"message": test.message || test.name,
"result": test.status === test.PASS,
"todo": this._todo(url, test)
"todo": this._todo(test)
});
},
@ -112,6 +107,17 @@ var W3CTest = {
if (!W3CTest.runner) {
return;
}
// Get expected fails. If there aren't any, there will be a 404, which is
// fine. Anything else is unexpected.
var request = new XMLHttpRequest();
request.open("GET", "/tests/dom/imptests/failures/" + W3CTest.getURL() + ".json", false);
request.send();
if (request.status === 200) {
W3CTest.expectedFailures = JSON.parse(request.responseText);
} else if (request.status !== 404) {
is(request.status, 404, "Request status neither 200 nor 404");
}
add_result_callback(W3CTest.result.bind(W3CTest));
add_completion_callback(W3CTest.finish.bind(W3CTest));
setup({

View File

@ -1,63 +0,0 @@
{
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml": {
"document.getElementsByClassName(): compound": true
},
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml": {
"document.getElementsByClassName(): \"tricky\" compound": true
},
"webapps/WebStorage/tests/submissions/Infraware/test_event_constructor.html": {
"storageeventinit test": true
},
"webapps/WebStorage/tests/submissions/Infraware/test_storage_local_security.html": {
"storage local security test": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_event_constructor_js.html": {
"StorageEvent constructor and nulls": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_getitem_js.html": {
"All 3 items should be added.": true,
"array access should be correct": true,
"getItem should be correct": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_in_js.html": {
"Web Storage 1": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_index_js.html": {
"Web Storage 1": true,
"Web Storage 2": true,
"Web Storage 3": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_removeitem_js.html": {
"Web Storage 2": true,
"Web Storage 3": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_getitem_js.html": {
"All 3 items should be added.": true,
"array access should be correct": true,
"getItem should be correct": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_in_js.html": {
"Web Storage 1": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_index_js.html": {
"Web Storage 1": true,
"Web Storage 2": true,
"Web Storage 3": true
},
"webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_removeitem_js.html": {
"Web Storage 2": true,
"Web Storage 3": true
}
}

View File

@ -1,36 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import string
try:
import json
except ImportError:
import simplejson as json
def writeReporter(src):
src = src.replace("testharnessreport.js.in", "")
expectations = {}
fp = open(src + "failures.txt", "rb")
for line in fp:
gp = open(src + line.strip() + ".json")
expectations.update(json.load(gp))
gp.close()
fp.close()
fp = open(src + "testharnessreport.js.in", "rb")
template = fp.read()
fp.close()
fp = open("testharnessreport.js", "wb")
expjson = json.dumps(expectations,
indent = 2,
sort_keys = True,
separators = (',', ': '))
result = string.Template(template).substitute({ 'expectations': expjson })
fp.write(result)
fp.close()
if __name__ == "__main__":
writeReporter(sys.argv[1])