mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
Run bindings tests with whole crate
This commit is contained in:
parent
cad5a4e326
commit
3d7c997a4f
3 changed files with 12 additions and 43 deletions
|
@ -10,6 +10,7 @@ build = "build.rs"
|
||||||
[lib]
|
[lib]
|
||||||
name = "style"
|
name = "style"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
doctest = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
gecko = []
|
gecko = []
|
||||||
|
|
|
@ -11,7 +11,6 @@ import argparse
|
||||||
import platform
|
import platform
|
||||||
import copy
|
import copy
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
|
||||||
|
|
||||||
import regen_atoms
|
import regen_atoms
|
||||||
|
|
||||||
|
@ -42,7 +41,6 @@ COMPILATION_TARGETS = {
|
||||||
# Generation of style structs.
|
# Generation of style structs.
|
||||||
"structs": {
|
"structs": {
|
||||||
"target_dir": "../gecko_bindings",
|
"target_dir": "../gecko_bindings",
|
||||||
"test": True,
|
|
||||||
"flags": [
|
"flags": [
|
||||||
"--ignore-functions",
|
"--ignore-functions",
|
||||||
"--ignore-methods",
|
"--ignore-methods",
|
||||||
|
@ -542,49 +540,11 @@ Option<&'a {0}>;".format(ty))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
print("OK")
|
print("OK")
|
||||||
|
print("(please test with ./mach test-stylo)")
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(output)
|
print(output)
|
||||||
|
|
||||||
if current_target.get("test", False) and not skip_test:
|
|
||||||
print("[RUSTC]... ", end='')
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(delete=False) as f:
|
|
||||||
test_file = f.name
|
|
||||||
output = None
|
|
||||||
try:
|
|
||||||
rustc_command = ["rustc", output_filename, "--test", "-o", test_file]
|
|
||||||
output = subprocess.check_output(rustc_command, stderr=subprocess.STDOUT)
|
|
||||||
output = output.decode('utf8')
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print("FAIL\n", e.output.decode('utf8'))
|
|
||||||
return 1
|
|
||||||
|
|
||||||
print("OK")
|
|
||||||
|
|
||||||
if verbose:
|
|
||||||
print(output)
|
|
||||||
|
|
||||||
print("[RUSTC_TEST]... ", end='')
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
try:
|
|
||||||
output = subprocess.check_output([test_file], stderr=subprocess.STDOUT)
|
|
||||||
output = output.decode('utf8')
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print("tests failed: ", e.output.decode('utf8'))
|
|
||||||
return 1
|
|
||||||
|
|
||||||
os.remove(test_file)
|
|
||||||
print("OK")
|
|
||||||
|
|
||||||
# TODO: this -3 is hacky as heck
|
|
||||||
print(output.split('\n')[-3])
|
|
||||||
|
|
||||||
if verbose:
|
|
||||||
print(output)
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,9 @@ class MachCommands(CommandBase):
|
||||||
@Command('test-stylo',
|
@Command('test-stylo',
|
||||||
description='Run stylo unit tests',
|
description='Run stylo unit tests',
|
||||||
category='testing')
|
category='testing')
|
||||||
def test_stylo(self):
|
@CommandArgument('--release', default=False, action="store_true",
|
||||||
|
help="Run with a release build of servo")
|
||||||
|
def test_stylo(self, release=False):
|
||||||
self.set_use_stable_rust()
|
self.set_use_stable_rust()
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
|
|
||||||
|
@ -268,8 +270,14 @@ class MachCommands(CommandBase):
|
||||||
env["RUST_BACKTRACE"] = "1"
|
env["RUST_BACKTRACE"] = "1"
|
||||||
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
|
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
|
||||||
|
|
||||||
|
release = ["--release"] if release else []
|
||||||
|
ret = 0
|
||||||
with cd(path.join("ports", "geckolib")):
|
with cd(path.join("ports", "geckolib")):
|
||||||
return call(["cargo", "test", "-p", "stylo_tests"], env=env)
|
ret = call(["cargo", "test", "-p", "stylo_tests"] + release, env=env)
|
||||||
|
if ret != 0:
|
||||||
|
return ret
|
||||||
|
with cd(path.join("ports", "geckolib")):
|
||||||
|
return call(["cargo", "test", "-p", "style"] + release, env=env)
|
||||||
|
|
||||||
@Command('test-compiletest',
|
@Command('test-compiletest',
|
||||||
description='Run compiletests',
|
description='Run compiletests',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue