提交 ab7367ed 编写于 作者: H Hyang-Ah Hana Kim 提交者: Derek Parker

Minor fixes to make some tests build and run (#752)

* cmd/dlv: fall back to go env GOPATH when GOPATH envvar is unset.

Since Go 1.8, GOPATH environment variable has a default value if the
environment variable is unset so not setting GOPATH is perfectly ok.
Depend on `go env` command to query Go related environment variable.

* build: update references to moved packages
上级 a8d11f02
......@@ -68,4 +68,4 @@ test-proc-run:
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.v -test.run="$(RUN)" $(PREFIX)/pkg/proc
test-integration-run:
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.run="$(RUN)" $(PREFIX)/pkg/service/test
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.run="$(RUN)" $(PREFIX)/service/test
......@@ -6,6 +6,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
protest "github.com/derekparker/delve/pkg/proc/test"
......@@ -20,9 +21,20 @@ func assertNoError(err error, t testing.TB, s string) {
}
}
func goEnv(name string) string {
if val := os.Getenv(name); val != "" {
return val
}
val, err := exec.Command("go", "env", name).Output()
if err != nil {
panic(err) // the Go tool was tested to work earlier
}
return strings.TrimSpace(string(val))
}
func TestBuild(t *testing.T) {
const listenAddr = "localhost:40573"
makefilepath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "derekparker", "delve", "Makefile")
makefilepath := filepath.Join(goEnv("GOPATH"), "src", "github.com", "derekparker", "delve", "Makefile")
t.Logf("makefile: %q", makefilepath)
var err error
for _, make := range []string{"make", "mingw32-make"} {
......
......@@ -5,7 +5,7 @@ import (
"log"
"os"
"github.com/derekparker/delve/terminal"
"github.com/derekparker/delve/pkg/terminal"
)
func main() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册