未验证 提交 a7c965ca 编写于 作者: L liyuqian 提交者: GitHub

Hide verbose dart snapshot during run_test.py (#11040)

Without this change, a single dart test will print out 306 lines.
With this change, a single dart test will only print out 33 lines.
This helps a lot in local tests.

In order to return to the old logging, set `--verbose-dart-snapshot` flag.
上级 81f18192
...@@ -117,7 +117,7 @@ def RunEngineBenchmarks(build_dir, filter): ...@@ -117,7 +117,7 @@ def RunEngineBenchmarks(build_dir, filter):
def SnapshotTest(build_dir, dart_file, kernel_file_output): def SnapshotTest(build_dir, dart_file, kernel_file_output, verbose_dart_snapshot):
print "Generating snapshot for test %s" % dart_file print "Generating snapshot for test %s" % dart_file
dart = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart') dart = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart')
...@@ -145,15 +145,19 @@ def SnapshotTest(build_dir, dart_file, kernel_file_output): ...@@ -145,15 +145,19 @@ def SnapshotTest(build_dir, dart_file, kernel_file_output):
dart_file dart_file
] ]
subprocess.check_call(snapshot_command, cwd=buildroot_dir) if verbose_dart_snapshot:
subprocess.check_call(snapshot_command, cwd=buildroot_dir)
else:
with open(os.devnull,"w") as out_file:
subprocess.check_call(snapshot_command, cwd=buildroot_dir, stdout=out_file)
assert os.path.exists(kernel_file_output) assert os.path.exists(kernel_file_output)
def RunDartTest(build_dir, dart_file): def RunDartTest(build_dir, dart_file, verbose_dart_snapshot):
kernel_file_name = os.path.basename(dart_file) + '.kernel.dill' kernel_file_name = os.path.basename(dart_file) + '.kernel.dill'
kernel_file_output = os.path.join(out_dir, kernel_file_name) kernel_file_output = os.path.join(out_dir, kernel_file_name)
SnapshotTest(build_dir, dart_file, kernel_file_output) SnapshotTest(build_dir, dart_file, kernel_file_output, verbose_dart_snapshot)
print "Running test '%s' using 'flutter_tester'" % kernel_file_name print "Running test '%s' using 'flutter_tester'" % kernel_file_name
RunEngineExecutable(build_dir, 'flutter_tester', None, [ RunEngineExecutable(build_dir, 'flutter_tester', None, [
...@@ -248,7 +252,7 @@ def RunJavaTests(filter, android_variant='android_debug_unopt'): ...@@ -248,7 +252,7 @@ def RunJavaTests(filter, android_variant='android_debug_unopt'):
return subprocess.check_call(command) return subprocess.check_call(command)
def RunDartTests(build_dir, filter): def RunDartTests(build_dir, filter, verbose_dart_snapshot):
# This one is a bit messy. The pubspec.yaml at flutter/testing/dart/pubspec.yaml # This one is a bit messy. The pubspec.yaml at flutter/testing/dart/pubspec.yaml
# has dependencies that are hardcoded to point to the sky packages at host_debug_unopt/ # has dependencies that are hardcoded to point to the sky packages at host_debug_unopt/
# Before running Dart tests, make sure to run just that target (NOT the whole engine) # Before running Dart tests, make sure to run just that target (NOT the whole engine)
...@@ -264,7 +268,7 @@ def RunDartTests(build_dir, filter): ...@@ -264,7 +268,7 @@ def RunDartTests(build_dir, filter):
print "Skipping %s due to filter." % dart_test_file print "Skipping %s due to filter." % dart_test_file
else: else:
print "Testing dart file %s" % dart_test_file print "Testing dart file %s" % dart_test_file
RunDartTest(build_dir, dart_test_file) RunDartTest(build_dir, dart_test_file, verbose_dart_snapshot)
def main(): def main():
parser = argparse.ArgumentParser(); parser = argparse.ArgumentParser();
...@@ -281,6 +285,8 @@ def main(): ...@@ -281,6 +285,8 @@ def main():
parser.add_argument('--android-variant', dest='android_variant', action='store', parser.add_argument('--android-variant', dest='android_variant', action='store',
default='android_debug_unopt', default='android_debug_unopt',
help='The engine build variant to run java tests for') help='The engine build variant to run java tests for')
parser.add_argument('--verbose-dart-snapshot', dest='verbose_dart_snapshot', action='store_true',
default=False, help='Show extra dart snapshot logging.')
args = parser.parse_args() args = parser.parse_args()
...@@ -300,7 +306,7 @@ def main(): ...@@ -300,7 +306,7 @@ def main():
if 'dart' in types: if 'dart' in types:
assert not IsWindows(), "Dart tests can't be run on windows. https://github.com/flutter/flutter/issues/36301." assert not IsWindows(), "Dart tests can't be run on windows. https://github.com/flutter/flutter/issues/36301."
dart_filter = args.dart_filter.split(',') if args.dart_filter else None dart_filter = args.dart_filter.split(',') if args.dart_filter else None
RunDartTests(build_dir, dart_filter) RunDartTests(build_dir, dart_filter, args.verbose_dart_snapshot)
if 'java' in types: if 'java' in types:
assert not IsWindows(), "Android engine files can't be compiled on Windows." assert not IsWindows(), "Android engine files can't be compiled on Windows."
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册