Skip to content
Permalink
Browse files

Run test-tidy on Windows

  • Loading branch information...
paulrouget committed Nov 8, 2019
1 parent df9065a commit 100ff06804089c803bad0fe2d6a0fc0375d559bc
Showing with 31 additions and 23 deletions.
  1. +11 −5 .clang-format
  2. +1 −0 etc/taskcluster/decision_task.py
  3. +19 −18 python/servo/testing_commands.py
@@ -17,7 +17,7 @@ AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -39,6 +39,7 @@ BraceWrapping:
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
@@ -79,6 +80,7 @@ MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
@@ -87,20 +89,21 @@ PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -109,6 +112,9 @@ SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
...
@@ -451,6 +451,7 @@ def windows_uwp_x64():
windows_build_task("UWP dev build", package=False)
.with_treeherder("Windows x64")
.with_script(
"python mach test-tidy --force-cpp",
"python mach build --dev --target=x86_64-uwp-windows-msvc",
"python mach package --dev --target=x86_64-uwp-windows-msvc --uwp=x64",
)
@@ -49,6 +49,7 @@
SERVO_TESTS_PATH = os.path.join("tests", "wpt", "mozilla", "tests")

CLANGFMT_CPP_DIRS = ["support/hololens/"]
CLANGFMT_VERSION = "8"

TEST_SUITES = OrderedDict([
("tidy", {"kwargs": {"all_files": False, "no_progress": False, "self_test": False,
@@ -326,8 +327,8 @@ def install_rustfmt(self):
help="Run unit tests for tidy")
@CommandArgument('--stylo', default=False, action="store_true",
help="Only handle files in the stylo tree")
@CommandArgument('--no-cpp', default=False, action="store_true", help="Skip CPP files")
def test_tidy(self, all_files, no_wpt, no_progress, self_test, stylo, no_cpp):
@CommandArgument('--force-cpp', default=False, action="store_true", help="Force CPP check")
def test_tidy(self, all_files, no_wpt, no_progress, self_test, stylo, force_cpp):
if self_test:
return test_tidy.do_tests()
else:
@@ -340,14 +341,16 @@ def test_tidy(self, all_files, no_wpt, no_progress, self_test, stylo, no_cpp):
rustfmt_failed = self.call_rustup_run(["cargo", "fmt", "--", "--check"])

clangfmt_failed = False
if not no_cpp:
available, cmd, files = setup_clangfmt()
if available:
for file in files:
stdout = subprocess.check_output([cmd, "-output-replacements-xml", file])
if len(XML(stdout)) > 0:
print("%s is not formatted correctly." % file)
clangfmt_failed = True
available, cmd, files = setup_clangfmt()
if available:
for file in files:
stdout = subprocess.check_output([cmd, "-output-replacements-xml", file])
if len(XML(stdout)) > 0:
print("%s is not formatted correctly." % file)
clangfmt_failed = True
elif force_cpp:
print("Error: can't find suitable clang-format version. Required with --force-cpp.")
return True

if rustfmt_failed or clangfmt_failed:
print("Run `./mach fmt` to fix the formatting")
@@ -476,13 +479,11 @@ def update_manifest(self, **kwargs):
@Command('fmt',
description='Format the Rust and CPP source files with rustfmt and clang-format',
category='testing')
@CommandArgument('--no-cpp', default=False, action="store_true", help="Skip CPP files")
def format_code(self, no_cpp):
def format_code(self):

if not no_cpp:
available, cmd, files = setup_clangfmt()
if available and len(files) > 0:
check_call([cmd, "-i"] + files)
available, cmd, files = setup_clangfmt()
if available and len(files) > 0:
check_call([cmd, "-i"] + files)

self.install_rustfmt()
return self.call_rustup_run(["cargo", "fmt"])
@@ -802,8 +803,8 @@ def setup_clangfmt():
try:
version = subprocess.check_output([cmd, "--version"]).rstrip()
print(version)
if not version.startswith("clang-format version 6."):
print("clang-format: wrong version (v6 required). Skipping CPP formatting.")
if not version.startswith("clang-format version {}.".format(CLANGFMT_VERSION)):
print("clang-format: wrong version (v{} required). Skipping CPP formatting.".format(CLANGFMT_VERSION))
return False, None, None
except OSError:
print("clang-format not installed. Skipping CPP formatting.")

0 comments on commit 100ff06

Please sign in to comment.
You can’t perform that action at this time.