summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/build_i.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/go/testdata/script/build_i.txt')
-rw-r--r--libgo/go/cmd/go/testdata/script/build_i.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/libgo/go/cmd/go/testdata/script/build_i.txt b/libgo/go/cmd/go/testdata/script/build_i.txt
new file mode 100644
index 00000000000..0e7ebed0f99
--- /dev/null
+++ b/libgo/go/cmd/go/testdata/script/build_i.txt
@@ -0,0 +1,41 @@
+env GO111MODULE=off
+
+# Test that 'go build -i' installs dependencies of the requested package.
+
+[short] skip
+
+# Since we are checking installation of dependencies, use a clean cache
+# to ensure that multiple runs of the test do not interfere.
+env GOCACHE=$WORK/cache
+
+# The initial 'go build -i' for bar should install its dependency foo.
+
+go build -v -i x/y/bar
+stderr 'x/y/foo' # should be rebuilt
+go build -v -i x/y/bar
+! stderr 'x/y/foo' # should already be installed
+
+# After modifying the source files, both packages should be rebuild.
+
+cp x/y/foo/foo.go.next x/y/foo/foo.go
+cp x/y/bar/bar.go.next x/y/bar/bar.go
+
+go build -v -i x/y/bar
+stderr 'x/y/foo' # should be rebuilt
+go build -v -i x/y/bar
+! stderr 'x/y/foo' # should already be installed
+
+-- x/y/foo/foo.go --
+package foo
+func F() {}
+-- x/y/bar/bar.go --
+package bar
+import "x/y/foo"
+func F() { foo.F() }
+-- x/y/foo/foo.go.next --
+package foo
+func F() { F() }
+-- x/y/bar/bar.go.next --
+package main
+import "x/y/foo"
+func main() { foo.F() }