mirror of
https://github.com/servo/servo.git
synced 2025-07-06 06:53:38 +01:00
Auto merge of #13798 - bholley:mach_bench, r=Wafflespeanut
Implement ./mach test-unit --bench Currently there's no way to run rust benchmark tests using mach. We can support it pretty easily, which I found useful when writing performance tests. r? @Wafflespeanut <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13798) <!-- Reviewable:end -->
This commit is contained in:
commit
887507b6f8
1 changed files with 5 additions and 3 deletions
|
@ -172,9 +172,11 @@ class MachCommands(CommandBase):
|
||||||
description='Run unit tests',
|
description='Run unit tests',
|
||||||
category='testing')
|
category='testing')
|
||||||
@CommandArgument('--package', '-p', default=None, help="Specific package to test")
|
@CommandArgument('--package', '-p', default=None, help="Specific package to test")
|
||||||
|
@CommandArgument('--bench', default=False, action="store_true",
|
||||||
|
help="Run in bench mode")
|
||||||
@CommandArgument('test_name', nargs=argparse.REMAINDER,
|
@CommandArgument('test_name', nargs=argparse.REMAINDER,
|
||||||
help="Only run tests that match this pattern or file path")
|
help="Only run tests that match this pattern or file path")
|
||||||
def test_unit(self, test_name=None, package=None):
|
def test_unit(self, test_name=None, package=None, bench=False):
|
||||||
if test_name is None:
|
if test_name is None:
|
||||||
test_name = []
|
test_name = []
|
||||||
|
|
||||||
|
@ -228,7 +230,7 @@ class MachCommands(CommandBase):
|
||||||
|
|
||||||
features = self.servo_features()
|
features = self.servo_features()
|
||||||
if len(packages) > 0:
|
if len(packages) > 0:
|
||||||
args = ["cargo", "test"]
|
args = ["cargo", "bench" if bench else "test"]
|
||||||
for crate in packages:
|
for crate in packages:
|
||||||
args += ["-p", "%s_tests" % crate]
|
args += ["-p", "%s_tests" % crate]
|
||||||
args += test_patterns
|
args += test_patterns
|
||||||
|
@ -239,7 +241,7 @@ class MachCommands(CommandBase):
|
||||||
|
|
||||||
# Run style tests with the testing feature
|
# Run style tests with the testing feature
|
||||||
if has_style:
|
if has_style:
|
||||||
args = ["cargo", "test", "-p", "style_tests", "--features"]
|
args = ["cargo", "bench" if bench else "test", "-p", "style_tests", "--features"]
|
||||||
if features:
|
if features:
|
||||||
args += ["%s" % ' '.join(features + ["testing"])]
|
args += ["%s" % ' '.join(features + ["testing"])]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue