From 89aa45f7c752b6c5cfcb4b61ba87cad0dfbeff73 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Sat, 18 Nov 2017 01:43:46 +0000 Subject: [PATCH] Fixes in status-update script: * Off by one error * Re-sort records: this explains why sometimes we inserted records in the wrong place. TBR Change-Id: Ie6bb404cc120cc4caced973a1e2f34dc5f55b835 Reviewed-on: https://dart-review.googlesource.com/21788 Commit-Queue: Sigmund Cherem Reviewed-by: Emily Fortuna Reviewed-by: Sigmund Cherem --- pkg/compiler/tool/status_files/update_from_log.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/compiler/tool/status_files/update_from_log.dart b/pkg/compiler/tool/status_files/update_from_log.dart index 18c34d5bfd1..d934f208991 100644 --- a/pkg/compiler/tool/status_files/update_from_log.dart +++ b/pkg/compiler/tool/status_files/update_from_log.dart @@ -77,7 +77,7 @@ mainInternal(List args, Map configurations, exit(1); } - var globalReason = args.length >= 2 ? args[2] : null; + var globalReason = args.length > 2 ? args[2] : null; updateLogs( mode, file.readAsStringSync(), configurations, statusFiles, globalReason); } @@ -91,7 +91,7 @@ void updateLogs(String mode, String log, Map configurations, List records = parse(log); records.sort(); var last; - var section; + ConfigurationInSuiteSection section; for (var record in records) { if (last == record) continue; // ignore duplicates if (section?.suite != record.suite) { @@ -155,10 +155,13 @@ class ConfigurationInSuiteSection { // same order: preserving entries that didn't change, and updating entries // where the logs show that the test status changed. - // Records are already sorted, but we sort the file contents in case the - // file has been tampered with. + // Sort the file contents in case the file has been tampered with. originalEntries.sort(); + /// Re-sort records by name (they came sorted by suite and status first, so + /// it may be wrong for the merging below). + _records.sort((a, b) => a.test.compareTo(b.test)); + var newContents = new StringBuffer(); newContents.write(_contents.substring(0, _begin)); addFromRecord(Record record) {