From 20ecc389196c92cefcebaa713e852c2058a7ce78 Mon Sep 17 00:00:00 2001 From: Rahul Patel Date: Thu, 5 Mar 2020 12:31:13 -0800 Subject: [PATCH] skip test-386 for Mac OS 10.15.x (Catalina and upwards). (#521) * skip test-386 for Mac OS 10.15.x (Catalina and upwards). fixes #520 * fix indentation * remove extra newlines. --- Makefile | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 90e8e939d..94d027e4a 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,16 @@ ALL_DOCS := $(shell find . -name '*.md' -type f | sort) ALL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)) ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort) +# Mac OS Catalina 10.5.x doesn't support 386. Hence skip 386 test +SKIP_386_TEST = false +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + SW_VERS := $(shell sw_vers -productVersion) + ifeq ($(shell echo $(SW_VERS) | egrep '^(10.1[5-9]|1[1-9]|[2-9])'), $(SW_VERS)) + SKIP_386_TEST = true + endif +endif + GOTEST_MIN = go test -v -timeout 30s GOTEST = $(GOTEST_MIN) -race GOTEST_WITH_COVERAGE = $(GOTEST) -coverprofile=coverage.txt -covermode=atomic @@ -73,11 +83,15 @@ test: .PHONY: test-386 test-386: - set -e; for dir in $(ALL_GO_MOD_DIRS); do \ - echo "go test ./... GOARCH 386 in $${dir}"; \ - (cd "$${dir}" && \ - GOARCH=386 $(GOTEST_MIN) ./...); \ - done + if [ $(SKIP_386_TEST) = true ] ; then \ + echo "skipping the test for GOARCH 386 as it is not supported on the current OS"; \ + else \ + set -e; for dir in $(ALL_GO_MOD_DIRS); do \ + echo "go test ./... GOARCH 386 in $${dir}"; \ + (cd "$${dir}" && \ + GOARCH=386 $(GOTEST_MIN) ./...); \ + done; \ + fi .PHONY: examples examples: