github.com/rsc/tmp@v0.0.0-20240517235954-6deaab19748b/bootstrap/bootstrap6g/all_test.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"runtime"
     7  	"testing"
     8  )
     9  
    10  var ranBenchmark bool
    11  
    12  func BenchmarkRun(b *testing.B) {
    13  	if ranBenchmark {
    14  		b.Fatal("can only run benchmark once!")
    15  	}
    16  	ranBenchmark = true
    17  	if b.N != 1 {
    18  		b.Fatal("can only run one iteration!")
    19  	}
    20  	wd, _ := os.Getwd()
    21  	root := filepath.Join(wd, "../../../../../pkg/"+runtime.GOOS+"_"+runtime.GOARCH)
    22  	if err := os.Chdir(wd + "/../internal/gc"); err != nil {
    23  		b.Fatal(err)
    24  	}
    25  	os.Args = []string{"bootstrap6g", "-o", "_bench.o", "-I", root,
    26  		"align.go",
    27  		"builtin.go",
    28  		"bv.go",
    29  		"cgen.go",
    30  		"closure.go",
    31  		"const.go",
    32  		"cplx.go",
    33  		"dcl.go",
    34  		"esc.go",
    35  		"export.go",
    36  		"fmt.go",
    37  		"gen.go",
    38  		"go.go",
    39  		"gsubr.go",
    40  		"init.go",
    41  		"inl.go",
    42  		"lex.go",
    43  		"mparith2.go",
    44  		"mparith3.go",
    45  		"obj.go",
    46  		"opnames.go",
    47  		"order.go",
    48  		"pgen.go",
    49  		"plive.go",
    50  		"popt.go",
    51  		"racewalk.go",
    52  		"range.go",
    53  		"reflect.go",
    54  		"reg.go",
    55  		"select.go",
    56  		"sinit.go",
    57  		"subr.go",
    58  		"swt.go",
    59  		"syntax.go",
    60  		"typecheck.go",
    61  		"unsafe.go",
    62  		"util.go",
    63  		"walk.go",
    64  		"y.go",
    65  		"yymsg.go",
    66  	}
    67  	main()
    68  	os.Remove("_bench.o")
    69  }