|
153 | 153 | // Sort output in alpha order by executor and by test_type |
154 | 154 | const test_types = Object.keys(exec_summary_json); |
155 | 155 | test_types.sort() |
156 | | - /* Get all the execs */ |
| 156 | + /* Get all the executed_platforms */ |
157 | 157 | let tests_by_type_and_exec = {}; |
158 | 158 |
|
159 | 159 | // Find all the kinds of executors |
160 | 160 | let exec_set = new Set(); |
| 161 | + // And find how many tests are under each platform |
| 162 | + let exec_test_counts = {}; |
161 | 163 | for (const test_type of test_types) { |
162 | 164 | const tests = exec_summary_json[test_type]; |
163 | 165 | for (const node_version of tests) { |
164 | | - exec_set.add(node_version['version']['platform']) |
| 166 | + let this_exec = node_version['version']['platform']; |
| 167 | + exec_set.add(this_exec); |
| 168 | + if (this_exec in exec_test_counts) { |
| 169 | + exec_test_counts[this_exec] += 1; |
| 170 | + } else { |
| 171 | + exec_test_counts[this_exec] = 1; |
| 172 | + } |
| 173 | + } |
| 174 | + } |
| 175 | + |
| 176 | + // If platform/exec order is specified, use that. |
| 177 | + let executed_platforms = []; |
| 178 | + // exec_set includes all those that are represented in the data |
| 179 | + const platform_order = ["$platform_order"]; |
| 180 | + if (platform_order.length <= 0 || platform_order[0] == 'alphabetic' |
| 181 | + || platform_order[0] == "None") { |
| 182 | + // Default is alphabetic sort |
| 183 | + executed_platforms = Array.from(exec_set).sort(); |
| 184 | + } else { |
| 185 | + // Provided by the test report |
| 186 | + // Remove those that are not in the exec_set. |
| 187 | + if (platform_order[0] == 'component_count') { |
| 188 | + // Use to set the order |
| 189 | + const entries = Object.entries(exec_test_counts); |
| 190 | + // Sort with largest first |
| 191 | + entries.sort((a, b) => b[1] - a[1]); |
| 192 | + for (const [key, value] of entries) { |
| 193 | + executed_platforms.push(key); |
| 194 | + } |
| 195 | + } else { |
| 196 | + // Check for "alphabetic", "component_count", and other options. |
| 197 | + // Does this preserve order? |
| 198 | + // It should not exclude things that are in test results, |
| 199 | + // nor include things that are not there. |
| 200 | + let execs_missing_set = |
| 201 | + new Set(Array.from(exec_set)); |
| 202 | + for (let platform of platform_order) { |
| 203 | + // remove the underscores, too. |
| 204 | + const pl2 = platform.replaceAll('_', ' '); |
| 205 | + if (exec_set.has(pl2)) { |
| 206 | + executed_platforms.push(pl2); |
| 207 | + execs_missing_set.delete(pl2); |
| 208 | + } |
| 209 | + } |
| 210 | + // Make sure all the items from exec set are there, too. |
| 211 | + execs_missing_set.forEach(platform => executed_platforms.push(platform)); |
165 | 212 | } |
166 | 213 | } |
167 | 214 |
|
168 | | - const execs = Array.from(exec_set).sort(); |
169 | 215 | let th = table.insertRow(); |
170 | 216 | let td = th.insertCell(); |
171 | 217 | td.innerHTML = "Test Type"; |
172 | 218 |
|
173 | | - for (const exec of execs) { |
| 219 | + for (const exec of executed_platforms) { |
174 | 220 | td = th.insertCell(); |
175 | 221 | td.innerHTML = exec; |
176 | 222 | td.style.textAlign = 'center'; |
|
185 | 231 | td.innerHTML = test_type |
186 | 232 |
|
187 | 233 | const tests = exec_summary_json[test_type]; |
188 | | - for (const exec of execs) { |
| 234 | + for (const exec of executed_platforms) { |
189 | 235 | // Get all the report info for this test and this exec |
190 | 236 | let reports = []; |
191 | 237 | let data = [data_groups]; |
|
0 commit comments