@@ -64,9 +64,10 @@ fn gather_test_suites(job_metrics: &HashMap<JobName, JobMetrics>) -> TestSuites
64
64
Some ( ( name, variant) ) => ( name. to_string ( ) , variant. to_string ( ) ) ,
65
65
None => ( test_name, "" . to_string ( ) ) ,
66
66
} ;
67
- let test_entry = suite_entry. tests . entry ( test_name. clone ( ) ) . or_insert_with ( || {
68
- Test { name : test_name. clone ( ) , revisions : Default :: default ( ) }
69
- } ) ;
67
+ let test_entry = suite_entry
68
+ . tests
69
+ . entry ( test_name. clone ( ) )
70
+ . or_insert_with ( || Test { revisions : Default :: default ( ) } ) ;
70
71
let variant_entry = test_entry
71
72
. revisions
72
73
. entry ( variant_name)
@@ -91,16 +92,12 @@ fn gather_test_suites(job_metrics: &HashMap<JobName, JobMetrics>) -> TestSuites
91
92
let mut suites = suites. into_iter ( ) . collect :: < Vec < _ > > ( ) ;
92
93
suites. sort_by ( |a, b| a. 0 . cmp ( & b. 0 ) ) ;
93
94
94
- let mut target_suites = vec ! [ ] ;
95
- for ( suite_name, suite) in suites {
96
- let suite = TestSuite {
97
- name : suite_name. clone ( ) ,
98
- group : build_test_group ( & suite_name, suite. tests ) ,
99
- } ;
100
- target_suites. push ( suite) ;
101
- }
95
+ let suites = suites
96
+ . into_iter ( )
97
+ . map ( |( suite_name, suite) | TestSuite { group : build_test_group ( & suite_name, suite. tests ) } )
98
+ . collect ( ) ;
102
99
103
- TestSuites { suites : target_suites }
100
+ TestSuites { suites }
104
101
}
105
102
106
103
/// Recursively expand a test group based on filesystem hierarchy.
@@ -115,7 +112,7 @@ fn build_test_group<'a>(name: &str, tests: BTreeMap<String, Test<'a>>) -> TestGr
115
112
116
113
if components. peek ( ) . is_none ( ) {
117
114
// This is a root test
118
- root_tests. push ( test) ;
115
+ root_tests. push ( ( name , test) ) ;
119
116
} else {
120
117
// This is a test in a nested directory
121
118
let subdir_tests =
@@ -148,7 +145,6 @@ fn normalize_test_name(name: &str, suite_name: &str) -> String {
148
145
name. trim_start_matches ( "/" ) . to_string ( )
149
146
}
150
147
151
- #[ derive( serde:: Serialize ) ]
152
148
struct TestSuites < ' a > {
153
149
suites : Vec < TestSuite < ' a > > ,
154
150
}
@@ -159,21 +155,16 @@ impl<'a> TestSuites<'a> {
159
155
}
160
156
}
161
157
162
- #[ derive( serde:: Serialize ) ]
163
158
struct TestSuite < ' a > {
164
- name : String ,
165
159
group : TestGroup < ' a > ,
166
160
}
167
161
168
- #[ derive( Debug , serde:: Serialize ) ]
169
162
struct TestResults < ' a > {
170
163
passed : Vec < TestMetadata < ' a > > ,
171
164
ignored : Vec < TestMetadata < ' a > > ,
172
165
}
173
166
174
- #[ derive( Debug , serde:: Serialize ) ]
175
167
struct Test < ' a > {
176
- name : String ,
177
168
revisions : BTreeMap < String , TestResults < ' a > > ,
178
169
}
179
170
@@ -189,7 +180,8 @@ impl<'a> Test<'a> {
189
180
}
190
181
}
191
182
192
- #[ derive( Clone , Copy , Debug , serde:: Serialize ) ]
183
+ #[ derive( Clone , Copy ) ]
184
+ #[ allow( dead_code) ]
193
185
struct TestMetadata < ' a > {
194
186
job : & ' a str ,
195
187
stage : u32 ,
@@ -198,13 +190,13 @@ struct TestMetadata<'a> {
198
190
199
191
// We have to use a template for the TestGroup instead of a macro, because
200
192
// macros cannot be recursive in askama at the moment.
201
- #[ derive( Template , serde :: Serialize ) ]
193
+ #[ derive( Template ) ]
202
194
#[ template( path = "test_group.askama" ) ]
203
195
/// Represents a group of tests
204
196
struct TestGroup < ' a > {
205
197
name : String ,
206
198
/// Tests located directly in this directory
207
- root_tests : Vec < Test < ' a > > ,
199
+ root_tests : Vec < ( String , Test < ' a > ) > ,
208
200
/// Nested directories with additional tests
209
201
groups : Vec < ( String , TestGroup < ' a > ) > ,
210
202
}
0 commit comments