Skip to content

Commit bb14279

Browse files
karlklosecommit-bot@chromium.org
authored andcommitted
[infra] pkg/smith: custom test runner steps are test steps
Change-Id: I6517475d1db1cad707fb0d096e2689ea265f6a9b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133522 Commit-Queue: Karl Klose <[email protected]> Reviewed-by: Bob Nystrom <[email protected]>
1 parent 1402e8e commit bb14279

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

pkg/smith/lib/builder.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import 'configuration.dart';
99
///
1010
/// Each step on a builder runs a script the with provided arguments. If the
1111
/// script is 'tools/test.py' (which is the default if no script is given in
12-
/// the test matrix), the step is called a 'test step'. Test steps must include
13-
/// the '--named_configuration' (for short '-n') option to select the named
14-
/// [Configuration] to test.
12+
/// the test matrix), or `testRunner == true`, the step is called a 'test
13+
/// step'. Test steps must include the '--named_configuration' (for short
14+
/// '-n') option to select the named [Configuration] to test.
1515
///
16-
/// Test steps and steps with `isTestRunner == true` are expected to produce
17-
/// test results that are collected during the run of the builder and checked
18-
/// against the expected results to determine the success or failure of the
19-
/// build.
16+
/// Test steps are expected to produce test results that are collected during
17+
/// the run of the builder and checked against the expected results to determine
18+
/// the success or failure of the build.
2019
class Step {
2120
final String name;
2221
final String script;
@@ -33,7 +32,7 @@ class Step {
3332

3433
static const testScriptName = "tools/test.py";
3534

36-
bool get isTestStep => script == testScriptName;
35+
bool get isTestStep => script == testScriptName || isTestRunner;
3736

3837
/// Create a [Step] from the 'step template' [map], values for supported
3938
/// variables [configuration], and the list of supported named configurations.
@@ -44,7 +43,8 @@ class Step {
4443
.toList();
4544
var testedConfigurations = <Configuration>[];
4645
var script = map["script"] as String ?? testScriptName;
47-
if (script == testScriptName) {
46+
var isTestRunner = map["testRunner"] as bool ?? false;
47+
if (script == testScriptName || isTestRunner) {
4848
// TODO(karlklose): replace with argument parser that can handle all
4949
// arguments to test.py.
5050
for (var argument in arguments) {
@@ -80,7 +80,7 @@ class Step {
8080
<String, String>{...?map["environment"]},
8181
map["fileset"] as String,
8282
map["shards"] as int,
83-
map["testRunner"] as bool ?? false,
83+
isTestRunner,
8484
testedConfigurations.isEmpty ? null : testedConfigurations.single);
8585
}
8686
}

pkg/smith/test/builder_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ void main() {
3131
expect(step.isTestStep, isTrue);
3232
expect(step.testedConfiguration.name, "foo-x64-none-debug-d8-linux");
3333
});
34+
test("custom test runner step", () {
35+
var step = Step.parse({
36+
"name": "foo",
37+
"script": "foo.py",
38+
"testRunner": true,
39+
"arguments": ["-nfoo-x64-none-debug-d8-linux"]
40+
}, {}, configurations);
41+
expect(step.isTestStep, isTrue);
42+
expect(step.testedConfiguration.name, "foo-x64-none-debug-d8-linux");
43+
});
3444
test("implicit test step", () {
3545
var step = Step.parse({
3646
"name": "foo",

0 commit comments

Comments
 (0)