From 293b6379b850a18c3b67cf9b2b4a03dc12354dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 7 Sep 2022 07:44:37 +0000 Subject: [PATCH] [infra] Avoid crash in `test_runner.dart --help` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `testConfigurations` expects at least one configuration, so avoid calling it when there are no configurations. This fixes the unhandled exception with `test_runner.dart --help`: ``` No build targets found. Unhandled exception: RangeError (index): Invalid value: Valid value range is empty: 0 ``` With this commit, `--help` just prints "No build targets found" and exits with 0. This crash was previously fixed in 02a0396f743ed1964cf553d4d0f146c4b8fe5123. Change-Id: Id82c83f66871c4e811a7502f1e831a0592db2065 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257580 Reviewed-by: Bob Nystrom Commit-Queue: Ömer Ağacan --- pkg/test_runner/bin/test_runner.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/test_runner/bin/test_runner.dart b/pkg/test_runner/bin/test_runner.dart index bd1027a4b0a..d1b230d7d3b 100644 --- a/pkg/test_runner/bin/test_runner.dart +++ b/pkg/test_runner/bin/test_runner.dart @@ -44,6 +44,10 @@ void main(List arguments) async { exit(1); } + if (configurations.isEmpty) { + return; + } + // Run all of the configured tests. await testConfigurations(configurations); }