Skip to content

Commit

Permalink
check for available parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed May 3, 2021
1 parent 06ec8b9 commit 0a5dc25
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/performance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 0a5dc25

Please sign in to comment.