From eae405b86586537af347dd9d733f73ceb8ff9a27 Mon Sep 17 00:00:00 2001 From: Yuqian Li Date: Thu, 15 Aug 2019 15:41:17 -0700 Subject: [PATCH 1/2] Add --no-verbose to run_test.py Without this flag, a single dart test will print out 306 lines. With this flag, a single dart test will only print out 33 lines. This helps a lot in local tests. --- testing/run_tests.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/testing/run_tests.py b/testing/run_tests.py index 307eaeb340178..8c996528e43a8 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -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, no_verbose): print "Generating snapshot for test %s" % dart_file dart = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart') @@ -145,15 +145,19 @@ def SnapshotTest(build_dir, dart_file, kernel_file_output): dart_file ] - subprocess.check_call(snapshot_command, cwd=buildroot_dir) + if (no_verbose): + with open(os.devnull,"w") as out_file: + subprocess.check_call(snapshot_command, cwd=buildroot_dir, stdout=out_file) + else: + subprocess.check_call(snapshot_command, cwd=buildroot_dir) assert os.path.exists(kernel_file_output) -def RunDartTest(build_dir, dart_file): +def RunDartTest(build_dir, dart_file, no_verbose): kernel_file_name = os.path.basename(dart_file) + '.kernel.dill' 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, no_verbose) print "Running test '%s' using 'flutter_tester'" % kernel_file_name RunEngineExecutable(build_dir, 'flutter_tester', None, [ @@ -248,7 +252,7 @@ def RunJavaTests(filter, android_variant='android_debug_unopt'): return subprocess.check_call(command) -def RunDartTests(build_dir, filter): +def RunDartTests(build_dir, filter, no_verbose): # 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/ # Before running Dart tests, make sure to run just that target (NOT the whole engine) @@ -264,7 +268,7 @@ def RunDartTests(build_dir, filter): print "Skipping %s due to filter." % dart_test_file else: print "Testing dart file %s" % dart_test_file - RunDartTest(build_dir, dart_test_file) + RunDartTest(build_dir, dart_test_file, no_verbose) def main(): parser = argparse.ArgumentParser(); @@ -281,6 +285,8 @@ def main(): parser.add_argument('--android-variant', dest='android_variant', action='store', default='android_debug_unopt', help='The engine build variant to run java tests for') + parser.add_argument('--no-verbose', dest='no_verbose', action='store_true', + default=False, help='If set, extra verbose logging will be redirect to null device.') args = parser.parse_args() @@ -300,7 +306,7 @@ def main(): if 'dart' in types: 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 - RunDartTests(build_dir, dart_filter) + RunDartTests(build_dir, dart_filter, args.no_verbose) if 'java' in types: assert not IsWindows(), "Android engine files can't be compiled on Windows." From 114e3d7d672ae0bd9e262ececb956a07eabde3be Mon Sep 17 00:00:00 2001 From: Yuqian Li Date: Thu, 15 Aug 2019 16:01:21 -0700 Subject: [PATCH 2/2] Rename flag to --verbose-dart-snapshot --- testing/run_tests.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/testing/run_tests.py b/testing/run_tests.py index 8c996528e43a8..89095d3f356df 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -117,7 +117,7 @@ def RunEngineBenchmarks(build_dir, filter): -def SnapshotTest(build_dir, dart_file, kernel_file_output, no_verbose): +def SnapshotTest(build_dir, dart_file, kernel_file_output, verbose_dart_snapshot): print "Generating snapshot for test %s" % dart_file dart = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart') @@ -145,19 +145,19 @@ def SnapshotTest(build_dir, dart_file, kernel_file_output, no_verbose): dart_file ] - if (no_verbose): + 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) - else: - subprocess.check_call(snapshot_command, cwd=buildroot_dir) assert os.path.exists(kernel_file_output) -def RunDartTest(build_dir, dart_file, no_verbose): +def RunDartTest(build_dir, dart_file, verbose_dart_snapshot): kernel_file_name = os.path.basename(dart_file) + '.kernel.dill' kernel_file_output = os.path.join(out_dir, kernel_file_name) - SnapshotTest(build_dir, dart_file, kernel_file_output, no_verbose) + SnapshotTest(build_dir, dart_file, kernel_file_output, verbose_dart_snapshot) print "Running test '%s' using 'flutter_tester'" % kernel_file_name RunEngineExecutable(build_dir, 'flutter_tester', None, [ @@ -252,7 +252,7 @@ def RunJavaTests(filter, android_variant='android_debug_unopt'): return subprocess.check_call(command) -def RunDartTests(build_dir, filter, no_verbose): +def RunDartTests(build_dir, filter, verbose_dart_snapshot): # 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/ # Before running Dart tests, make sure to run just that target (NOT the whole engine) @@ -268,7 +268,7 @@ def RunDartTests(build_dir, filter, no_verbose): print "Skipping %s due to filter." % dart_test_file else: print "Testing dart file %s" % dart_test_file - RunDartTest(build_dir, dart_test_file, no_verbose) + RunDartTest(build_dir, dart_test_file, verbose_dart_snapshot) def main(): parser = argparse.ArgumentParser(); @@ -285,8 +285,8 @@ def main(): parser.add_argument('--android-variant', dest='android_variant', action='store', default='android_debug_unopt', help='The engine build variant to run java tests for') - parser.add_argument('--no-verbose', dest='no_verbose', action='store_true', - default=False, help='If set, extra verbose logging will be redirect to null device.') + 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() @@ -306,7 +306,7 @@ def main(): if 'dart' in types: 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 - RunDartTests(build_dir, dart_filter, args.no_verbose) + RunDartTests(build_dir, dart_filter, args.verbose_dart_snapshot) if 'java' in types: assert not IsWindows(), "Android engine files can't be compiled on Windows."