Commit 1313f54b53 for golang

commit 1313f54b537a586f721dc4bed99ff2d689674ce5
Author: Mark Freeman <mark@golang.org>
Date:   Wed Nov 25 13:25:01 2026 -0500

    cmd/compile/internal/contraire: put head on contraire

    This just places a simple test runner on top of the driver so that
    contraire runs on the darwin longtest builders, or can be run locally
    on darwin machines.

    The syntax accepted by contraire is still minimal, so the test never
    fails. In future CLs, we can expand the grammar and start actually
    checking for bugs.

    Change-Id: I5a9f4ab928f276c4aae66b9fccbe992381d0e519
    Reviewed-on: https://go-review.googlesource.com/c/go/+/867664
    Reviewed-by: Robert Griesemer <gri@google.com>
    Auto-Submit: Mark Freeman <mark@golang.org>
    LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

diff --git a/src/cmd/compile/internal/contraire/contraire_test.go b/src/cmd/compile/internal/contraire/contraire_test.go
new file mode 100644
index 0000000000..0ddfb6cf35
--- /dev/null
+++ b/src/cmd/compile/internal/contraire/contraire_test.go
@@ -0,0 +1,64 @@
+// Copyright 2026 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build darwin
+
+package contraire
+
+import (
+	"flag"
+	"fmt"
+	"os"
+	"runtime"
+	"testing"
+)
+
+var (
+	workerFlag = flag.Bool("worker", false, "run in worker mode")
+	trialsFlag = flag.Int("trials", 0, "number of trials to run")
+	cfgFlag    = flag.String("cfg", "", "path to config JSON file")
+	outFlag    = flag.String("out", "", "path to output JSON file")
+	lckFlag    = flag.String("lock", "", "path to lock file")
+	stdFlag    = flag.Bool("std", false, "use go/types instead of types2")
+)
+
+func TestMain(m *testing.M) {
+	flag.Parse()
+	if *workerFlag {
+		if err := runWorker(*trialsFlag, *cfgFlag, *outFlag, *lckFlag, *stdFlag); err != nil {
+			fmt.Fprintln(os.Stderr, err)
+			os.Exit(1)
+		}
+		os.Exit(0)
+	}
+	os.Exit(m.Run())
+}
+
+func TestContraire(t *testing.T) {
+	if testing.Short() {
+		t.Skip("skipping in short mode")
+	}
+
+	const trials = 1_000_000
+	for _, std := range [...]bool{false, true} {
+		out, err := runDriver(t.TempDir(), trials, runtime.GOMAXPROCS(0), nil, std)
+		if err != nil {
+			t.Fatal(err)
+		}
+		t.Logf("std=%v trials=%d successes=%d typeErrors=%d", std, out.TrialsDone, out.Successes, out.TypeErrors)
+
+		if out.ParseErrors > 0 {
+			t.Errorf("std=%v: got %d parse errors, want 0", std, out.ParseErrors)
+		}
+		if out.Panic != nil {
+			t.Errorf("std=%v: panic:\n%s", std, out.Panic.Source)
+		}
+		if out.Crash != nil {
+			t.Errorf("std=%v: crash:\n%s", std, out.Crash.Source)
+		}
+		if out.Hang != nil {
+			t.Errorf("std=%v: hang:\n%s", std, out.Hang.Source)
+		}
+	}
+}
diff --git a/src/cmd/compile/internal/contraire/driver.go b/src/cmd/compile/internal/contraire/driver.go
index 24fa96d56e..b2cbdf7004 100644
--- a/src/cmd/compile/internal/contraire/driver.go
+++ b/src/cmd/compile/internal/contraire/driver.go
@@ -147,8 +147,8 @@ func (w *worker) newShard(trials int, cfgPath string, std bool) error {
 	args := []string{
 		"-worker",
 		"-trials", strconv.Itoa(trials),
-		"-o", w.outPath,
-		"-l", w.lockPath,
+		"-out", w.outPath,
+		"-lock", w.lockPath,
 	}
 	if cfgPath != "" {
 		args = append(args, "-cfg", cfgPath)