@@ -25,10 +25,11 @@ Targets:
2525 images Show container's image details.
2626 load Loads from the distribution package. Requires
2727 DOCKER_IMAGE_TAG variable.
28- logs Display log output from the running container.
29- logs-delayed Display log output from the running container after
30- backing off for STARTUP_TIME seconds. This can be
31- necessary when chaining make targets together.
28+ logs [OPTIONS] Display log output from the container.
29+ logsdef Display log output from the container deferred for
30+ STARTUP_TIME seconds. This will work in a chain
31+ unlike the logs target.
32+ logs-delayed [DEPRECATED] Replaced with logsdef.
3233 pause Pause the running container.
3334 pull Pull the release image from the registry. Requires
3435 the DOCKER_IMAGE_TAG variable.
@@ -45,6 +46,7 @@ Targets:
4546 stop Stop the container when in a running state.
4647 terminate Unpause, stop and remove the container.
4748 test Run all test cases.
49+ test-setup Install test dependencies.
4850 top [ps OPTIONS] Display the running processes of the container.
4951 unpause Unpause the container when in a paused state.
5052
@@ -161,6 +163,7 @@ endef
161163 _require-docker-image-tag \
162164 _require-docker-release-tag \
163165 _require-package-path \
166+ _require-root \
164167 _test-prerequisites \
165168 _usage \
166169 all \
@@ -176,6 +179,7 @@ endef
176179 images \
177180 load \
178181 logs \
182+ logsdef \
179183 logs-delayed \
180184 pause \
181185 pull \
@@ -191,6 +195,7 @@ endef
191195 stop \
192196 terminate \
193197 test \
198+ test-setup \
194199 top \
195200 unpause
196201
@@ -365,9 +370,17 @@ _require-package-path:
365370 exit 1; \
366371 fi
367372
373+ _require-root :
374+ @ if [[ $$ {EUID} -ne 0 ]]; \
375+ then \
376+ >&2 printf -- ' %sMust be run as root\n' \
377+ " $( PREFIX_STEP_NEGATIVE) " ; \
378+ exit 1; \
379+ fi
380+
368381_test-prerequisites :
369382ifeq ($(shpec ) ,)
370- $(error "Please install shpec.")
383+ $(error "Please install shpec. Try: DOCKER_NAME=$(DOCKER_NAME) make test-setup ")
371384endif
372385
373386_usage :
@@ -581,14 +594,20 @@ install: | \
581594logs : \
582595 _prerequisites \
583596 _require-docker-container
584- @ $(docker ) logs $(DOCKER_NAME )
597+ @ $(docker ) logs \
598+ $(filter-out $@ , $(MAKECMDGOALS ) ) \
599+ $(DOCKER_NAME )
600+ % :; @:
585601
586- logs-delayed : \
602+ logsdef : \
587603 _prerequisites \
588604 _require-docker-container
589605 @ sleep $(STARTUP_TIME )
590606 @ $(MAKE ) logs
591607
608+ logs-delayed : \
609+ logsdef
610+
592611load : \
593612 _prerequisites \
594613 _require-docker-release-tag \
@@ -980,6 +999,18 @@ test: \
980999 " Functional test"
9811000 @ SHPEC_ROOT=$(SHPEC_ROOT ) $(shpec )
9821001
1002+ test-setup : \
1003+ _require-root
1004+ @ printf -- ' %s%s\n' \
1005+ " $( PREFIX_STEP) " \
1006+ " Installing shpec"
1007+ @ bash -c " $$ (curl -LSs \
1008+ https://raw.githubusercontent.com/rylnd/shpec/master/install.sh \
1009+ )"
1010+ @ ln -sf \
1011+ /usr/local/bin/shpec \
1012+ /usr/bin/shpec
1013+
9831014unpause : \
9841015 _prerequisites \
9851016 _require-docker-container \
0 commit comments