summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-06-10 23:33:54 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-06-11 12:14:41 +0200
commit4d1934f69b9ada9b2b913bcdd43cd2bc6b298ec9 (patch)
tree9261c282b63e508eba6d795710ae4df932cf9263
parent73423fc182035ac70d194ddbe2ad01ebff989484 (diff)
downloadapk-tools-4d1934f69b9ada9b2b913bcdd43cd2bc6b298ec9.tar.gz
apk-tools-4d1934f69b9ada9b2b913bcdd43cd2bc6b298ec9.tar.bz2
apk-tools-4d1934f69b9ada9b2b913bcdd43cd2bc6b298ec9.tar.xz
apk-tools-4d1934f69b9ada9b2b913bcdd43cd2bc6b298ec9.zip
test: fix running root-tests with QEMU user-mode emulation
Variable QEMU_EMULATOR is set by enter-chroot script from alpine-chroot-install.
-rw-r--r--test/Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile
index 9f43249..9834668 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -10,6 +10,12 @@ APK := ../src/apk --keys-dir /etc/apk/keys
SYSREPO ?= http://nl.alpinelinux.org/alpine/edge/main
+# Absolute path to QEMU user-mode emulation binary to be copied into every
+# $testroot before running test. This is used when running root-tests in
+# emulation using QEMU and binfmt (apk --root uses chroot to run pre/post
+# install scripts).
+QEMU_EMULATOR ?=
+
LD_LIBRARY_PATH = ../src
export LD_LIBRARY_PATH SYSREPO
@@ -39,6 +45,9 @@ repos.stamp: $(repos)
@echo -n "$<"; \
rm -rf "$(testroot)" ;\
mkdir -p "$(testroot)"; \
+ if [ -n "$(QEMU_EMULATOR)" ]; then \
+ $(SUDO) install -Dm755 "$(QEMU_EMULATOR)" "$(testroot)$(QEMU_EMULATOR)"; \
+ fi; \
if ! APK="$(APK)" ROOT="$(testroot)" SYSREPO="$(SYSREPO)" sh -ex ./$< > $(basename $@).out 2>&1; then\
echo " FAIL";\
printf "------------- output -------------\n" >&2;\
@@ -54,7 +63,9 @@ root-tests: repos.stamp
@echo "== Testing `$(APK) --version` (tests that require root permission) =="
@failed=0; for i in test*.sh; do \
rm -f $${i%.sh}.ok ;\
- $(SUDO) $(MAKE) --no-print-directory $${i%.sh}.ok SYSREPO=$(SYSREPO) || failed=1; \
+ $(SUDO) $(MAKE) --no-print-directory $${i%.sh}.ok \
+ SYSREPO=$(SYSREPO) \
+ QEMU_EMULATOR=$(QEMU_EMULATOR) || failed=1; \
done; \
return $$failed