From 758a91c1496fcef3efa0d17372920eb44d2b7f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Mon, 22 Jan 2024 23:38:50 +0100 Subject: [PATCH] Make testsuite emu/plugins/tdl pass on >= go1.20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to Go 1.20 the pseudo-random number generator was seeded like Seed(1) at program startup, but in later releases the generator is seeded randomly. Since the testcase "typeDef1" uses the "rand" op the testcase output does not always match the expected file: unit-test/exp/typeDef1.json This is due to the different random order in Go 1.20+. By setting seed=1, as previously done by Go itself, we get the same result in all Go version. - Testcase "params": { "size": 6, "offset": 0, "op": "rand", "list": ["TRex", "Cisco", "Golang"] } - Go doc: https://pkg.go.dev/math/rand@master#Seed Signed-off-by: Björn Svensson --- src/emu/plugins/tdl/tdl_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/emu/plugins/tdl/tdl_test.go b/src/emu/plugins/tdl/tdl_test.go index e367f80..cd608b9 100644 --- a/src/emu/plugins/tdl/tdl_test.go +++ b/src/emu/plugins/tdl/tdl_test.go @@ -561,6 +561,7 @@ func TestTypeDef1(t *testing.T) { initJSON: [][]byte{[]byte(initJson)}, duration: 10 * time.Second, clientsToSim: 1, + seed: 1, } a.Run(t, true) }