golang.org/x/build@v0.0.0-20240506185731-218518f32b70/internal/installer/darwinpkg/darwinpkg_test.go (about) 1 // Copyright 2023 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. 4 5 package darwinpkg_test 6 7 import ( 8 "context" 9 "flag" 10 "os" 11 "path/filepath" 12 "testing" 13 14 "golang.org/x/build/internal/installer/darwinpkg" 15 ) 16 17 var ( 18 inFlag = flag.String("in", "", "Path to the .tar.gz archive containing a built Go toolchain.") 19 outFlag = flag.String("out", filepath.Join(os.TempDir(), "out.pkg"), "Path where to write out the result.") 20 ) 21 22 func TestConstructInstaller(t *testing.T) { 23 if *inFlag == "" || *outFlag == "" { 24 t.Skip("skipping manual test since -in/-out flags are not set") 25 } 26 27 out, err := darwinpkg.ConstructInstaller(context.Background(), t.TempDir(), *inFlag, darwinpkg.InstallerOptions{ 28 GOARCH: "arm64", 29 MinMacOSVersion: "11", 30 }) 31 if err != nil { 32 t.Fatal("ConstructInstaller:", err) 33 } 34 if err := os.Rename(out, *outFlag); err != nil { 35 t.Fatal("moving result to output location failed:", err) 36 } 37 t.Log("constructed installer at:", *outFlag) 38 }