From 69fac43124ba02b8aeafaabfcc9f88e054a0a5f5 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 24 Sep 2017 08:18:56 -0400 Subject: [PATCH] add test target in main makefile --- Makefile | 11 +++++++++++ contrib/backends/nntpchan-daemon/Makefile | 4 ++-- contrib/backends/nntpchand/Makefile | 5 ++++- .../nntpchand/src/nntpchan/cmd/nntpserver/main.go | 6 +++--- contrib/backends/srndv2/Makefile | 2 +- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a60562f..418f64a 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ CONTRIB_JS=$(REPO)/contrib/js/contrib LOCAL_JS=$(REPO)/contrib/js/nntpchan VENDOR_JS=$(REPO)/contrib/js/vendor SRND_DIR=$(REPO)/contrib/backends/srndv2 +NNTPCHAND_DIR=$(REPO)/contrib/backends/nntpchand +NNTPCHAN_DAEMON_DIR=$(REPO)/contrib/backends/nntpchan-daemon SRND=$(REPO)/srndv2 GOROOT=$(shell go env GOROOT) GO=$(GOROOT)/bin/go @@ -35,6 +37,15 @@ $(SRND): GOROOT=$(GOROOT) $(MAKE) -C $(SRND_DIR) cp $(SRND_DIR)/srndv2 $(SRND) +test: test-go test-native + +test-go: + GOROOT=$(GOROOT) $(MAKE) -C $(SRND_DIR) test + GOROOT=$(GOROOT) $(MAKE) -C $(NNTPCHAND_DIR) test + +test-native: + GOROOT=$(GOROOT) $(MAKE) -C $(NNTPCHAN_DAEMON_DIR) test + clean: rm -f $(SRND) $(JS) GOROOT=$(GOROOT) $(MAKE) -C $(SRND_DIR) clean diff --git a/contrib/backends/nntpchan-daemon/Makefile b/contrib/backends/nntpchan-daemon/Makefile index 5a3a469..8fc6249 100644 --- a/contrib/backends/nntpchan-daemon/Makefile +++ b/contrib/backends/nntpchan-daemon/Makefile @@ -42,10 +42,10 @@ $(TOOLS): $(TOOL_SRC) $(CXX) $(CXXFLAGS) $< $(LIB) $(LD_FLAGS) -o $@ build-test: $(LIB) - $(CXX) -o test $(CXXFLAGS) test.cpp $(LIB) $(LD_FLAGS) + $(CXX) -o $(REPO)/test $(CXXFLAGS) test.cpp $(LIB) $(LD_FLAGS) test: build-test - ./test + $(REPO)/test %.o: src/%.cpp $(CXX) $(CXXFLAGS) -c -o $@ diff --git a/contrib/backends/nntpchand/Makefile b/contrib/backends/nntpchand/Makefile index a97af84..2da0f2e 100644 --- a/contrib/backends/nntpchand/Makefile +++ b/contrib/backends/nntpchand/Makefile @@ -5,7 +5,10 @@ all: clean build build: nntpchand nntpchand: - GOPATH=$(REPO) go build -v + GOROOT=$(GOROOT) GOPATH=$(REPO) go build -v + +test: + GOROOT=$(GOROOT) GOPATH=$(REPO) go test ./... clean: GOPATH=$(REPO) go clean -v diff --git a/contrib/backends/nntpchand/src/nntpchan/cmd/nntpserver/main.go b/contrib/backends/nntpchand/src/nntpchan/cmd/nntpserver/main.go index bab2d8e..ac17e2c 100644 --- a/contrib/backends/nntpchand/src/nntpchan/cmd/nntpserver/main.go +++ b/contrib/backends/nntpchand/src/nntpchan/cmd/nntpserver/main.go @@ -4,10 +4,10 @@ package main import ( log "github.com/Sirupsen/logrus" - "github.com/majestrate/srndv2/lib/config" - "github.com/majestrate/srndv2/lib/nntp" - "github.com/majestrate/srndv2/lib/store" "net" + "nntpchan/lib/config" + "nntpchan/lib/nntp" + "nntpchan/lib/store" ) func main() { diff --git a/contrib/backends/srndv2/Makefile b/contrib/backends/srndv2/Makefile index a956562..9aaa846 100644 --- a/contrib/backends/srndv2/Makefile +++ b/contrib/backends/srndv2/Makefile @@ -17,4 +17,4 @@ clean: GOPATH=$(REPO) GOROOT=$(GOROOT) $(GO) clean -v test: - GOPATH=$(REPO) GOROOT=$(GOROOT) $(GO) test -v srnd + GOPATH=$(REPO) GOROOT=$(GOROOT) $(GO) test srnd