Debian Codegraph @

go/internal/gccgoimporter/testenv_test.go

raw symbols SCIP
1 // Copyright 2018 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 // This file contains testing utilities copied from $GOROOT/src/internal/testenv/testenv.go.
6
7 package gccgoimporter
8
9 import (
10 "runtime"
11 "testing"
12
13 toolstestenv "golang.org/x/tools/internal/testenv"
14 )
15
16 // HasExec reports whether the current system can start new processes
17 // using os.StartProcess or (more commonly) exec.Command.
18 func HasExec() bool {
19 return toolstestenv.HasExec()
20 }
21
22 // MustHaveExec checks that the current system can start new processes
23 // using os.StartProcess or (more commonly) exec.Command.
24 // If not, MustHaveExec calls t.Skip with an explanation.
25 func MustHaveExec(t *testing.T) {
26 if !HasExec() {
27 t.Skipf("skipping test: cannot exec subprocess on %s/%s", runtime.GOOS, runtime.GOARCH)
28 }
29 }
30
31 var testenv = struct {
32 MustHaveExec func(*testing.T)
33 }{
34 MustHaveExec: MustHaveExec,
35 }