aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--ORGANIZATION.md2
-rw-r--r--components/servo/Cargo.toml5
-rw-r--r--python/servo/testing_commands.py24
-rw-r--r--tests/content/harness.js106
-rw-r--r--tests/contenttest.rs129
6 files changed, 6 insertions, 262 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1ffcbc67969..3036586fe49 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,7 +28,7 @@ If you're looking for easy bugs, have a look at the [E-Easy issue tag](https://g
comment, or you can ask for a review in `#servo` on `irc.mozilla.org`.
- Add tests relevant to the fixed bug or new feature. For a DOM change this
- will usually be a content test; for layout, a reftest. See our [testing
+ will usually be a web platform test; for layout, a reftest. See our [testing
guide](https://github.com/mozilla/servo/wiki/Testing) for more information.
For specific git instructions, see [GitHub & Critic PR handling 101](https://github.com/mozilla/servo/wiki/Github-&-Critic-PR-handling-101).
diff --git a/ORGANIZATION.md b/ORGANIZATION.md
index 90727186290..b90fae7a969 100644
--- a/ORGANIZATION.md
+++ b/ORGANIZATION.md
@@ -30,8 +30,6 @@ special integration:
## Tests
-* `tests/contenttest.rs`: Content (JavaScript) test runner.
-* `tests/content`: Content tests.
* `tests/reftest.rs`: Reference (layout) test runner.
* `tests/ref`: Reference tests.
* `tests/html`: Manual test cases and examples.
diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml
index 045b54da226..f8d3fa3aa3e 100644
--- a/components/servo/Cargo.toml
+++ b/components/servo/Cargo.toml
@@ -27,11 +27,6 @@ harness = false
[dependencies.png]
git = "https://github.com/servo/rust-png"
-[[test]]
-name = "contenttest"
-path = "../../tests/contenttest.rs"
-harness = false
-
[features]
default = ["glutin_app", "window"]
window = ["glutin_app/window"]
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index e538c79c789..b93d3689700 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -64,7 +64,6 @@ class MachCommands(CommandBase):
test_dirs = [
# path, mach test command, optional flag for path argument
- (path.join("tests", "content"), "test-content", None),
(path.join("tests", "wpt"), "test-wpt", None),
(path.join("tests", "ref"), "test-ref", ["--name"]),
]
@@ -93,7 +92,7 @@ class MachCommands(CommandBase):
return self.infer_test_by_dir(params)
test_start = time()
- for t in ["tidy", "ref", "content", "wpt", "css", "unit"]:
+ for t in ["tidy", "ref", "wpt", "css", "unit"]:
Registrar.dispatch("test-%s" % t, context=self.context)
elapsed = time() - test_start
@@ -163,23 +162,10 @@ class MachCommands(CommandBase):
@Command('test-content',
description='Run the content tests',
category='testing')
- @CommandArgument('test_name', default=None, nargs="?",
- help="Only run tests that match this pattern")
- def test_content(self, test_name=None):
- self.ensure_bootstrapped()
- self.ensure_built_tests()
- test_path = path.join(self.context.topdir, "tests", "content")
- test_args = ["--source-dir=%s" % test_path]
-
- if test_name is not None:
- test_args.append(test_name)
-
- test_start = time()
- ret = self.run_test("contenttest", test_args)
- elapsed = time() - test_start
-
- print("Content tests completed in %0.2fs" % elapsed)
- return ret
+ def test_content(self):
+ print("Content tests have been replaced by web-platform-tests under "
+ "tests/wpt/mozilla/.")
+ return 0
@Command('test-tidy',
description='Run the source code tidiness check',
diff --git a/tests/content/harness.js b/tests/content/harness.js
deleted file mode 100644
index 452c72fa67d..00000000000
--- a/tests/content/harness.js
+++ /dev/null
@@ -1,106 +0,0 @@
-function _oneline(x) {
- var i = x.indexOf("\n");
- return (i == -1) ? x : (x.slice(0, i) + "...");
-}
-
-var _expectations = 0;
-var _tests = 0;
-function expect(num) {
- _expectations = num;
-}
-
-function _fail(s, m) {
- _tests++;
- // string split to avoid problems with tests that end up printing the value of window._fail.
- window.alert(_oneline("TEST-UNEXPECTED" + "-FAIL | " + s + ": " + m));
-}
-
-function _pass(s, m) {
- _tests++;
- window.alert(_oneline("TEST-PASS | " + s + ": " + m));
-}
-
-function _printer(opstr, op) {
- return function (a, b, msg) {
- var f = op(a,b) ? _pass : _fail;
- if (!msg) msg = "";
- f(a + " " + opstr + " " + b, msg);
- };
-}
-
-var is = _printer("===", function (a,b) { return a === b; });
-var is_not = _printer("!==", function (a,b) { return a !== b; });
-var is_a = _printer("is a", function (a,b) { return a instanceof b; });
-var is_not_a = _printer("is not a", function (a,b) { return !(a instanceof b); });
-var is_in = _printer("is in", function (a,b) { return a in b; });
-var is_not_in = _printer("is not in", function (a,b) { return !(a in b); });
-var as_str_is = _printer("as string is", function (a,b) { return String(a) == b; });
-var lt = _printer("<", function (a,b) { return a < b; });
-var gt = _printer(">", function (a,b) { return a > b; });
-var leq = _printer("<=", function (a,b) { return a <= b; });
-var geq = _printer(">=", function (a,b) { return a >= b; });
-var starts_with = _printer("starts with", function (a,b) { return a.indexOf(b) == 0; });
-
-function is_function(val, name) {
- starts_with(String(val), "function " + name + "(");
-}
-
-function should_throw(f) {
- try {
- f();
- _fail("operation should have thrown but did not");
- } catch (x) {
- _pass("operation successfully threw an exception", x.toString());
- }
-}
-
-function should_not_throw(f) {
- try {
- f();
- _pass("operation did not throw an exception");
- } catch (x) {
- _fail("operation should have not thrown", x.toString());
- }
-}
-
-function check_selector(elem, selector, matches) {
- is(elem.matches(selector), matches);
-}
-
-function check_disabled_selector(elem, disabled) {
- check_selector(elem, ":disabled", disabled);
- check_selector(elem, ":enabled", !disabled);
-}
-
-var _test_complete = false;
-var _test_timeout = 10000; //10 seconds
-function finish() {
- if (_test_complete) {
- _fail('finish called multiple times');
- }
- if (_expectations > _tests) {
- _fail('expected ' + _expectations + ' tests, fullfilled ' + _tests);
- }
- _test_complete = true;
- window.close();
-}
-
-function _test_timed_out() {
- if (!_test_complete) {
- _fail('test timed out (' + _test_timeout/1000 + 's)');
- finish();
- }
-}
-
-setTimeout(_test_timed_out, _test_timeout);
-
-var _needs_finish = false;
-function waitForExplicitFinish() {
- _needs_finish = true;
-}
-
-addEventListener('load', function() {
- if (!_needs_finish) {
- finish();
- }
-});
diff --git a/tests/contenttest.rs b/tests/contenttest.rs
deleted file mode 100644
index 67e24187b96..00000000000
--- a/tests/contenttest.rs
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(collections)]
-#![feature(exit_status)]
-#![feature(path)]
-#![feature(rustc_private)]
-#![feature(std_misc)]
-#![feature(test)]
-
-extern crate getopts;
-extern crate test;
-
-use test::{AutoColor, TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
-use test::ShouldPanic;
-use getopts::{getopts, reqopt};
-use std::{str, env};
-use std::ffi::OsStr;
-use std::fs::read_dir;
-use std::process::{Command, Stdio};
-use std::thunk::Thunk;
-
-#[derive(Clone)]
-struct Config {
- source_dir: String,
- filter: Option<String>
-}
-
-fn main() {
- let args = env::args();
- let config = parse_config(args.collect());
- let opts = test_options(config.clone());
- let tests = find_tests(config);
- match run_tests_console(&opts, tests) {
- Ok(false) => env::set_exit_status(1), // tests failed
- Err(_) => env::set_exit_status(2), // I/O-related failure
- _ => (),
- }
-}
-
-fn parse_config(args: Vec<String>) -> Config {
- let args = args.tail();
- let opts = vec!(reqopt("s", "source-dir", "source-dir", "source-dir"));
- let matches = match getopts(args, &opts) {
- Ok(m) => m,
- Err(f) => panic!(f.to_string())
- };
-
- Config {
- source_dir: matches.opt_str("source-dir").unwrap(),
- filter: matches.free.first().map(|s| s.clone())
- }
-}
-
-fn test_options(config: Config) -> TestOpts {
- TestOpts {
- filter: config.filter,
- run_ignored: false,
- run_tests: true,
- run_benchmarks: false,
- logfile: None,
- nocapture: false,
- color: AutoColor,
- }
-}
-
-fn find_tests(config: Config) -> Vec<TestDescAndFn> {
- read_dir(&config.source_dir)
- .ok()
- .expect("Error reading directory.")
- .filter_map(Result::ok)
- .map(|e| e.path())
- .filter(|file| file.extension().map_or(false, |e| e == OsStr::from_str("html")))
- .map(|file| make_test(file.display().to_string()))
- .collect()
-}
-
-fn make_test(file: String) -> TestDescAndFn {
- TestDescAndFn {
- desc: TestDesc {
- name: DynTestName(file.clone()),
- ignore: false,
- should_panic: ShouldPanic::No,
- },
- testfn: DynTestFn(Thunk::new(move || { run_test(file) }))
- }
-}
-
-fn run_test(file: String) {
- let path = env::current_dir().unwrap().join(&file);
- // FIXME (#1094): not the right way to transform a path
- let infile = format!("file://{}", path.display());
- let args = ["-z", "-f", &*infile];
-
- let mut prc_arg = env::current_exe().unwrap();
- let prc_arg = match prc_arg.pop() {
- true => prc_arg.join("servo"),
- _ => panic!("could not pop directory"),
- };
- let output = match Command::new(prc_arg.to_str().unwrap())
- .args(&args)
- .stdin(Stdio::null())
- .stderr(Stdio::inherit())
- .output()
- {
- Ok(p) => p,
- _ => panic!("Unable to spawn process."),
- };
-
- print!("{}", str::from_utf8(&output.stdout).unwrap());
-
- let out = str::from_utf8(&output.stderr);
- let lines: Vec<&str> = out.unwrap().split('\n').collect();
- for &line in lines.iter() {
- if line.contains("TEST-UNEXPECTED-FAIL") {
- panic!(line.to_string());
- }
- }
-
- if !output.status.success() {
- panic!("Servo exited with non-zero status {:?}", output.status);
- }
-}