diff --git a/Makefile-test.mk b/Makefile-test.mk index 1b3b17b955..2dc94a8a6b 100644 --- a/Makefile-test.mk +++ b/Makefile-test.mk @@ -15,11 +15,16 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) ARTIFACTS ?= $(PROJECT_DIR)/bin +ifeq ($(shell uname),Darwin) + GOFLAGS ?= -ldflags=-extldflags=-Wl,-ld_classic +endif + ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin else GOBIN=$(shell go env GOBIN) endif + GO_CMD ?= go GO_TEST_FLAGS ?= -race version_pkg = sigs.k8s.io/kueue/pkg/version @@ -70,7 +75,7 @@ KUBEFLOW_MPI_VERSION = $(shell $(GO_CMD) list -m -f "{{.Version}}" github.com/ku .PHONY: test test: gotestsum ## Run tests. - $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml -- $(GO_TEST_FLAGS) $(shell $(GO_CMD) list ./... | grep -v '/test/') -coverpkg=./... -coverprofile $(ARTIFACTS)/cover.out + $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml -- $(GOFLAGS) $(GO_TEST_FLAGS) $(shell $(GO_CMD) list ./... | grep -v '/test/') -coverpkg=./... -coverprofile $(ARTIFACTS)/cover.out .PHONY: test-integration test-integration: gomod-download envtest ginkgo dep-crds kueuectl ginkgo-top ## Run tests. diff --git a/cmd/experimental/kjobctl/Makefile b/cmd/experimental/kjobctl/Makefile index c098be1bd8..af65c37e63 100644 --- a/cmd/experimental/kjobctl/Makefile +++ b/cmd/experimental/kjobctl/Makefile @@ -1,6 +1,10 @@ # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.31.0 +ifeq ($(shell uname),Darwin) + GOFLAGS ?= -ldflags=-extldflags=-Wl,-ld_classic +endif + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -118,7 +122,7 @@ test: verify vet test-unit test-integration ## Run all tests. .PHONY: test-unit test-unit: gomod-download gotestsum embeded-manifest ## Run unit tests. - $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit-unit.xml -- $(GO_TEST_FLAGS) $(shell $(GO_CMD) list ./... | grep -v '/test/') -coverpkg=./... -coverprofile $(ARTIFACTS)/cover.out + $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit-unit.xml -- $(GOFLAGS) $(GO_TEST_FLAGS) $(shell $(GO_CMD) list ./... | grep -v '/test/') -coverpkg=./... -coverprofile $(ARTIFACTS)/cover.out .PHONY: test-integration test-integration: gomod-download envtest ginkgo embeded-manifest ray-operator-crd ## Run integration tests.