mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 12:47:22 +08:00
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
This commit is contained in:
committed by
Derek Parker
parent
a8d11f02a8
commit
ab7367ed2b
2
Makefile
2
Makefile
@ -68,4 +68,4 @@ test-proc-run:
|
|||||||
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.v -test.run="$(RUN)" $(PREFIX)/pkg/proc
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.v -test.run="$(RUN)" $(PREFIX)/pkg/proc
|
||||||
|
|
||||||
test-integration-run:
|
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"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
protest "github.com/derekparker/delve/pkg/proc/test"
|
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) {
|
func TestBuild(t *testing.T) {
|
||||||
const listenAddr = "localhost:40573"
|
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)
|
t.Logf("makefile: %q", makefilepath)
|
||||||
var err error
|
var err error
|
||||||
for _, make := range []string{"make", "mingw32-make"} {
|
for _, make := range []string{"make", "mingw32-make"} {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/derekparker/delve/terminal"
|
"github.com/derekparker/delve/pkg/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user