From d6e0b326e1fb7994ec3f3c7fef6297f9cf578ac1 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 14 Dec 2016 17:59:41 -0600 Subject: [PATCH] Makefile with unit tests Skip examples in unit tests Change-Id: I4e5673a33d45acaf13e3b08ff7b18d6bbf59a973 --- Makefile | 45 +++++++++++++++++++++++++++++++++++ examples/00-authentication.go | 2 ++ examples/10-objectstore.go | 2 ++ examples/30-image-v1.go | 2 ++ examples/40-volume-v2.go | 2 ++ examples/setup.go | 2 ++ 6 files changed, 55 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c38edf2 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +# golang-client Makefile +# Follows the interface defined in the Golang CTI proposed +# in https://review.openstack.org/410355 + +#REPO_VERSION?=$(shell git describe --tags) + +GIT_HOST = git.openstack.org + +PWD := $(shell pwd) +TOP_DIR := $(shell basename $(PWD)) +export GOPATH := $(PWD)-gopath +DEST := $(GOPATH)/src/$(GIT_HOST)/openstack/$(TOP_DIR).git + +env: + @echo "PWD: $(PWD)" + @echo "TOP_DIR: $(TOP_DIR)" + @echo "GOPATH: $(GOPATH)" + @echo "DEST: $(DEST)" + +work: $(GOPATH) + +$(GOPATH): + mkdir -p $(shell dirname $(DEST)) + ln -s $(PWD) $(DEST) + +get: work + cd $(DEST); go get -tags=unit -t ./... + +test: get + cd $(DEST); go test -tags=unit ./... + +fmt: + cd $(DEST); go fmt ./... + +cover: + @echo "$@ not yet implemented" + +docs: + @echo "$@ not yet implemented" + +relnotes: + @echo "Reno not yet implemented for this repo" + +translation: + @echo "$@ not yet implemented" diff --git a/examples/00-authentication.go b/examples/00-authentication.go index 56dd75f..690c5dd 100644 --- a/examples/00-authentication.go +++ b/examples/00-authentication.go @@ -1,3 +1,5 @@ +// +build !unit + // Copyright (c) 2014 Hewlett-Packard Development Company, L.P. // // Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/examples/10-objectstore.go b/examples/10-objectstore.go index 33fec67..8510138 100644 --- a/examples/10-objectstore.go +++ b/examples/10-objectstore.go @@ -1,3 +1,5 @@ +// +build !unit + // Copyright (c) 2014 Hewlett-Packard Development Company, L.P. // // Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/examples/30-image-v1.go b/examples/30-image-v1.go index 6e58ce0..67bc0ad 100644 --- a/examples/30-image-v1.go +++ b/examples/30-image-v1.go @@ -1,3 +1,5 @@ +// +build !unit + // Copyright (c) 2014 Hewlett-Packard Development Company, L.P. // // Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/examples/40-volume-v2.go b/examples/40-volume-v2.go index a522fcb..6c30803 100644 --- a/examples/40-volume-v2.go +++ b/examples/40-volume-v2.go @@ -1,3 +1,5 @@ +// +build !unit + // Copyright (c) 2014 Hewlett-Packard Development Company, L.P. // // Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/examples/setup.go b/examples/setup.go index 3c9197d..b15716e 100644 --- a/examples/setup.go +++ b/examples/setup.go @@ -1,3 +1,5 @@ +// +build !unit + // Copyright (c) 2014 Hewlett-Packard Development Company, L.P. // // Licensed under the Apache License, Version 2.0 (the "License"); you may