Skip to content

Commit

Permalink
Merge pull request #3229 from afbjorklund/makedepend-buildroot
Browse files Browse the repository at this point in the history
Avoid out directory, when listing test files
  • Loading branch information
tstromberg authored Jan 16, 2019
2 parents 7157b43 + d13a266 commit 457d671
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ HYPERKIT_FILES := ./cmd/drivers/hyperkit
STORAGE_PROVISIONER_FILES := ./cmd/storage-provisioner
KVM_DRIVER_FILES := ./cmd/drivers/kvm/

MINIKUBE_TEST_FILES := ./...
MINIKUBE_TEST_FILES := ./cmd/... ./pkg/...

MINIKUBE_BUILD_TAGS := container_image_ostree_stub containers_image_openpgp
MINIKUBE_INTEGRATION_BUILD_TAGS := integration $(MINIKUBE_BUILD_TAGS)
Expand Down Expand Up @@ -94,7 +94,7 @@ out/minikube-windows-amd64.exe: out/minikube-windows-amd64
cp out/minikube-windows-amd64 out/minikube-windows-amd64.exe

out/minikube.d: pkg/minikube/assets/assets.go
$(MAKEDEPEND) out/minikube-$(GOOS)-$(GOARCH) $(ORG) $(MINIKUBEFILES) $^ > $@
$(MAKEDEPEND) out/minikube-$(GOOS)-$(GOARCH) $(ORG) $^ $(MINIKUBEFILES) > $@

-include out/minikube.d
out/minikube-%-$(GOARCH): pkg/minikube/assets/assets.go
Expand Down Expand Up @@ -189,7 +189,7 @@ integration-versioned: out/minikube

.PHONY: test
out/test.d: pkg/minikube/assets/assets.go
$(MAKEDEPEND) -t test $(ORG) $(MINIKUBE_TEST_FILES) $^ > $@
$(MAKEDEPEND) -t test $(ORG) $^ $(MINIKUBE_TEST_FILES) > $@

-include out/test.d
test:
Expand Down Expand Up @@ -263,7 +263,7 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe
rm -rf out/windows_tmp

out/docker-machine-driver-hyperkit.d:
$(MAKEDEPEND) out/docker-machine-driver-hyperkit $(ORG) $(HYPERKIT_FILES) $^ > $@
$(MAKEDEPEND) out/docker-machine-driver-hyperkit $(ORG) $^ $(HYPERKIT_FILES) > $@

-include out/docker-machine-driver-hyperkit.d
out/docker-machine-driver-hyperkit:
Expand All @@ -290,7 +290,7 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile
@echo "$(@) successfully built"

out/storage-provisioner.d:
$(MAKEDEPEND) out/storage-provisioner $(ORG) $(STORAGE_PROVISIONER_FILES) $^ > $@
$(MAKEDEPEND) out/storage-provisioner $(ORG) $^ $(STORAGE_PROVISIONER_FILES) > $@

-include out/storage-provisioner.d
out/storage-provisioner:
Expand Down Expand Up @@ -327,7 +327,7 @@ release-minikube: out/minikube checksum
gsutil cp out/minikube-$(GOOS)-$(GOARCH).sha256 $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH).sha256

out/docker-machine-driver-kvm2.d:
$(MAKEDEPEND) out/docker-machine-driver-kvm2 $(ORG) $(KVM_DRIVER_FILES) $^ > $@
$(MAKEDEPEND) out/docker-machine-driver-kvm2 $(ORG) $^ $(KVM_DRIVER_FILES) > $@

-include out/docker-machine-driver-kvm2.d
out/docker-machine-driver-kvm2:
Expand Down
12 changes: 6 additions & 6 deletions makedepend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Generate go dependencies, for make. Uses `go list".
# Usage: makedepend.sh [-t] output package path [extra]
# Generate go dependencies, for make. Uses `go list`.
# Usage: makedepend.sh [-t] output package extra path...

PATH_FORMAT='{{ .ImportPath }}{{"\n"}}{{join .Deps "\n"}}'
FILE_FORMAT='{{ range $file := .GoFiles }} {{$.Dir}}/{{$file}}{{"\n"}}{{end}}'
Expand All @@ -28,14 +28,14 @@ fi

out=$1
pkg=$2
path=$3
extra=$4
extra=$3
paths="$4 $5 $6"

# check for mandatory parameters
test -n "$out$pkg$path" || exit 1
test -n "$out$pkg$paths" || exit 1

echo "$out: $extra\\"
go list -f "$PATH_FORMAT" $path |
go list -f "$PATH_FORMAT" $paths |
grep "$pkg" |
xargs go list -f "$FILE_FORMAT" |
sed -e "s|^ ${GOPATH}| \$(GOPATH)|;s/$/ \\\\/"
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "Running go tests..."
cd ${GOPATH}/src/${REPO_PATH}
rm -f out/$COV_FILE || true
echo "mode: count" > out/$COV_FILE
for pkg in $(go list -f '{{ if .TestGoFiles }} {{.ImportPath}} {{end}}' ./...); do
for pkg in $(go list -f '{{ if .TestGoFiles }} {{.ImportPath}} {{end}}' ./cmd/... ./pkg/...); do
go test -tags "container_image_ostree_stub containers_image_openpgp" -v $pkg -covermode=count -coverprofile=out/$COV_TMP_FILE
# tail -n +2 skips the first line of the file
# for coverprofile the first line is the `mode: count` line which we only want once in our file
Expand Down

0 comments on commit 457d671

Please sign in to comment.