diff mbox

[v2,14/15] docker: Support interactive shell for debugging

Message ID 1455626399-7111-15-git-send-email-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng Feb. 16, 2016, 12:39 p.m. UTC
Specify "PAUSE=1" when invoking make docker-%, and a shell prompt will
show up before the test runs.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/docker/Makefile.include | 5 ++++-
 tests/docker/run              | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index d8c55c3..aaf7d23 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -60,6 +60,8 @@  docker:
 	@echo '    TESTS="x y z .."     Filters which tests to run (for docker-test).'
 	@echo '    J=[0..9]*            Overrides the -jN parameter for make commands'
 	@echo '                         (default is 1)'
+	@echo '    PAUSE=1              Stop and drop to shell in the created container'
+	@echo '                         before running the command.'
 
 docker-image-%:
 	@if test -z "$(IMAGE)"; then echo "Invalid target"; exit 1; fi
@@ -79,9 +81,10 @@  docker-run-%:
 		$(call quiet-command,\
 			$(SRC_PATH)/tests/docker/docker_run $(if $(KEEP),,--rm) \
 				--privileged -t --net=none \
+				$(if $(PAUSE),-i) \
 				-v $$(realpath $(SRC_PATH)):/var/tmp/qemu \
 				-e QEMU_SRC=/var/tmp/qemu \
-				-e V=$V -e J=$J \
+				-e V=$V -e J=$J -e PAUSE=$(PAUSE)\
 				-v /var/tmp/qemu-docker-ccache:/var/tmp/ccache \
 				-e CCACHE_DIR=/var/tmp/ccache \
 				qemu:$(IMAGE) \
diff --git a/tests/docker/run b/tests/docker/run
index 55b2737..cc8d246 100755
--- a/tests/docker/run
+++ b/tests/docker/run
@@ -23,4 +23,12 @@  if test -n "$J"; then
 fi
 
 cd $QEMU_SRC/tests/docker
+
+if test -n "$PAUSE"; then
+    echo "* Prepared to run command:"
+    echo "  $@"
+    echo "* Hit Ctrl-D to continue, or type 'exit 1' to quit"
+    echo
+    $SHELL
+fi
 "$@"