Skip to content

Commit 425bd5a

Browse files
athomasHixie
authored andcommitted
Make it possible to specify multiple test arguments in test.dart (flutter#13383)
This removes the FLUTTER_TEST_ARGS environment variable handling.
1 parent 33c6633 commit 425bd5a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

dev/bots/test.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final String flutter = path.join(flutterRoot, 'bin', Platform.isWindows ? 'flutt
1515
final String dart = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', Platform.isWindows ? 'dart.exe' : 'dart');
1616
final String pub = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', Platform.isWindows ? 'pub.bat' : 'pub');
1717
final String pubCache = path.join(flutterRoot, '.pub-cache');
18-
final String flutterTestArgs = Platform.environment['FLUTTER_TEST_ARGS'];
18+
final List<String> flutterTestArgs = <String>[];
1919
final bool hasColor = stdout.supportsAnsiEscapes;
2020

2121
final String bold = hasColor ? '\x1B[1m' : '';
@@ -32,17 +32,19 @@ const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
3232
'coverage': _runCoverage,
3333
};
3434

35-
/// When you call this, you can set FLUTTER_TEST_ARGS to pass custom
35+
/// When you call this, you can pass additional arguments to pass custom
3636
/// arguments to flutter test. For example, you might want to call this
37-
/// script using FLUTTER_TEST_ARGS=--local-engine=host_debug_unopt to
37+
/// script with the parameter --local-engine=host_debug_unopt to
3838
/// use your own build of the engine.
3939
///
4040
/// To run the analysis part, run it with SHARD=analyze
4141
///
4242
/// For example:
4343
/// SHARD=analyze bin/cache/dart-sdk/bin/dart dev/bots/test.dart
44-
/// FLUTTER_TEST_ARGS=--local-engine=host_debug_unopt bin/cache/dart-sdk/bin/dart dev/bots/test.dart
45-
Future<Null> main() async {
44+
/// bin/cache/dart-sdk/bin/dart dev/bots/test.dart --local-engine=host_debug_unopt
45+
Future<Null> main(List<String> args) async {
46+
flutterTestArgs.addAll(args);
47+
4648
final String shard = Platform.environment['SHARD'] ?? 'tests';
4749
if (!_kShards.containsKey(shard))
4850
throw new ArgumentError('Invalid shard: $shard');
@@ -317,7 +319,7 @@ Future<Null> _runFlutterTest(String workingDirectory, {
317319
}) {
318320
final List<String> args = <String>['test']..addAll(options);
319321
if (flutterTestArgs != null && flutterTestArgs.isNotEmpty)
320-
args.add(flutterTestArgs);
322+
args.addAll(flutterTestArgs);
321323
if (script != null)
322324
args.add(script);
323325
return _runCommand(flutter, args,

0 commit comments

Comments
 (0)