Fix sorting issue causing sporadic failures
Some type of synchronization issue with sorting and slices that causes
this to fail. On Cq and locally.
Going to a simple string sort instead of the entire array to resolve the
issue.
BUG=None
TEST=10x execution of unit test
Change-Id: Ie86b4f9ce91eb09cd801f6a31bd3337e0cdaff76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/3024626
Tested-by: C Shapiro <shapiroc@chromium.org>
Auto-Submit: C Shapiro <shapiroc@chromium.org>
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
Commit-Queue: Derek Beckett <dbeckett@chromium.org>
diff --git a/src/chromiumos/test/execution/cmd/testexecserver/internal/driver/tauto_driver_test.go b/src/chromiumos/test/execution/cmd/testexecserver/internal/driver/tauto_driver_test.go
index c551707..80dcd44 100644
--- a/src/chromiumos/test/execution/cmd/testexecserver/internal/driver/tauto_driver_test.go
+++ b/src/chromiumos/test/execution/cmd/testexecserver/internal/driver/tauto_driver_test.go
@@ -43,22 +43,17 @@
var expectedArgList []string
- runIndex := len(expectedArgList)
for key, value := range args.runFlags {
expectedArgList = append(expectedArgList, fmt.Sprintf("%v=%v", key, value))
}
- dutIndex := len(expectedArgList)
expectedArgList = append(expectedArgList, dut1)
expectedArgList = append(expectedArgList, test1)
expectedArgList = append(expectedArgList, test2)
argList := genTautoArgList(&args)
- // Sort both lists so that we can compare them.
- sort.Sort(sort.StringSlice(expectedArgList[0:runIndex]))
- sort.Sort(sort.StringSlice(argList[0:runIndex]))
- sort.Sort(sort.StringSlice(expectedArgList[runIndex+1 : dutIndex]))
- sort.Sort(sort.StringSlice(argList[runIndex+1 : dutIndex]))
+ sort.Strings(argList)
+ sort.Strings(expectedArgList)
if diff := cmp.Diff(argList, expectedArgList, cmp.AllowUnexported(tautoRunArgs{})); diff != "" {
t.Errorf("Got unexpected argument from genTautoArgList (-got %v +want %v):\n%s", argList, expectedArgList, diff)