tailscale/tool/gocross/gocross_wrapper_test.go
Brad Fitzpatrick 5b086cd2ad tool/gocross: make gocross opt-in instead of opt-out
gocross is not needed like it used to be, now that Go does
version stamping itself.

We keep it for the xcode and Windows builds for now.

This simplifies things in the build, especially with upcoming build
system updates.

Updates tailscale/corp#28679
Updates tailscale/corp#26717

Change-Id: Ib4bebe6f50f3b9c3d6cd27323fca603e3dfb43cc
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-16 14:38:16 -07:00

28 lines
716 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
//go:build linux || darwin
package main
import (
"os"
"os/exec"
"strings"
"testing"
)
func TestGocrossWrapper(t *testing.T) {
for i := range 2 { // once to build gocross; second to test it's cached
cmd := exec.Command("./gocross-wrapper.sh", "version")
cmd.Env = append(os.Environ(), "CI=true", "NOBASHDEBUG=false", "TS_USE_GOCROSS=1") // for "set -x" verbosity
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("gocross-wrapper.sh failed: %v\n%s", err, out)
}
if i > 0 && !strings.Contains(string(out), "gocross_ok=1\n") {
t.Errorf("expected to find 'gocross-ok=1'; got output:\n%s", out)
}
}
}