Skip to contentSkip to conversation

docker: Add test-block

PATCH Superseded Fam Zheng 3 participants 8 messages Sep 1, 2017 – Sep 5, 2017

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
author
#1 lore raw

PATCH v3 1/3 docker: Use unconfined security profile

In reply to Fam Zheng

Some by default blocked syscalls are required to run tests for example userfaultfd.

---
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)
tests/docker/Makefile.include +1 -0
index aaab1a4208..8ded838b20 100644
@@ -145,6 +145,7 @@ docker-run: docker-qemu-src
 	$(call quiet-command,						\
 		$(SRC_PATH)/tests/docker/docker.py run 			\
 			$(if $(NOUSER),,-u $(shell id -u)) -t 		\
+			--security-opt seccomp=unconfined		\
 			$(if $V,,--rm) 					\
 			$(if $(DEBUG),-i,)				\
 			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \
Signature · 1 line
2.13.5

Fam Zheng

author
#0 lore raw

v3 cover docker: Add test-block

A few tweaks to the docker images and running commands allow us to run qemu-iotests in the fedora container. This will be added to the patchew test cases later.

v3: Add nbd, luks and limit to quick group.

v2: Add nettle-devel because a few iotest cases blindly assumes the support is there.

Fam Zheng (3):
docker: Use unconfined security profile
docker: Add nettle-devel to fedora image
docker: Add test-block

 tests/docker/Makefile.include          |  1 +
 tests/docker/dockerfiles/fedora.docker |  1 +
 tests/docker/test-block                | 22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100755 tests/docker/test-block
Signature · 1 line
2.13.5
author
#3 lore raw

PATCH v3 3/3 docker: Add test-block

---
 tests/docker/test-block | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100755 tests/docker/test-block
tests/docker/test-block new file +22 -0
new file mode 100755
index 0000000000..efc77b4b91
@@ -0,0 +1,22 @@
+#!/bin/bash -e
+#
+# Run block test cases
+#
+# Copyright (c) 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+cd "$BUILD_DIR"
+
+build_qemu --target-list=x86_64-softmmu
+cd tests/qemu-iotests
+for t in raw qcow2 nbd luks; do
+    ./check -g quick -$t
+done
Signature · 1 line
2.13.5
author
#2 lore raw

PATCH v3 2/3 docker: Add nettle-devel to fedora image

In reply to Fam Zheng

The LUKS cases in qemu-iotests requires this.

---
 tests/docker/dockerfiles/fedora.docker | 1 +
 1 file changed, 1 insertion(+)
tests/docker/dockerfiles/fedora.docker +1 -0
index 4eaa8ed2a5..27e8201c54 100644
@@ -3,6 +3,7 @@ ENV PACKAGES \
     ccache git tar PyYAML sparse flex bison python2 bzip2 hostname \
     glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel \
     gcc gcc-c++ clang make perl which bc findutils libaio-devel \
+    nettle-devel \
     mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config \
     mingw32-gtk2 mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1 \
     mingw32-libjpeg-turbo mingw32-libpng mingw32-curl mingw32-libssh2 \
Signature · 1 line
2.13.5
Reviewed-by on the v3 series
#6 lore raw
In reply to Fam Zheng
Quoted 6 lines · Fam Zheng

A few tweaks to the docker images and running commands allow us to run qemu-iotests in the fedora container. This will be added to the patchew test cases later.

v3: Add nbd, luks and limit to quick group.

Quoted 7 lines

v2: Add nettle-devel because a few iotest cases blindly assumes the support is there.

Fam Zheng (3):
docker: Use unconfined security profile
docker: Add nettle-devel to fedora image
docker: Add test-block

All three of the patches look good to me. FWIW:

Quoted 9 lines
 tests/docker/Makefile.include          |  1 +
 tests/docker/dockerfiles/fedora.docker |  1 +
 tests/docker/test-block                | 22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100755 tests/docker/test-block
Signature · 1 line
2.13.5
Signature · 1 line
/kashyap
#4 lore raw
In reply to Fam Zheng

tests/docker/test-block line 1

Quoted 13 lines · Fam Zheng
---
 tests/docker/test-block | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100755 tests/docker/test-block
tests/docker/test-block new file +1 -0
new file mode 100755
index 0000000000..efc77b4b91
@@ -0,0 +1,22 @@
+#!/bin/bash -e

'set -e' is awful; it exists for backwards-compatibility with shell scripts that pre-date functions, but is NOT intuitive and generally does NOT do what you want when shell functions are added to the mix. You're better off doing manual error checking than relying on 'set -e' to check for errors on your behalf.

tests/docker/test-block line 14

Quoted 13 lines
tests/docker/test-block new file +13 -0
+#
+# Run block test cases
+#
+# Copyright (c) 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc

Are we sure that '.' is early enough on $PATH that this will pick up the right common.rc? Safer is '. ./common.rc'.

tests/docker/test-block line 22

Quoted 8 lines
tests/docker/test-block new file +8 -0
+
+cd "$BUILD_DIR"
+
+build_qemu --target-list=x86_64-softmmu
+cd tests/qemu-iotests
+for t in raw qcow2 nbd luks; do
+    ./check -g quick -$t
+done

That said, this script (and common.rc) is small enough to verify that you probably aren't going to trip over those non-intuitive 'set -e' behaviors, so the real reason to avoid it is if we want to be able to copy-and-paste into other scripts that aren't using 'set -e' (on the premise that avoiding implicit global state, like 'set -e', and being explicit instead, is a good thing).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#7 lore raw
In reply to Fam Zheng
Quoted 6 lines · Fam Zheng

A few tweaks to the docker images and running commands allow us to run qemu-iotests in the fedora container. This will be added to the patchew test cases later.

v3: Add nbd, luks and limit to quick group.

Quoted 7 lines

v2: Add nettle-devel because a few iotest cases blindly assumes the support is there.

Fam Zheng (3):
docker: Use unconfined security profile
docker: Add nettle-devel to fedora image
docker: Add test-block

Based-on: <[email protected]> ([PATCH 0/2] Fix / skip recent iotests with LUKS driver)

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
author
#5 lore raw
In reply to Eric Blake
Quoted 38 lines · Eric Blake

tests/docker/test-block line 1

Quoted 13 lines · Fam Zheng
---
 tests/docker/test-block | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100755 tests/docker/test-block
tests/docker/test-block new file +1 -0
new file mode 100755
index 0000000000..efc77b4b91
@@ -0,0 +1,22 @@
+#!/bin/bash -e

'set -e' is awful; it exists for backwards-compatibility with shell scripts that pre-date functions, but is NOT intuitive and generally does NOT do what you want when shell functions are added to the mix. You're better off doing manual error checking than relying on 'set -e' to check for errors on your behalf.

tests/docker/test-block line 14

Quoted 13 lines
tests/docker/test-block new file +13 -0
+#
+# Run block test cases
+#
+# Copyright (c) 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc

Are we sure that '.' is early enough on $PATH that this will pick up the right common.rc? Safer is '. ./common.rc'.

Quoted 15 lines

tests/docker/test-block line 22

Quoted 8 lines
tests/docker/test-block new file +8 -0
+
+cd "$BUILD_DIR"
+
+build_qemu --target-list=x86_64-softmmu
+cd tests/qemu-iotests
+for t in raw qcow2 nbd luks; do
+    ./check -g quick -$t
+done

That said, this script (and common.rc) is small enough to verify that you probably aren't going to trip over those non-intuitive 'set -e' behaviors, so the real reason to avoid it is if we want to be able to copy-and-paste into other scripts that aren't using 'set -e' (on the premise that avoiding implicit global state, like 'set -e', and being explicit instead, is a good thing).

OK, I will revise this patch and drop set -e.

Fam