Skip to content

Commit 991e549

Browse files
committed
internal/core/adt: run evaluator tests in parallel
Now that a pesky data race spotted by these has been resolved in the previous commit, we can safely run these in parallel. On my laptop, `go test` drops from ~4.9s to ~1.8s, and `go test -race` drops fro ~29s to ~12s. CI should see a similar ~2.5x speed-up, given that it has 8 CPUs. This is especially nice, as the slowest step is `go test -race ./...`, and it spends most of its time in the adt package. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I105b20fa5bb54c9ce66db938f3288c9f766c6872 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1218152 Reviewed-by: Marcel van Lohuizen <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 79798ca commit 991e549

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

internal/core/adt/eval_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var (
4545

4646
// TestEvalV2 tests the old implementation of the evaluator.
4747
func TestEvalV2(t *testing.T) {
48+
t.Parallel()
4849
test := cuetxtar.TxTarTest{
4950
Root: "../../../cue/testdata",
5051
Name: "eval",
@@ -59,12 +60,14 @@ func TestEvalV2(t *testing.T) {
5960
test.ToDo = nil
6061
}
6162

62-
test.Run(t, func(tc *cuetxtar.Test) {
63-
runEvalTest(tc, internal.EvalV2, dbg, exp)
63+
test.Run(t, func(t *cuetxtar.Test) {
64+
t.Parallel()
65+
runEvalTest(t, internal.EvalV2, dbg, exp)
6466
})
6567
}
6668

6769
func TestEvalV3(t *testing.T) {
70+
t.Parallel()
6871
adt.DebugDeps = true // check unmatched dependencies.
6972

7073
test := cuetxtar.TxTarTest{
@@ -82,14 +85,13 @@ func TestEvalV3(t *testing.T) {
8285
test.ToDo = nil
8386
}
8487

85-
var errorCount int
8688
test.Run(t, func(t *cuetxtar.Test) {
87-
errorCount += runEvalTest(t, internal.EvalV3, dbg, exp)
89+
t.Parallel()
90+
runEvalTest(t, internal.EvalV3, dbg, exp)
8891
})
89-
t.Logf("nodeErrors: %d", errorCount)
9092
}
9193

92-
func runEvalTest(t *cuetxtar.Test, version internal.EvaluatorVersion, dbg cuedebug.Config, exp cueexperiment.Config) (errorCount int) {
94+
func runEvalTest(t *cuetxtar.Test, version internal.EvaluatorVersion, dbg cuedebug.Config, exp cueexperiment.Config) (errorCount int64) {
9395
exp.KeepValidators = !t.HasTag("simplifyValidators")
9496

9597
a := t.Instance()

0 commit comments

Comments
 (0)