[testing] Allow test.py test list to be specified as string

Previously, this only file names were allowed. However, deflaking may
run on a different machine than determinining which tests flaked. Allow
callers to specify a list of tests instead of a file, simplifies sharded
deflaking considerably.

Change-Id: I710f9aa8a8ef696a6982851106c0e171343dc190
Reviewed-on: https://dart-review.googlesource.com/c/92561
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
This commit is contained in:
Alexander Thomas 2019-02-11 14:55:50 +00:00 committed by commit-bot@chromium.org
parent 07f2eba311
commit 859c1ffb79

View file

@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'dart:convert';
import 'package:smith/smith.dart';
@ -290,7 +291,9 @@ used for browsers to connect to.''',
new _Option.int(
'test_driver_error_port', 'Port for http test driver server errors.',
defaultsTo: 0, hide: true),
new _Option('test_list', 'File containing a list of tests to be executed'),
new _Option('test_list', 'File containing a list of tests to be executed',
hide: true),
new _Option('tests', 'A newline separated list of tests to be executed'),
new _Option(
'builder_tag',
'''Machine specific options that is not captured by the regular test
@ -501,9 +504,17 @@ compiler.''',
}
// Fetch list of tests to run, if option is present.
if (configuration['test_list'] is String) {
configuration['test_list_contents'] =
File(configuration['test_list'] as String).readAsLinesSync();
var testList = configuration['test_list'];
if (testList is String) {
configuration['test_list_contents'] = File(testList).readAsLinesSync();
}
var tests = configuration['tests'];
if (tests is String) {
if (configuration.containsKey('test_list_contents')) {
_fail('--tests and --test-list cannot be used together');
}
configuration['test_list_contents'] = LineSplitter.split(tests);
}
return _createConfigurations(configuration);