version_tailscale_test.go 666 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. //go:build tailscale_go
  4. package tailscaleroot
  5. import (
  6. "os"
  7. "strings"
  8. "testing"
  9. )
  10. func TestToolchainMatches(t *testing.T) {
  11. tsRev, ok := tailscaleToolchainRev()
  12. if !ok {
  13. t.Fatal("failed to read build info")
  14. }
  15. want := strings.TrimSpace(GoToolchainRev)
  16. if tsRev != want {
  17. if os.Getenv("TS_PERMIT_TOOLCHAIN_MISMATCH") == "1" {
  18. t.Logf("tailscale.toolchain.rev = %q, want %q; but ignoring due to TS_PERMIT_TOOLCHAIN_MISMATCH=1", tsRev, want)
  19. return
  20. }
  21. t.Errorf("tailscale.toolchain.rev = %q, want %q; permit with TS_PERMIT_TOOLCHAIN_MISMATCH=1", tsRev, want)
  22. }
  23. }