1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
15 // Test that the generated code for the lock rank graph is up-to-date.
16 func TestLockRankGenerated(t *testing.T) {
17 testenv.MustHaveGoRun(t)
18 cmd := testenv.CleanCmdEnv(testenv.Command(t, testenv.GoToolPath(t), "run", "mklockrank.go"))
19 want, err := cmd.Output()
21 if ee, ok := err.(*exec.ExitError); ok && len(ee.Stderr) > 0 {
22 t.Fatalf("%v: %v\n%s", cmd, err, ee.Stderr)
24 t.Fatalf("%v: %v", cmd, err)
26 got, err := os.ReadFile("lockrank.go")
30 if !bytes.Equal(want, got) {
31 t.Fatalf("lockrank.go is out of date. Please run go generate.")