aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/servo/build_commands.py253
-rw-r--r--python/servo/command_base.py7
-rw-r--r--python/servo/package_commands.py29
-rw-r--r--python/servo/packages.py2
-rw-r--r--python/tidy/servo_tidy/tidy.py63
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py25
6 files changed, 169 insertions, 210 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 013889f2d15..26f5da3ca25 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -197,10 +197,12 @@ class MachCommands(CommandBase):
default=None,
action='store_true',
help='Build with frame pointer enabled, used by the background hang monitor.')
+ @CommandArgument('--with-raqote', default=None, action='store_true')
+ @CommandArgument('--without-wgl', default=None, action='store_true')
def build(self, target=None, release=False, dev=False, jobs=None,
features=None, android=None, magicleap=None, no_package=False, verbose=False, very_verbose=False,
debug_mozjs=False, params=None, with_debug_assertions=False,
- libsimpleservo=False, with_frame_pointer=False):
+ libsimpleservo=False, with_frame_pointer=False, with_raqote=False, without_wgl=False):
opts = params or []
@@ -291,6 +293,12 @@ class MachCommands(CommandBase):
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C force-frame-pointers=yes"
features += ["profilemozjs"]
+ if with_raqote:
+ features += ["raqote_backend"]
+
+ if without_wgl:
+ features += ["no_wgl"]
+
if self.config["build"]["webgl-backtrace"]:
features += ["webgl-backtrace"]
if self.config["build"]["dom-backtrace"]:
@@ -618,12 +626,14 @@ class MachCommands(CommandBase):
return rv
if sys.platform == "win32":
- servo_exe_dir = os.path.dirname(self.get_binary_path(release, dev, target=target))
+ servo_exe_dir = os.path.dirname(
+ self.get_binary_path(release, dev, target=target, simpleservo=libsimpleservo)
+ )
assert os.path.exists(servo_exe_dir)
# on msvc builds, use editbin to change the subsystem to windows, but only
# on release builds -- on debug builds, it hides log output
- if not dev:
+ if not dev and not libsimpleservo:
call(["editbin", "/nologo", "/subsystem:windows", path.join(servo_exe_dir, "servo.exe")],
verbose=verbose)
# on msvc, we need to copy in some DLLs in to the servo.exe dir
@@ -648,113 +658,17 @@ class MachCommands(CommandBase):
for lib in libs:
print("WARNING: could not find " + lib)
- package_generated_shared_libraries(["nspr4.dll", "libEGL.dll"], build_path, servo_exe_dir)
+ package_generated_shared_libraries(["libEGL.dll"], build_path, servo_exe_dir)
# copy needed gstreamer DLLs in to servo.exe dir
- msvc_x64 = "64" if "x86_64" in (target or host_triple()) else ""
- gst_x64 = "X86_64" if msvc_x64 == "64" else "X86"
- gst_root = ""
- gst_default_path = path.join("C:\\gstreamer\\1.0", gst_x64)
- gst_env = "GSTREAMER_1_0_ROOT_" + gst_x64
- if os.path.exists(path.join(gst_default_path, "bin", "libffi-7.dll")) or \
- os.path.exists(path.join(gst_default_path, "bin", "ffi-7.dll")):
- gst_root = gst_default_path
- elif os.environ.get(gst_env) is not None:
- gst_root = os.environ.get(gst_env)
- else:
- print("Could not found GStreamer installation directory.")
+ target_triple = target or host_triple()
+ if "aarch64" not in target_triple:
+ print("Packaging gstreamer DLLs")
+ if not package_gstreamer_dlls(servo_exe_dir, target_triple):
+ status = 1
+ print("Packaging MSVC DLLs")
+ if not package_msvc_dlls(servo_exe_dir, target_triple):
status = 1
- gst_dlls = [
- ["libffi-7.dll", "ffi-7.dll"],
- ["libgio-2.0-0.dll", "gio-2.0-0.dll"],
- ["libglib-2.0-0.dll", "glib-2.0-0.dll"],
- ["libgmodule-2.0-0.dll", "gmodule-2.0-0.dll"],
- ["libgobject-2.0-0.dll", "gobject-2.0-0.dll"],
- ["libgstapp-1.0-0.dll", "gstapp-1.0-0.dll"],
- ["libgstaudio-1.0-0.dll", "gstaudio-1.0-0.dll"],
- ["libgstbase-1.0-0.dll", "gstbase-1.0-0.dll"],
- ["libgstgl-1.0-0.dll", "gstgl-1.0-0.dll"],
- ["libgstpbutils-1.0-0.dll", "gstpbutils-1.0-0.dll"],
- ["libgstplayer-1.0-0.dll", "gstplayer-1.0-0.dll"],
- ["libgstreamer-1.0-0.dll", "gstreamer-1.0-0.dll"],
- ["libgstrtp-1.0-0.dll", "gstrtp-1.0-0.dll"],
- ["libgstsdp-1.0-0.dll", "gstsdp-1.0-0.dll"],
- ["libgsttag-1.0-0.dll", "gsttag-1.0-0.dll"],
- ["libgstvideo-1.0-0.dll", "gstvideo-1.0-0.dll"],
- ["libgstwebrtc-1.0-0.dll", "gstwebrtc-1.0-0.dll"],
- ["libintl-8.dll", "intl-8.dll"],
- ["liborc-0.4-0.dll", "orc-0.4-0.dll"],
- ["libwinpthread-1.dll", "winpthread-1.dll"],
- ["libz.dll", "libz-1.dll", "z-1.dll"]
- ]
- if gst_root:
- for gst_lib in gst_dlls:
- if isinstance(gst_lib, str):
- gst_lib = [gst_lib]
- for lib in gst_lib:
- try:
- shutil.copy(path.join(gst_root, "bin", lib),
- servo_exe_dir)
- break
- except:
- pass
- else:
- print("ERROR: could not find required GStreamer DLL: " + str(gst_lib))
- sys.exit(1)
-
- # copy some MSVC DLLs to servo.exe dir
- msvc_redist_dir = None
- vs_platform = os.environ.get("PLATFORM", "").lower()
- vc_dir = os.environ.get("VCINSTALLDIR", "")
- vs_version = os.environ.get("VisualStudioVersion", "")
- msvc_deps = [
- "api-ms-win-crt-runtime-l1-1-0.dll",
- "msvcp140.dll",
- "vcruntime140.dll",
- ]
- # Check if it's Visual C++ Build Tools or Visual Studio 2015
- vs14_vcvars = path.join(vc_dir, "vcvarsall.bat")
- is_vs14 = True if os.path.isfile(vs14_vcvars) or vs_version == "14.0" else False
- if is_vs14:
- msvc_redist_dir = path.join(vc_dir, "redist", vs_platform, "Microsoft.VC140.CRT")
- elif vs_version == "15.0":
- redist_dir = path.join(os.environ.get("VCINSTALLDIR", ""), "Redist", "MSVC")
- if os.path.isdir(redist_dir):
- for p in os.listdir(redist_dir)[::-1]:
- redist_path = path.join(redist_dir, p)
- for v in ["VC141", "VC150"]:
- # there are two possible paths
- # `x64\Microsoft.VC*.CRT` or `onecore\x64\Microsoft.VC*.CRT`
- redist1 = path.join(redist_path, vs_platform, "Microsoft.{}.CRT".format(v))
- redist2 = path.join(redist_path, "onecore", vs_platform, "Microsoft.{}.CRT".format(v))
- if os.path.isdir(redist1):
- msvc_redist_dir = redist1
- break
- elif os.path.isdir(redist2):
- msvc_redist_dir = redist2
- break
- if msvc_redist_dir:
- break
- if msvc_redist_dir:
- redist_dirs = [
- msvc_redist_dir,
- path.join(os.environ["WindowsSdkDir"], "Redist", "ucrt", "DLLs", vs_platform),
- ]
- for msvc_dll in msvc_deps:
- dll_found = False
- for dll_dir in redist_dirs:
- dll = path.join(dll_dir, msvc_dll)
- servo_dir_dll = path.join(servo_exe_dir, msvc_dll)
- if os.path.isfile(dll):
- if os.path.isfile(servo_dir_dll):
- # avoid permission denied error when overwrite dll in servo build directory
- os.chmod(servo_dir_dll, stat.S_IWUSR)
- shutil.copy(dll, servo_exe_dir)
- dll_found = True
- break
- if not dll_found:
- print("DLL file `{}` not found!".format(msvc_dll))
- status = 1
elif sys.platform == "darwin":
# On the Mac, set a lovely icon. This makes it easier to pick out the Servo binary in tools
@@ -803,3 +717,128 @@ class MachCommands(CommandBase):
opts += params
return check_call(["cargo", "clean"] + opts,
env=self.build_env(), cwd=self.ports_glutin_crate(), verbose=verbose)
+
+
+def package_gstreamer_dlls(servo_exe_dir, target):
+ msvc_x64 = "64" if "x86_64" in target else ""
+ gst_x64 = "X86_64" if msvc_x64 == "64" else "X86"
+ gst_root = ""
+ gst_default_path = path.join("C:\\gstreamer\\1.0", gst_x64)
+ gst_env = "GSTREAMER_1_0_ROOT_" + gst_x64
+ if os.path.exists(path.join(gst_default_path, "bin", "libffi-7.dll")) or \
+ os.path.exists(path.join(gst_default_path, "bin", "ffi-7.dll")):
+ gst_root = gst_default_path
+ elif os.environ.get(gst_env) is not None:
+ gst_root = os.environ.get(gst_env)
+ else:
+ print("Could not found GStreamer installation directory.")
+ return False
+
+ gst_dlls = [
+ ["libffi-7.dll", "ffi-7.dll"],
+ ["libgio-2.0-0.dll", "gio-2.0-0.dll"],
+ ["libglib-2.0-0.dll", "glib-2.0-0.dll"],
+ ["libgmodule-2.0-0.dll", "gmodule-2.0-0.dll"],
+ ["libgobject-2.0-0.dll", "gobject-2.0-0.dll"],
+ ["libgstapp-1.0-0.dll", "gstapp-1.0-0.dll"],
+ ["libgstaudio-1.0-0.dll", "gstaudio-1.0-0.dll"],
+ ["libgstbase-1.0-0.dll", "gstbase-1.0-0.dll"],
+ ["libgstgl-1.0-0.dll", "gstgl-1.0-0.dll"],
+ ["libgstpbutils-1.0-0.dll", "gstpbutils-1.0-0.dll"],
+ ["libgstplayer-1.0-0.dll", "gstplayer-1.0-0.dll"],
+ ["libgstreamer-1.0-0.dll", "gstreamer-1.0-0.dll"],
+ ["libgstrtp-1.0-0.dll", "gstrtp-1.0-0.dll"],
+ ["libgstsdp-1.0-0.dll", "gstsdp-1.0-0.dll"],
+ ["libgsttag-1.0-0.dll", "gsttag-1.0-0.dll"],
+ ["libgstvideo-1.0-0.dll", "gstvideo-1.0-0.dll"],
+ ["libgstwebrtc-1.0-0.dll", "gstwebrtc-1.0-0.dll"],
+ ["libintl-8.dll", "intl-8.dll"],
+ ["liborc-0.4-0.dll", "orc-0.4-0.dll"],
+ ["libwinpthread-1.dll", "winpthread-1.dll"],
+ ["libz.dll", "libz-1.dll", "z-1.dll"]
+ ]
+
+ missing = []
+ for gst_lib in gst_dlls:
+ if isinstance(gst_lib, str):
+ gst_lib = [gst_lib]
+ for lib in gst_lib:
+ try:
+ shutil.copy(path.join(gst_root, "bin", lib), servo_exe_dir)
+ break
+ except:
+ pass
+ else:
+ missing += [str(gst_lib)]
+
+ for gst_lib in missing:
+ print("ERROR: could not find required GStreamer DLL: " + gst_lib)
+ return not missing
+
+
+def package_msvc_dlls(servo_exe_dir, target):
+ # copy some MSVC DLLs to servo.exe dir
+ msvc_redist_dir = None
+ vs_platforms = {
+ "x86_64": "x64",
+ "i686": "x86",
+ "aarch64": "arm64",
+ }
+ target_arch = target.split('-')[0]
+ vs_platform = vs_platforms[target_arch]
+ vc_dir = os.environ.get("VCINSTALLDIR", "") or os.environ.get("VCINSTALLDIR_SERVO")
+ vs_version = os.environ.get("VisualStudioVersion", "")
+ msvc_deps = [
+ "msvcp140.dll",
+ "vcruntime140.dll",
+ ]
+ if target_arch != "aarch64":
+ msvc_deps += ["api-ms-win-crt-runtime-l1-1-0.dll"]
+
+ # Check if it's Visual C++ Build Tools or Visual Studio 2015
+ vs14_vcvars = path.join(vc_dir, "vcvarsall.bat")
+ is_vs14 = True if os.path.isfile(vs14_vcvars) or vs_version == "14.0" else False
+ if is_vs14:
+ msvc_redist_dir = path.join(vc_dir, "redist", vs_platform, "Microsoft.VC140.CRT")
+ elif vs_version == "15.0":
+ redist_dir = path.join(vc_dir, "Redist", "MSVC")
+ if os.path.isdir(redist_dir):
+ for p in os.listdir(redist_dir)[::-1]:
+ redist_path = path.join(redist_dir, p)
+ for v in ["VC141", "VC150"]:
+ # there are two possible paths
+ # `x64\Microsoft.VC*.CRT` or `onecore\x64\Microsoft.VC*.CRT`
+ redist1 = path.join(redist_path, vs_platform, "Microsoft.{}.CRT".format(v))
+ redist2 = path.join(redist_path, "onecore", vs_platform, "Microsoft.{}.CRT".format(v))
+ if os.path.isdir(redist1):
+ msvc_redist_dir = redist1
+ break
+ elif os.path.isdir(redist2):
+ msvc_redist_dir = redist2
+ break
+ if msvc_redist_dir:
+ break
+ if not msvc_redist_dir:
+ print("Couldn't locate MSVC redistributable directory")
+ return False
+ redist_dirs = [
+ msvc_redist_dir,
+ path.join(os.environ["WindowsSdkDir"], "Redist", "ucrt", "DLLs", vs_platform),
+ ]
+ missing = []
+ for msvc_dll in msvc_deps:
+ for dll_dir in redist_dirs:
+ dll = path.join(dll_dir, msvc_dll)
+ servo_dir_dll = path.join(servo_exe_dir, msvc_dll)
+ if os.path.isfile(dll):
+ if os.path.isfile(servo_dir_dll):
+ # avoid permission denied error when overwrite dll in servo build directory
+ os.chmod(servo_dir_dll, stat.S_IWUSR)
+ shutil.copy(dll, servo_exe_dir)
+ break
+ else:
+ missing += [msvc_dll]
+
+ for msvc_dll in missing:
+ print("DLL file `{}` not found!".format(msvc_dll))
+ return not missing
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 6313fff9bfe..d39576fe9c9 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -367,7 +367,7 @@ class CommandBase(object):
def get_gstreamer_path(self):
return path.join(self.context.topdir, "support", "linux", "gstreamer", "gst")
- def get_binary_path(self, release, dev, target=None, android=False, magicleap=False):
+ def get_binary_path(self, release, dev, target=None, android=False, magicleap=False, simpleservo=False):
# TODO(autrilla): this function could still use work - it shouldn't
# handle quitting, or printing. It should return the path, or an error.
base_path = self.get_target_dir()
@@ -379,10 +379,13 @@ class CommandBase(object):
binary_name = "libmlservo.a"
elif android:
base_path = path.join(base_path, "android", self.config["android"]["target"])
- binary_name = "libsimpleservo.so"
+ simpleservo = True
elif target:
base_path = path.join(base_path, target)
+ if simpleservo:
+ binary_name = "simpleservo.dll" if sys.platform == "win32" else "libsimpleservo.so"
+
release_path = path.join(base_path, "release", binary_name)
dev_path = path.join(base_path, "debug", binary_name)
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 491abf2eb84..98ad57eee4b 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -58,6 +58,7 @@ PACKAGES = {
],
'magicleap': [
'target/magicleap/aarch64-linux-android/release/Servo2D.mpk',
+ 'target/magicleap/aarch64-linux-android/release/Servo3D.mpk',
],
'maven': [
'target/android/gradle/servoview/maven/org/mozilla/servoview/servoview-armv7/',
@@ -230,22 +231,26 @@ class PackageCommands(CommandBase):
if not env.get("MLCERT"):
raise Exception("Magic Leap builds need the MLCERT environment variable")
mabu = path.join(env.get("MAGICLEAP_SDK"), "mabu")
- package = "./support/magicleap/Servo2D/Servo2D.package"
+ packages = [
+ "./support/magicleap/Servo3D/Servo3D.package",
+ "./support/magicleap/Servo2D/Servo2D.package",
+ ]
if dev:
build_type = "lumin_debug"
else:
build_type = "lumin_release"
- argv = [
- mabu,
- "-o", target_dir,
- "-t", build_type,
- package
- ]
- try:
- subprocess.check_call(argv, env=env)
- except subprocess.CalledProcessError as e:
- print("Packaging Magic Leap exited with return value %d" % e.returncode)
- return e.returncode
+ for package in packages:
+ argv = [
+ mabu,
+ "-o", target_dir,
+ "-t", build_type,
+ package
+ ]
+ try:
+ subprocess.check_call(argv, env=env)
+ except subprocess.CalledProcessError as e:
+ print("Packaging Magic Leap exited with return value %d" % e.returncode)
+ return e.returncode
elif android:
android_target = self.config["android"]["target"]
if "aarch64" in android_target:
diff --git a/python/servo/packages.py b/python/servo/packages.py
index a2038ad9e9b..3e7e3ccf67c 100644
--- a/python/servo/packages.py
+++ b/python/servo/packages.py
@@ -4,7 +4,7 @@
WINDOWS_MSVC = {
"cmake": "3.14.3",
- "llvm": "7.0.0",
+ "llvm": "8.0.0",
"moztools": "3.2",
"ninja": "1.7.1",
"openssl": "1.0.2q-vs2017",
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 0fdda070899..b54bc35bfbf 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -524,7 +524,6 @@ def check_rust(file_name, lines):
prev_mod = {}
prev_feature_name = ""
indent = 0
- prev_indent = 0
check_alphabetical_order = config["check-alphabetical-order"]
decl_message = "{} is not in alphabetical order"
@@ -534,7 +533,6 @@ def check_rust(file_name, lines):
for idx, original_line in enumerate(lines):
# simplify the analysis
line = original_line.strip()
- prev_indent = indent
indent = len(original_line) - len(line)
is_attribute = re.search(r"#\[.*\]", line)
@@ -595,50 +593,6 @@ def check_rust(file_name, lines):
# tuple format: (pattern, format_message, filter_function(match, line))
no_filter = lambda match, line: True
regex_rules = [
- (r",[^\s]", "missing space after ,",
- lambda match, line: '$' not in line and not is_attribute),
- (r"([A-Za-z0-9_]+) (\()", "extra space after {0}",
- lambda match, line: not (
- is_attribute or
- re.match(r"\bmacro_rules!\s+", line[:match.start()]) or
- re.search(r"[^']'[A-Za-z0-9_]+ \($", line[:match.end()]) or
- match.group(1) in ['const', 'fn', 'for', 'if', 'in',
- 'let', 'match', 'mut', 'return'])),
- (r"[A-Za-z0-9\"]=", "missing space before =",
- lambda match, line: is_attribute),
- (r"=[A-Za-z0-9\"]", "missing space after =",
- lambda match, line: is_attribute),
- (r"^=\s", "no = in the beginning of line",
- lambda match, line: not is_comment),
- # ignore scientific notation patterns like 1e-6
- (r"[A-DF-Za-df-z0-9]-", "missing space before -",
- lambda match, line: not is_attribute),
- (r"[A-Za-z0-9]([\+/\*%=])", "missing space before {0}",
- lambda match, line: (not is_attribute and
- not is_associated_type(match, line))),
- # * not included because of dereferencing and casting
- # - not included because of unary negation
- (r'([\+/\%=])[A-Za-z0-9"]', "missing space after {0}",
- lambda match, line: (not is_attribute and
- not is_associated_type(match, line))),
- (r"\)->", "missing space before ->", no_filter),
- (r"->[A-Za-z]", "missing space after ->", no_filter),
- (r"[^ ]=>", "missing space before =>", lambda match, line: match.start() != 0),
- (r"=>[^ ]", "missing space after =>", lambda match, line: match.end() != len(line)),
- (r"=> ", "extra space after =>", no_filter),
- # ignore " ::crate::mod" and "trait Foo : Bar"
- (r" :[^:]", "extra space before :",
- lambda match, line: 'trait ' not in line[:match.start()]),
- # ignore "crate::mod" and ignore flagging macros like "$t1:expr"
- (r"[^:]:[A-Za-z0-9\"]", "missing space after :",
- lambda match, line: '$' not in line[:match.end()]),
- (r"[A-Za-z0-9\)]{", "missing space before {{", no_filter),
- # ignore cases like "{}", "}`", "}}" and "use::std::{Foo, Bar}"
- (r"[^\s{}]}[^`]", "missing space before }}",
- lambda match, line: not re.match(r'^(pub )?use', line)),
- # ignore cases like "{}", "`{", "{{" and "use::std::{Foo, Bar}"
- (r"[^`]{[^\s{}]", "missing space after {{",
- lambda match, line: not re.match(r'^(pub )?use', line)),
# There should not be any extra pointer dereferencing
(r": &Vec<", "use &[T] instead of &Vec<T>", no_filter),
# No benefit over using &str
@@ -652,22 +606,12 @@ def check_rust(file_name, lines):
# No benefit to using &Root<T>
(r": &Root<", "use &T instead of &Root<T>", no_filter),
(r"^&&", "operators should go at the end of the first line", no_filter),
- (r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import",
- lambda match, line: line.startswith('use ')),
- (r"^\s*else {", "else braces should be on the same line", no_filter),
- (r"[^$ ]\([ \t]", "extra space after (", no_filter),
# This particular pattern is not reentrant-safe in script_thread.rs
(r"match self.documents.borrow", "use a separate variable for the match expression",
lambda match, line: file_name.endswith('script_thread.rs')),
# -> () is unnecessary
(r"-> \(\)", "encountered function signature with -> ()", no_filter),
]
- keywords = ["if", "let", "mut", "extern", "as", "impl", "fn", "struct", "enum", "pub", "mod",
- "use", "in", "ref", "type", "where", "trait"]
- extra_space_after = lambda key: (r"(?<![A-Za-z0-9\-_]){key} ".format(key=key),
- "extra space after {key}".format(key=key),
- lambda match, line: not is_attribute)
- regex_rules.extend(map(extra_space_after, keywords))
for pattern, message, filter_func in regex_rules:
for match in re.finditer(pattern, line):
@@ -678,13 +622,6 @@ def check_rust(file_name, lines):
yield (idx + 1, "found an empty line following a {")
prev_open_brace = line.endswith("{")
- # ensure a line starting with { or } has a number of leading spaces that is a multiple of 4
- if line.startswith(("{", "}")):
- match = re.match(r"(?: {4})* {1,3}([{}])", original_line)
- if match:
- if indent != prev_indent - 4:
- yield (idx + 1, "space before {} is not a multiple of 4".format(match.group(1)))
-
# check alphabetical order of extern crates
if line.startswith("extern crate "):
# strip "extern crate " from the begin and ";" from the end
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index c1dec57ab89..280190931c2 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -104,41 +104,16 @@ class CheckTidiness(unittest.TestCase):
def test_rust(self):
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust], print_text=False)
- self.assertEqual('extra space after use', errors.next()[2])
- self.assertEqual('missing space before }', errors.next()[2])
- self.assertEqual('use statement contains braces for single import', errors.next()[2])
self.assertTrue('mod declaration is not in alphabetical order' in errors.next()[2])
self.assertEqual('mod declaration spans multiple lines', errors.next()[2])
self.assertTrue('extern crate declaration is not in alphabetical order' in errors.next()[2])
self.assertTrue('derivable traits list is not in alphabetical order' in errors.next()[2])
self.assertEqual('found an empty line following a {', errors.next()[2])
- self.assertEqual('missing space before ->', errors.next()[2])
- self.assertEqual('missing space after ->', errors.next()[2])
- self.assertEqual('missing space after :', errors.next()[2])
- self.assertEqual('missing space before {', errors.next()[2])
- self.assertEqual('missing space before =', errors.next()[2])
- self.assertEqual('missing space after =', errors.next()[2])
- self.assertEqual('missing space before -', errors.next()[2])
- self.assertEqual('missing space before *', errors.next()[2])
- self.assertEqual('missing space after =>', errors.next()[2])
- self.assertEqual('missing space after :', errors.next()[2])
- self.assertEqual('missing space after :', errors.next()[2])
- self.assertEqual('extra space before :', errors.next()[2])
- self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
self.assertEqual('use &str instead of &String', errors.next()[2])
self.assertEqual('use &T instead of &Root<T>', errors.next()[2])
self.assertEqual('encountered function signature with -> ()', errors.next()[2])
self.assertEqual('operators should go at the end of the first line', errors.next()[2])
- self.assertEqual('else braces should be on the same line', errors.next()[2])
- self.assertEqual('extra space after (', errors.next()[2])
- self.assertEqual('extra space after (', errors.next()[2])
- self.assertEqual('extra space after (', errors.next()[2])
- self.assertEqual('extra space after test_fun', errors.next()[2])
- self.assertEqual('no = in the beginning of line', errors.next()[2])
- self.assertEqual('space before { is not a multiple of 4', errors.next()[2])
- self.assertEqual('space before } is not a multiple of 4', errors.next()[2])
- self.assertEqual('extra space after if', errors.next()[2])
self.assertNoMoreErrors(errors)
feature_errors = tidy.collect_errors_for_files(iterFile('lib.rs'), [], [tidy.check_rust], print_text=False)