mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:07:11 +00:00
[pkg/smith] Check that each configuration is tested on at most one builder
Change-Id: I9233fa6f75dae727bc3a6951ca35792967610db0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148064 Reviewed-by: William Hesse <whesse@google.com> Commit-Queue: Karl Klose <karlklose@google.com>
This commit is contained in:
parent
c4acfb506f
commit
1ad255e8b9
3 changed files with 46 additions and 3 deletions
|
@ -99,7 +99,7 @@ class Builder {
|
|||
final Architecture arch;
|
||||
final Sanitizer sanitizer;
|
||||
final Runtime runtime;
|
||||
final List<Configuration> testedConfigurations;
|
||||
final Set<Configuration> testedConfigurations;
|
||||
|
||||
Builder(this.name, this.description, this.steps, this.system, this.mode,
|
||||
this.arch, this.sanitizer, this.runtime, this.testedConfigurations);
|
||||
|
@ -167,11 +167,11 @@ String _expandVariables(String string, Map<String, String> values) {
|
|||
return string;
|
||||
}
|
||||
|
||||
List<Configuration> _getTestedConfigurations(List<Step> steps) {
|
||||
Set<Configuration> _getTestedConfigurations(List<Step> steps) {
|
||||
return steps
|
||||
.where((step) => step.isTestStep)
|
||||
.map((step) => step.testedConfiguration)
|
||||
.toList();
|
||||
.toSet();
|
||||
}
|
||||
|
||||
T _findIfNotNull<T>(T Function(String) find, String name) {
|
||||
|
|
|
@ -56,6 +56,20 @@ class TestMatrix {
|
|||
var builders = parseBuilders(builderConfigurations, configurations);
|
||||
var branches = <String>[...?json["branches"]];
|
||||
|
||||
// Check that each configuration is tested on at most one builder.
|
||||
var testedOn = <Configuration, Builder>{};
|
||||
for (var builder in builders) {
|
||||
for (var configuration in builder.testedConfigurations) {
|
||||
if (testedOn.containsKey(configuration)) {
|
||||
var other = testedOn[configuration];
|
||||
throw FormatException('Configuration "${configuration.name}" is '
|
||||
'tested on both "${builder.name}" and "${other.name}"');
|
||||
} else {
|
||||
testedOn[configuration] = builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TestMatrix._(configurations, builders, branches);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,35 @@ void main() {
|
|||
]
|
||||
});
|
||||
});
|
||||
|
||||
test("a configuration is tested on more than one builder", () {
|
||||
expectJsonError(
|
||||
'Configuration "fasta-linux" is tested on both '
|
||||
'"test-fasta-2" and "test-fasta-1"',
|
||||
{
|
||||
"configurations": {"fasta-linux": {}},
|
||||
"builder_configurations": [
|
||||
{
|
||||
"builders": ["test-fasta-1"],
|
||||
"steps": [
|
||||
{
|
||||
"name": "fasta1",
|
||||
"arguments": [r"-nfasta-linux"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"builders": ["test-fasta-2"],
|
||||
"steps": [
|
||||
{
|
||||
"name": "fasta2",
|
||||
"arguments": [r"-nfasta-linux"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("a list of branches is parsed", () {
|
||||
|
|
Loading…
Reference in a new issue