From 0a5dc256bacf922cdf3d7d2b8b967b826c83b198 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Mon, 3 May 2021 18:35:28 +0200 Subject: [PATCH] check for available parameter --- tests/performance/Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/performance/Makefile b/tests/performance/Makefile index 858f63f6eb6..3ad7ed13fe9 100644 --- a/tests/performance/Makefile +++ b/tests/performance/Makefile @@ -3,6 +3,19 @@ # include ../../scripts/common.Makefile +# Check that given variables are set and all have non-empty values, +# die with an error otherwise. +# +# Params: +# 1. Variable name(s) to test. +# 2. (optional) Error message to print. +check_defined = \ + $(strip $(foreach 1,$1, \ + $(call __check_defined,$1,$(strip $(value 2))))) +__check_defined = \ + $(if $(value $1),, \ + $(error Undefined $1$(if $2, ($2)))) + .PHONY: requirements requirements: ## compiles pip requirements (.in -> .txt) @$(MAKE_C) requirements reqs @@ -18,7 +31,8 @@ build: docker buildx build --tag local/locust:latest . .PHONY: up -up: build +up: + @$(call check_defined, target, please define target file when calling $@ - e.g. ```make $@ target=MY_LOCUST_FILE.py```) @export TARGET=$(target); \ docker-compose --file docker-compose.yml up