All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting
@ 2019-01-29 17:53 Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images Philippe Mathieu-Daudé
                   ` (17 more replies)
  0 siblings, 18 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Various fixes I encountered while trying to run QEMU test suite on OpenBSD.
Now than various tests are disabled, we can run the qtests again.
(Conversely, if we can not test a feature, we should deprecate/remove it.)

Since v1:
- various qemu-block fixes and notes.

Some patches care be applied by respective maintainers, but I prefer
to submit the series as a whole, since it makes the testing easier
than various 'based-on:' ...

- patches 1, 3, 9, 11, !14 can go via 'test automation' (Alex/Fam)
- patche 2: Brad or Paolo 'Misc'???
- patche 8 eventually 'ACPI' (MST)
- patches 4-7 via the 'block layer' (Kevin)
- other RFC patches require review by the block team!!!

Regards,

Phil.

v1: https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg06676.html

Philippe Mathieu-Daudé (18):
  tests/vm: Be verbose while extracting compressed images
  configure: Disable W^X on OpenBSD
  tests/vm/openbsd: Disable the W^X protection on the build partition
  ahci-test: Add dependency to qemu-img tool
  qemu-iotests: Add dependency to qemu-nbd tool
  qemu-iotests: Improve portability by searching bash in the $PATH
  tests/multiboot: Improve portability by searching bash in the $PATH
  tests/bios-tables: Improve portability by searching bash in the $PATH
  tests/vm/openbsd: Install Bash from the ports
  RFC qemu-iotests: Ensure GNU sed is used
  tests/vm/openbsd: Install GNU sed from the ports
  RFC test-iov: Disable iov/io test on OpenBSD
  RFC oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK)
    failure
  tests/vm: Run tests on OpenBSD
  iotests: Let verify_platform() check for unsupported platforms
  RFC iotests: Disable 208 on OpenBSD
  RFC iotests: Disable 209 on OpenBSD
  RFC iotests: Disable 236 and 238 on OpenBSD

 configure                               | 11 +++++++
 tests/Makefile.include                  |  4 +--
 tests/data/acpi/rebuild-expected-aml.sh |  2 +-
 tests/multiboot/run_test.sh             |  2 +-
 tests/qemu-iotests/001                  |  2 +-
 tests/qemu-iotests/002                  |  2 +-
 tests/qemu-iotests/003                  |  2 +-
 tests/qemu-iotests/004                  |  2 +-
 tests/qemu-iotests/005                  |  2 +-
 tests/qemu-iotests/007                  |  2 +-
 tests/qemu-iotests/008                  |  2 +-
 tests/qemu-iotests/009                  |  2 +-
 tests/qemu-iotests/010                  |  2 +-
 tests/qemu-iotests/011                  |  2 +-
 tests/qemu-iotests/012                  |  2 +-
 tests/qemu-iotests/013                  |  2 +-
 tests/qemu-iotests/014                  |  2 +-
 tests/qemu-iotests/015                  |  2 +-
 tests/qemu-iotests/017                  |  2 +-
 tests/qemu-iotests/018                  |  2 +-
 tests/qemu-iotests/019                  |  2 +-
 tests/qemu-iotests/020                  |  2 +-
 tests/qemu-iotests/021                  |  2 +-
 tests/qemu-iotests/022                  |  2 +-
 tests/qemu-iotests/023                  |  2 +-
 tests/qemu-iotests/024                  |  2 +-
 tests/qemu-iotests/025                  |  2 +-
 tests/qemu-iotests/026                  |  2 +-
 tests/qemu-iotests/027                  |  2 +-
 tests/qemu-iotests/028                  |  2 +-
 tests/qemu-iotests/029                  |  2 +-
 tests/qemu-iotests/031                  |  2 +-
 tests/qemu-iotests/032                  |  2 +-
 tests/qemu-iotests/033                  |  2 +-
 tests/qemu-iotests/034                  |  2 +-
 tests/qemu-iotests/035                  |  2 +-
 tests/qemu-iotests/036                  |  2 +-
 tests/qemu-iotests/037                  |  2 +-
 tests/qemu-iotests/038                  |  2 +-
 tests/qemu-iotests/039                  |  2 +-
 tests/qemu-iotests/042                  |  2 +-
 tests/qemu-iotests/043                  |  2 +-
 tests/qemu-iotests/046                  |  2 +-
 tests/qemu-iotests/047                  |  2 +-
 tests/qemu-iotests/048                  |  2 +-
 tests/qemu-iotests/049                  |  2 +-
 tests/qemu-iotests/050                  |  2 +-
 tests/qemu-iotests/051                  |  2 +-
 tests/qemu-iotests/052                  |  2 +-
 tests/qemu-iotests/053                  |  2 +-
 tests/qemu-iotests/054                  |  2 +-
 tests/qemu-iotests/058                  |  2 +-
 tests/qemu-iotests/059                  |  2 +-
 tests/qemu-iotests/060                  |  2 +-
 tests/qemu-iotests/061                  |  2 +-
 tests/qemu-iotests/062                  |  2 +-
 tests/qemu-iotests/063                  |  2 +-
 tests/qemu-iotests/064                  |  2 +-
 tests/qemu-iotests/066                  |  2 +-
 tests/qemu-iotests/067                  |  2 +-
 tests/qemu-iotests/068                  |  2 +-
 tests/qemu-iotests/069                  |  2 +-
 tests/qemu-iotests/070                  |  2 +-
 tests/qemu-iotests/071                  |  2 +-
 tests/qemu-iotests/072                  |  2 +-
 tests/qemu-iotests/073                  |  2 +-
 tests/qemu-iotests/074                  |  2 +-
 tests/qemu-iotests/075                  |  2 +-
 tests/qemu-iotests/076                  |  2 +-
 tests/qemu-iotests/077                  |  2 +-
 tests/qemu-iotests/078                  |  2 +-
 tests/qemu-iotests/079                  |  2 +-
 tests/qemu-iotests/080                  |  2 +-
 tests/qemu-iotests/081                  |  2 +-
 tests/qemu-iotests/082                  |  2 +-
 tests/qemu-iotests/083                  |  2 +-
 tests/qemu-iotests/084                  |  2 +-
 tests/qemu-iotests/085                  |  2 +-
 tests/qemu-iotests/086                  |  2 +-
 tests/qemu-iotests/087                  |  2 +-
 tests/qemu-iotests/088                  |  2 +-
 tests/qemu-iotests/089                  |  2 +-
 tests/qemu-iotests/090                  |  2 +-
 tests/qemu-iotests/091                  |  2 +-
 tests/qemu-iotests/092                  |  2 +-
 tests/qemu-iotests/094                  |  2 +-
 tests/qemu-iotests/095                  |  2 +-
 tests/qemu-iotests/097                  |  2 +-
 tests/qemu-iotests/098                  |  2 +-
 tests/qemu-iotests/099                  |  2 +-
 tests/qemu-iotests/101                  |  2 +-
 tests/qemu-iotests/102                  |  2 +-
 tests/qemu-iotests/103                  |  2 +-
 tests/qemu-iotests/104                  |  2 +-
 tests/qemu-iotests/105                  |  2 +-
 tests/qemu-iotests/106                  |  2 +-
 tests/qemu-iotests/107                  |  2 +-
 tests/qemu-iotests/108                  |  2 +-
 tests/qemu-iotests/109                  |  2 +-
 tests/qemu-iotests/110                  |  2 +-
 tests/qemu-iotests/111                  |  2 +-
 tests/qemu-iotests/112                  |  2 +-
 tests/qemu-iotests/113                  |  2 +-
 tests/qemu-iotests/114                  |  2 +-
 tests/qemu-iotests/115                  |  2 +-
 tests/qemu-iotests/116                  |  2 +-
 tests/qemu-iotests/117                  |  2 +-
 tests/qemu-iotests/119                  |  2 +-
 tests/qemu-iotests/120                  |  2 +-
 tests/qemu-iotests/121                  |  2 +-
 tests/qemu-iotests/122                  |  2 +-
 tests/qemu-iotests/123                  |  2 +-
 tests/qemu-iotests/125                  |  2 +-
 tests/qemu-iotests/126                  |  2 +-
 tests/qemu-iotests/127                  |  2 +-
 tests/qemu-iotests/128                  |  2 +-
 tests/qemu-iotests/130                  |  2 +-
 tests/qemu-iotests/131                  |  2 +-
 tests/qemu-iotests/133                  |  2 +-
 tests/qemu-iotests/134                  |  2 +-
 tests/qemu-iotests/135                  |  2 +-
 tests/qemu-iotests/137                  |  2 +-
 tests/qemu-iotests/138                  |  2 +-
 tests/qemu-iotests/140                  |  2 +-
 tests/qemu-iotests/141                  |  2 +-
 tests/qemu-iotests/142                  |  2 +-
 tests/qemu-iotests/143                  |  2 +-
 tests/qemu-iotests/144                  |  2 +-
 tests/qemu-iotests/145                  |  2 +-
 tests/qemu-iotests/146                  |  2 +-
 tests/qemu-iotests/150                  |  2 +-
 tests/qemu-iotests/153                  |  2 +-
 tests/qemu-iotests/154                  |  2 +-
 tests/qemu-iotests/156                  |  2 +-
 tests/qemu-iotests/157                  |  2 +-
 tests/qemu-iotests/158                  |  2 +-
 tests/qemu-iotests/159                  |  2 +-
 tests/qemu-iotests/160                  |  2 +-
 tests/qemu-iotests/161                  |  2 +-
 tests/qemu-iotests/162                  |  2 +-
 tests/qemu-iotests/170                  |  2 +-
 tests/qemu-iotests/171                  |  2 +-
 tests/qemu-iotests/172                  |  2 +-
 tests/qemu-iotests/173                  |  2 +-
 tests/qemu-iotests/174                  |  2 +-
 tests/qemu-iotests/175                  |  2 +-
 tests/qemu-iotests/176                  |  2 +-
 tests/qemu-iotests/177                  |  2 +-
 tests/qemu-iotests/178                  |  2 +-
 tests/qemu-iotests/179                  |  2 +-
 tests/qemu-iotests/181                  |  2 +-
 tests/qemu-iotests/182                  |  2 +-
 tests/qemu-iotests/183                  |  2 +-
 tests/qemu-iotests/184                  |  2 +-
 tests/qemu-iotests/185                  |  2 +-
 tests/qemu-iotests/186                  |  2 +-
 tests/qemu-iotests/187                  |  2 +-
 tests/qemu-iotests/188                  |  2 +-
 tests/qemu-iotests/189                  |  2 +-
 tests/qemu-iotests/190                  |  2 +-
 tests/qemu-iotests/191                  |  2 +-
 tests/qemu-iotests/192                  |  2 +-
 tests/qemu-iotests/195                  |  2 +-
 tests/qemu-iotests/197                  |  2 +-
 tests/qemu-iotests/198                  |  2 +-
 tests/qemu-iotests/200                  |  2 +-
 tests/qemu-iotests/201                  |  2 +-
 tests/qemu-iotests/204                  |  2 +-
 tests/qemu-iotests/208                  |  1 +
 tests/qemu-iotests/209                  |  1 +
 tests/qemu-iotests/214                  |  2 +-
 tests/qemu-iotests/215                  |  2 +-
 tests/qemu-iotests/217                  |  2 +-
 tests/qemu-iotests/220                  |  2 +-
 tests/qemu-iotests/221                  |  2 +-
 tests/qemu-iotests/223                  |  2 +-
 tests/qemu-iotests/225                  |  2 +-
 tests/qemu-iotests/226                  |  2 +-
 tests/qemu-iotests/227                  |  2 +-
 tests/qemu-iotests/229                  |  2 +-
 tests/qemu-iotests/231                  |  2 +-
 tests/qemu-iotests/232                  |  2 +-
 tests/qemu-iotests/233                  |  2 +-
 tests/qemu-iotests/236                  |  1 +
 tests/qemu-iotests/238                  |  2 ++
 tests/qemu-iotests/check                |  2 +-
 tests/qemu-iotests/common.config        |  2 +-
 tests/qemu-iotests/common.filter        | 38 ++++++++++++-------------
 tests/qemu-iotests/common.nbd           |  2 +-
 tests/qemu-iotests/common.pattern       |  2 +-
 tests/qemu-iotests/common.qemu          |  2 +-
 tests/qemu-iotests/common.rc            | 14 ++++++++-
 tests/qemu-iotests/common.tls           |  2 +-
 tests/qemu-iotests/iotests.py           |  4 ++-
 tests/test-iov.c                        |  8 ++++--
 tests/vm/centos                         |  3 +-
 tests/vm/freebsd                        |  3 +-
 tests/vm/netbsd                         |  3 +-
 tests/vm/openbsd                        | 17 ++++++++---
 util/oslib-posix.c                      | 10 +++++++
 200 files changed, 272 insertions(+), 218 deletions(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-02-05 13:17   ` Peter Maydell
  2019-02-07 22:08   ` Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD Philippe Mathieu-Daudé
                   ` (16 subsequent siblings)
  17 siblings, 2 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Depending of the host hardware, copying and extracting VM images can
take up to few minutes. Add verbosity to avoid the user to worry about
VMs hanging.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/vm/centos  | 3 ++-
 tests/vm/freebsd | 3 ++-
 tests/vm/netbsd  | 3 ++-
 tests/vm/openbsd | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/vm/centos b/tests/vm/centos
index daa2dbca03..ba133ea429 100755
--- a/tests/vm/centos
+++ b/tests/vm/centos
@@ -65,8 +65,9 @@ class CentosVM(basevm.BaseVM):
     def build_image(self, img):
         cimg = self._download_with_cache("https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1802.qcow2.xz")
         img_tmp = img + ".tmp"
+        sys.stderr.write("Extracting the image...\n")
         subprocess.check_call(["cp", "-f", cimg, img_tmp + ".xz"])
-        subprocess.check_call(["xz", "-df", img_tmp + ".xz"])
+        subprocess.check_call(["xz", "-dvf", img_tmp + ".xz"])
         subprocess.check_call(["qemu-img", "resize", img_tmp, "50G"])
         self.boot(img_tmp, extra_args = ["-cdrom", self._gen_cloud_init_iso()])
         self.wait_ssh()
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 19a3729172..2007c495a8 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -34,8 +34,9 @@ class FreeBSDVM(basevm.BaseVM):
                 sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891')
         img_tmp_xz = img + ".tmp.xz"
         img_tmp = img + ".tmp"
+        sys.stderr.write("Extracting the image...\n")
         subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
-        subprocess.check_call(["xz", "-df", img_tmp_xz])
+        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index fac6a7ce51..93b267c292 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -34,8 +34,9 @@ class NetBSDVM(basevm.BaseVM):
                                          sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732')
         img_tmp_xz = img + ".tmp.xz"
         img_tmp = img + ".tmp"
+        sys.stderr.write("Extracting the image...\n")
         subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
-        subprocess.check_call(["xz", "-df", img_tmp_xz])
+        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index cfe0572c59..2105c01a26 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -35,8 +35,9 @@ class OpenBSDVM(basevm.BaseVM):
                 sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf')
         img_tmp_xz = img + ".tmp.xz"
         img_tmp = img + ".tmp"
+        sys.stderr.write("Extracting the image...\n")
         subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
-        subprocess.check_call(["xz", "-df", img_tmp_xz])
+        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 18:02   ` Philippe Mathieu-Daudé
  2019-01-29 21:54   ` Eric Blake
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 03/18] tests/vm/openbsd: Disable the W^X protection on the build partition Philippe Mathieu-Daudé
                   ` (15 subsequent siblings)
  17 siblings, 2 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Since OpenBSD 6.0 [1], W^X is enforced by default [2].
TCG requires WX access. Disable W^X if it is available.
This fixes:

  # lm32-softmmu/qemu-system-lm32
  Could not allocate dynamic translator buffer

  # sysctl kern.wxabort=1
  kern.wxabort: 0 -> 1
  # lm32-softmmu/qemu-system-lm32
  mmap: Not supported
  Abort trap (core dumped)
  # gdb -q lm32-softmmu/qemu-system-lm32 qemu-system-lm32.core
  (gdb) bt
  #0  0x000017e3c156c50a in _thread_sys___syscall () at {standard input}:5
  #1  0x000017e3c15e5d7a in *_libc_mmap (addr=Variable "addr" is not available.) at /usr/src/lib/libc/sys/mmap.c:47
  #2  0x000017e17d9abc8b in alloc_code_gen_buffer () at /usr/src/qemu/accel/tcg/translate-all.c:1064
  #3  0x000017e17d9abd04 in code_gen_alloc (tb_size=0) at /usr/src/qemu/accel/tcg/translate-all.c:1112
  #4  0x000017e17d9abe81 in tcg_exec_init (tb_size=0) at /usr/src/qemu/accel/tcg/translate-all.c:1149
  #5  0x000017e17d9897e9 in tcg_init (ms=0x17e45e456800) at /usr/src/qemu/accel/tcg/tcg-all.c:66
  #6  0x000017e17d9891b8 in accel_init_machine (acc=0x17e3c3f50800, ms=0x17e45e456800) at /usr/src/qemu/accel/accel.c:63
  #7  0x000017e17d989312 in configure_accelerator (ms=0x17e45e456800, progname=0x7f7fffff07b0 "lm32-softmmu/qemu-system-lm32") at /usr/src/qemu/accel/accel.c:111
  #8  0x000017e17d9d8616 in main (argc=1, argv=0x7f7fffff06b8, envp=0x7f7fffff06c8) at vl.c:4325

[1] https://www.openbsd.org/faq/upgrade60.html
[2] https://undeadly.org/cgi?action=article&sid=20160527203200

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 configure | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/configure b/configure
index b18281c61f..799ec2013b 100755
--- a/configure
+++ b/configure
@@ -5795,6 +5795,17 @@ if test "$mingw32" = "yes" ; then
     done
 fi
 
+# Disable OpenBSD W^X if available
+if test "$tcg" = "yes" -a "$targetos" = "OpenBSD"; then
+    cat > $TMPC <<EOF
+    int main(void) { return 0; }
+EOF
+    wx_ldflags="-Wl,-z,wxneeded"
+    if compile_prog "" "$wx_ldflags"; then
+        QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags"
+    fi
+fi
+
 qemu_confdir=$sysconfdir$confsuffix
 qemu_moddir=$libdir$confsuffix
 qemu_datadir=$datadir$confsuffix
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 03/18] tests/vm/openbsd: Disable the W^X protection on the build partition
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 21:58   ` Eric Blake
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 04/18] ahci-test: Add dependency to qemu-img tool Philippe Mathieu-Daudé
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Since OpenBSD 6.0 [1], W^X is enforced by default [2].
TCG requires WX access, and QEMU binaries are now built with the WX
flag to disable the protection. However, WX allowed binaries need
to be run on a WX allowed partition.
To be able to run the QEMU test suite on the VM, mount the partition
where QEMU is built/tested as WX allowed.

[1] https://www.openbsd.org/faq/upgrade60.html
[2] https://undeadly.org/cgi?action=article&sid=20160527203200

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/vm/openbsd | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index 2105c01a26..6263c8956b 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -41,6 +41,12 @@ class OpenBSDVM(basevm.BaseVM):
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
+        self.boot(img)
+        self.wait_ssh()
+        sys.stderr.write("Disabling W^X on the build partition...\n")
+        self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
+        self.ssh_root("shutdown -p now")
+        self.wait()
 
 if __name__ == "__main__":
     sys.exit(basevm.main(OpenBSDVM))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 04/18] ahci-test: Add dependency to qemu-img tool
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 03/18] tests/vm/openbsd: Disable the W^X protection on the build partition Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 05/18] qemu-iotests: Add dependency to qemu-nbd tool Philippe Mathieu-Daudé
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski, John Snow

Since the ahci-test uses qemu-img, add a dependency to build it
before using it.
This fixes:

  $ gmake check-qtest V=1
  QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/ahci-test
  Failed to execute child process "/tmp/qemu-test.19tMRF/qemu-img" (No such file or directory)
  ERROR:tests/libqos/libqos.c:192:mkimg: assertion failed: (ret && !err)

Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Slighly related is when vm-tests expect qemu-img available:
https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg08415.html

  $ make vm-build-ubuntu.i386
  Traceback (most recent call last):
    File "source/qemu/tests/vm/basevm.py", line 236, in main
      return vm.build_image(args.image)
    File "tests/vm/ubuntu.i386", line 67, in build_image
      subprocess.check_call(["qemu-img", "resize", img_tmp, "50G"])
  OSError: [Errno 2] No such file or directory
  tests/vm/Makefile.include:23: recipe for target 'tests/vm/ubuntu.i386.img' failed
  make: *** [tests/vm/ubuntu.i386.img] Error 2

A better fix would be checking those tools via ./configure...
---
 tests/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 19b4c0a696..5e03416c81 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -706,7 +706,7 @@ tests/prom-env-test$(EXESUF): tests/prom-env-test.o $(libqos-obj-y)
 tests/rtas-test$(EXESUF): tests/rtas-test.o $(libqos-spapr-obj-y)
 tests/fdc-test$(EXESUF): tests/fdc-test.o
 tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
-tests/ahci-test$(EXESUF): tests/ahci-test.o $(libqos-pc-obj-y)
+tests/ahci-test$(EXESUF): tests/ahci-test.o $(libqos-pc-obj-y) qemu-img$(EXESUF)
 tests/ipmi-kcs-test$(EXESUF): tests/ipmi-kcs-test.o
 tests/ipmi-bt-test$(EXESUF): tests/ipmi-bt-test.o
 tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 05/18] qemu-iotests: Add dependency to qemu-nbd tool
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 04/18] ahci-test: Add dependency to qemu-img tool Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 22:03   ` Eric Blake
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Since a9660664fde, some iotests use qemu-nbd.
Add a dependency to build it before using it.
This fixes:

  $ gmake check-block
          CHK version_gen.h
    GEN     qemu-img-cmds.h
    CC      qemu-img.o
    LINK    qemu-img
    CC      qemu-io.o
    LINK    qemu-io
  tests/qemu-iotests-quick.sh
  tests/qemu-iotests-quick.sh[6]: ./check: No such file or directory
  gmake: *** [/tmp/qemu-test.9GLXBk/tests/Makefile.include:1059: check-tests/qemu-iotests-quick.sh] Error 1

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
On Linux, qemu-iotests-quick.sh is a bit less cryptic:

  $ gmake check-block
    GEN     qemu-img-cmds.h
    CC      qemu-img.o
    LINK    qemu-img
    CC      qemu-io.o
    LINK    qemu-io
    CC      tests/qemu-iotests/socket_scm_helper.o
    LINK    tests/qemu-iotests/socket_scm_helper
  /home/phil/source/qemu/tests/qemu-iotests-quick.sh
  check: qemu-nbd not found
  gmake: *** [/home/phil/source/qemu/tests/Makefile.include:1059: check-tests/qemu-iotests-quick.sh] Error 1
---
 tests/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 5e03416c81..3c0850704d 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -1055,7 +1055,7 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
 
 .PHONY: check-tests/qemu-iotests-quick.sh
-check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
+check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
 	$<
 
 .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 05/18] qemu-iotests: Add dependency to qemu-nbd tool Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 22:15   ` Eric Blake
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 07/18] tests/multiboot: " Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Patch created mechanically by running:

  $ git grep -lE '#! ?/bin/bash' -- tests/qemu-iotests | \
    while read f; do \
      sed -i 's_#!.\?/bin/bash_#! /usr/bin/env bash_' $f; \
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Can 'env' be located elsewhere than /usr/bin/env?
---
 tests/qemu-iotests/001            | 2 +-
 tests/qemu-iotests/002            | 2 +-
 tests/qemu-iotests/003            | 2 +-
 tests/qemu-iotests/004            | 2 +-
 tests/qemu-iotests/005            | 2 +-
 tests/qemu-iotests/007            | 2 +-
 tests/qemu-iotests/008            | 2 +-
 tests/qemu-iotests/009            | 2 +-
 tests/qemu-iotests/010            | 2 +-
 tests/qemu-iotests/011            | 2 +-
 tests/qemu-iotests/012            | 2 +-
 tests/qemu-iotests/013            | 2 +-
 tests/qemu-iotests/014            | 2 +-
 tests/qemu-iotests/015            | 2 +-
 tests/qemu-iotests/017            | 2 +-
 tests/qemu-iotests/018            | 2 +-
 tests/qemu-iotests/019            | 2 +-
 tests/qemu-iotests/020            | 2 +-
 tests/qemu-iotests/021            | 2 +-
 tests/qemu-iotests/022            | 2 +-
 tests/qemu-iotests/023            | 2 +-
 tests/qemu-iotests/024            | 2 +-
 tests/qemu-iotests/025            | 2 +-
 tests/qemu-iotests/026            | 2 +-
 tests/qemu-iotests/027            | 2 +-
 tests/qemu-iotests/028            | 2 +-
 tests/qemu-iotests/029            | 2 +-
 tests/qemu-iotests/031            | 2 +-
 tests/qemu-iotests/032            | 2 +-
 tests/qemu-iotests/033            | 2 +-
 tests/qemu-iotests/034            | 2 +-
 tests/qemu-iotests/035            | 2 +-
 tests/qemu-iotests/036            | 2 +-
 tests/qemu-iotests/037            | 2 +-
 tests/qemu-iotests/038            | 2 +-
 tests/qemu-iotests/039            | 2 +-
 tests/qemu-iotests/042            | 2 +-
 tests/qemu-iotests/043            | 2 +-
 tests/qemu-iotests/046            | 2 +-
 tests/qemu-iotests/047            | 2 +-
 tests/qemu-iotests/048            | 2 +-
 tests/qemu-iotests/049            | 2 +-
 tests/qemu-iotests/050            | 2 +-
 tests/qemu-iotests/051            | 2 +-
 tests/qemu-iotests/052            | 2 +-
 tests/qemu-iotests/053            | 2 +-
 tests/qemu-iotests/054            | 2 +-
 tests/qemu-iotests/058            | 2 +-
 tests/qemu-iotests/059            | 2 +-
 tests/qemu-iotests/060            | 2 +-
 tests/qemu-iotests/061            | 2 +-
 tests/qemu-iotests/062            | 2 +-
 tests/qemu-iotests/063            | 2 +-
 tests/qemu-iotests/064            | 2 +-
 tests/qemu-iotests/066            | 2 +-
 tests/qemu-iotests/067            | 2 +-
 tests/qemu-iotests/068            | 2 +-
 tests/qemu-iotests/069            | 2 +-
 tests/qemu-iotests/070            | 2 +-
 tests/qemu-iotests/071            | 2 +-
 tests/qemu-iotests/072            | 2 +-
 tests/qemu-iotests/073            | 2 +-
 tests/qemu-iotests/074            | 2 +-
 tests/qemu-iotests/075            | 2 +-
 tests/qemu-iotests/076            | 2 +-
 tests/qemu-iotests/077            | 2 +-
 tests/qemu-iotests/078            | 2 +-
 tests/qemu-iotests/079            | 2 +-
 tests/qemu-iotests/080            | 2 +-
 tests/qemu-iotests/081            | 2 +-
 tests/qemu-iotests/082            | 2 +-
 tests/qemu-iotests/083            | 2 +-
 tests/qemu-iotests/084            | 2 +-
 tests/qemu-iotests/085            | 2 +-
 tests/qemu-iotests/086            | 2 +-
 tests/qemu-iotests/087            | 2 +-
 tests/qemu-iotests/088            | 2 +-
 tests/qemu-iotests/089            | 2 +-
 tests/qemu-iotests/090            | 2 +-
 tests/qemu-iotests/091            | 2 +-
 tests/qemu-iotests/092            | 2 +-
 tests/qemu-iotests/094            | 2 +-
 tests/qemu-iotests/095            | 2 +-
 tests/qemu-iotests/097            | 2 +-
 tests/qemu-iotests/098            | 2 +-
 tests/qemu-iotests/099            | 2 +-
 tests/qemu-iotests/101            | 2 +-
 tests/qemu-iotests/102            | 2 +-
 tests/qemu-iotests/103            | 2 +-
 tests/qemu-iotests/104            | 2 +-
 tests/qemu-iotests/105            | 2 +-
 tests/qemu-iotests/106            | 2 +-
 tests/qemu-iotests/107            | 2 +-
 tests/qemu-iotests/108            | 2 +-
 tests/qemu-iotests/109            | 2 +-
 tests/qemu-iotests/110            | 2 +-
 tests/qemu-iotests/111            | 2 +-
 tests/qemu-iotests/112            | 2 +-
 tests/qemu-iotests/113            | 2 +-
 tests/qemu-iotests/114            | 2 +-
 tests/qemu-iotests/115            | 2 +-
 tests/qemu-iotests/116            | 2 +-
 tests/qemu-iotests/117            | 2 +-
 tests/qemu-iotests/119            | 2 +-
 tests/qemu-iotests/120            | 2 +-
 tests/qemu-iotests/121            | 2 +-
 tests/qemu-iotests/122            | 2 +-
 tests/qemu-iotests/123            | 2 +-
 tests/qemu-iotests/125            | 2 +-
 tests/qemu-iotests/126            | 2 +-
 tests/qemu-iotests/127            | 2 +-
 tests/qemu-iotests/128            | 2 +-
 tests/qemu-iotests/130            | 2 +-
 tests/qemu-iotests/131            | 2 +-
 tests/qemu-iotests/133            | 2 +-
 tests/qemu-iotests/134            | 2 +-
 tests/qemu-iotests/135            | 2 +-
 tests/qemu-iotests/137            | 2 +-
 tests/qemu-iotests/138            | 2 +-
 tests/qemu-iotests/140            | 2 +-
 tests/qemu-iotests/141            | 2 +-
 tests/qemu-iotests/142            | 2 +-
 tests/qemu-iotests/143            | 2 +-
 tests/qemu-iotests/144            | 2 +-
 tests/qemu-iotests/145            | 2 +-
 tests/qemu-iotests/146            | 2 +-
 tests/qemu-iotests/150            | 2 +-
 tests/qemu-iotests/153            | 2 +-
 tests/qemu-iotests/154            | 2 +-
 tests/qemu-iotests/156            | 2 +-
 tests/qemu-iotests/157            | 2 +-
 tests/qemu-iotests/158            | 2 +-
 tests/qemu-iotests/159            | 2 +-
 tests/qemu-iotests/160            | 2 +-
 tests/qemu-iotests/161            | 2 +-
 tests/qemu-iotests/162            | 2 +-
 tests/qemu-iotests/170            | 2 +-
 tests/qemu-iotests/171            | 2 +-
 tests/qemu-iotests/172            | 2 +-
 tests/qemu-iotests/173            | 2 +-
 tests/qemu-iotests/174            | 2 +-
 tests/qemu-iotests/175            | 2 +-
 tests/qemu-iotests/176            | 2 +-
 tests/qemu-iotests/177            | 2 +-
 tests/qemu-iotests/178            | 2 +-
 tests/qemu-iotests/179            | 2 +-
 tests/qemu-iotests/181            | 2 +-
 tests/qemu-iotests/182            | 2 +-
 tests/qemu-iotests/183            | 2 +-
 tests/qemu-iotests/184            | 2 +-
 tests/qemu-iotests/185            | 2 +-
 tests/qemu-iotests/186            | 2 +-
 tests/qemu-iotests/187            | 2 +-
 tests/qemu-iotests/188            | 2 +-
 tests/qemu-iotests/189            | 2 +-
 tests/qemu-iotests/190            | 2 +-
 tests/qemu-iotests/191            | 2 +-
 tests/qemu-iotests/192            | 2 +-
 tests/qemu-iotests/195            | 2 +-
 tests/qemu-iotests/197            | 2 +-
 tests/qemu-iotests/198            | 2 +-
 tests/qemu-iotests/200            | 2 +-
 tests/qemu-iotests/201            | 2 +-
 tests/qemu-iotests/204            | 2 +-
 tests/qemu-iotests/214            | 2 +-
 tests/qemu-iotests/215            | 2 +-
 tests/qemu-iotests/217            | 2 +-
 tests/qemu-iotests/220            | 2 +-
 tests/qemu-iotests/221            | 2 +-
 tests/qemu-iotests/223            | 2 +-
 tests/qemu-iotests/225            | 2 +-
 tests/qemu-iotests/226            | 2 +-
 tests/qemu-iotests/227            | 2 +-
 tests/qemu-iotests/229            | 2 +-
 tests/qemu-iotests/231            | 2 +-
 tests/qemu-iotests/232            | 2 +-
 tests/qemu-iotests/233            | 2 +-
 tests/qemu-iotests/check          | 2 +-
 tests/qemu-iotests/common.config  | 2 +-
 tests/qemu-iotests/common.filter  | 2 +-
 tests/qemu-iotests/common.nbd     | 2 +-
 tests/qemu-iotests/common.pattern | 2 +-
 tests/qemu-iotests/common.qemu    | 2 +-
 tests/qemu-iotests/common.rc      | 2 +-
 tests/qemu-iotests/common.tls     | 2 +-
 185 files changed, 185 insertions(+), 185 deletions(-)

diff --git a/tests/qemu-iotests/001 b/tests/qemu-iotests/001
index 55dcbb71d9..c1031a0815 100755
--- a/tests/qemu-iotests/001
+++ b/tests/qemu-iotests/001
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test simple read/write using plain bdrv_read/bdrv_write
 #
diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002
index 74572b4711..ee414a6b4f 100755
--- a/tests/qemu-iotests/002
+++ b/tests/qemu-iotests/002
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test simple read/write using plain bdrv_pread/bdrv_pwrite
 #
diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003
index bf2595559b..90aadea557 100755
--- a/tests/qemu-iotests/003
+++ b/tests/qemu-iotests/003
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test simple read/write using bdrv_aio_readv/bdrv_aio_writev
 #
diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004
index 841b15dfac..ff5d07fc4c 100755
--- a/tests/qemu-iotests/004
+++ b/tests/qemu-iotests/004
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Make sure we can't read and write outside of the image size.
 #
diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
index 8aa4283a4d..c0fecc331a 100755
--- a/tests/qemu-iotests/005
+++ b/tests/qemu-iotests/005
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Make sure qemu-img can create 5TB images
 #
diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007
index b983022a7f..9c404e7f6b 100755
--- a/tests/qemu-iotests/007
+++ b/tests/qemu-iotests/007
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Check for one possible case of qcow2 refcount corruption.
 #
diff --git a/tests/qemu-iotests/008 b/tests/qemu-iotests/008
index 8dfa10bcb8..3254b2e049 100755
--- a/tests/qemu-iotests/008
+++ b/tests/qemu-iotests/008
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test simple asynchronous read/write operations.
 #
diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009
index 73ae09db69..f7b5162faf 100755
--- a/tests/qemu-iotests/009
+++ b/tests/qemu-iotests/009
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Nolan I qcow2 corruption - incorrectly reports free clusters
 #
diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010
index 751aca9813..4715bec9da 100755
--- a/tests/qemu-iotests/010
+++ b/tests/qemu-iotests/010
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Nolan II qcow2 corruption - wrong used cluster
 #
diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011
index 35909564a9..ae6d9b06f7 100755
--- a/tests/qemu-iotests/011
+++ b/tests/qemu-iotests/011
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for AIO allocation on the same cluster
 #
diff --git a/tests/qemu-iotests/012 b/tests/qemu-iotests/012
index de9a5fb4d5..91278d6e79 100755
--- a/tests/qemu-iotests/012
+++ b/tests/qemu-iotests/012
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Make sure we can open read-only images
 #
diff --git a/tests/qemu-iotests/013 b/tests/qemu-iotests/013
index 5e1efcee28..0e6d0ee8ba 100755
--- a/tests/qemu-iotests/013
+++ b/tests/qemu-iotests/013
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 pattern test, empty and compressed image - 4k cluster patterns
 #
diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014
index 9ade571a95..8abadea3fd 100755
--- a/tests/qemu-iotests/014
+++ b/tests/qemu-iotests/014
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 pattern test, complex patterns including compression and snapshots
 # Using patterns for 4k cluster size.
diff --git a/tests/qemu-iotests/015 b/tests/qemu-iotests/015
index 21f7d42c84..d6c9c1eaa5 100755
--- a/tests/qemu-iotests/015
+++ b/tests/qemu-iotests/015
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Combined test to grow the refcount table and test snapshots.
 #
diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017
index 1ac6f74502..203e404477 100755
--- a/tests/qemu-iotests/017
+++ b/tests/qemu-iotests/017
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Simple backing file reads
 #
diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018
index bba30a1be2..97940b058e 100755
--- a/tests/qemu-iotests/018
+++ b/tests/qemu-iotests/018
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Merge backing file into test image when converting the image
 #
diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index 8f911a79c1..34b138bc7f 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # When using a backing file for the output image in qemu-img convert,
 # the backing file clusters must not copied. The data must still be
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index 6b972d082f..70fedda0d1 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Commit changes to backing file
 #
diff --git a/tests/qemu-iotests/021 b/tests/qemu-iotests/021
index c15ebf9eb8..4944381b03 100755
--- a/tests/qemu-iotests/021
+++ b/tests/qemu-iotests/021
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test handling of invalid patterns arguments to qemu-io
 #
diff --git a/tests/qemu-iotests/022 b/tests/qemu-iotests/022
index 44765c7b7a..397071ac79 100755
--- a/tests/qemu-iotests/022
+++ b/tests/qemu-iotests/022
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test bdrv_load/save_vmstate using the usual patterns
 #
diff --git a/tests/qemu-iotests/023 b/tests/qemu-iotests/023
index c8e1b9a761..1aeff56e85 100755
--- a/tests/qemu-iotests/023
+++ b/tests/qemu-iotests/023
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 pattern test with various cluster sizes
 #
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
index 428b5c815d..439e64aada 100755
--- a/tests/qemu-iotests/024
+++ b/tests/qemu-iotests/024
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Rebasing COW images
 #
diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025
index fcd4d97c17..fc9a16120a 100755
--- a/tests/qemu-iotests/025
+++ b/tests/qemu-iotests/025
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Resizing images
 #
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index 31276d9027..25a66274a5 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 error path testing
 #
diff --git a/tests/qemu-iotests/027 b/tests/qemu-iotests/027
index 2c46ae1457..50cf5abda5 100755
--- a/tests/qemu-iotests/027
+++ b/tests/qemu-iotests/027
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that sub-cluster allocating writes zero the rest of the cluster
 #
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index a2a7c93bcd..352b15d269 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that backing files can be smaller than the image
 #
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
index cf0fe0f6a6..b6571634d1 100755
--- a/tests/qemu-iotests/029
+++ b/tests/qemu-iotests/029
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 internal snapshots/VM state tests
 #
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index ac0dfaed7d..bde0a27514 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that all qcow2 header extensions survive a header rewrite
 #
diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032
index 3e86bb0111..fac4251ac8 100755
--- a/tests/qemu-iotests/032
+++ b/tests/qemu-iotests/032
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that AIO requests are drained before an image is closed. This used
 # to segfault because the request coroutine kept running even after the
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index 46b91388ef..f510dd4534 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test aligned and misaligned write zeroes operations.
 #
diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034
index 62812cd53c..b6bd114755 100755
--- a/tests/qemu-iotests/034
+++ b/tests/qemu-iotests/034
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test bdrv_pwrite_zeroes with backing files (see also 154)
 #
diff --git a/tests/qemu-iotests/035 b/tests/qemu-iotests/035
index 85d9ef7f8e..470ac6938f 100755
--- a/tests/qemu-iotests/035
+++ b/tests/qemu-iotests/035
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Let a few AIO requests run in parallel and have them access different L2
 # tables so that the cache has a chance to get used up.
diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index 4e76602a93..0e0bd01079 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qcow2 feature bits
 #
diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037
index a11992dad2..c56cc49e73 100755
--- a/tests/qemu-iotests/037
+++ b/tests/qemu-iotests/037
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test COW from backing files
 #
diff --git a/tests/qemu-iotests/038 b/tests/qemu-iotests/038
index 575093e8cf..238e195d1d 100755
--- a/tests/qemu-iotests/038
+++ b/tests/qemu-iotests/038
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test COW from backing files with AIO
 #
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index b3c344cb27..a886bb0950 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qcow2 lazy refcounts
 #
diff --git a/tests/qemu-iotests/042 b/tests/qemu-iotests/042
index beaa339000..c735d9fc93 100755
--- a/tests/qemu-iotests/042
+++ b/tests/qemu-iotests/042
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qemu-img operation on zero size images
 #
diff --git a/tests/qemu-iotests/043 b/tests/qemu-iotests/043
index fc9005b28f..0758247246 100755
--- a/tests/qemu-iotests/043
+++ b/tests/qemu-iotests/043
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that qemu-img info --backing-chain detects infinite loops
 #
diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
index 5e41d96daa..e10be442fb 100755
--- a/tests/qemu-iotests/046
+++ b/tests/qemu-iotests/046
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test concurrent cluster allocations
 #
diff --git a/tests/qemu-iotests/047 b/tests/qemu-iotests/047
index 6e776d2ce5..4c2d6297ac 100755
--- a/tests/qemu-iotests/047
+++ b/tests/qemu-iotests/047
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Regression test for commit b7ab0fea (which was a corruption fix,
 # despite the commit message claiming otherwise)
diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
index 9ed04a068d..5963139ef3 100755
--- a/tests/qemu-iotests/048
+++ b/tests/qemu-iotests/048
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 ##
 ## qemu-img compare test
 ##
diff --git a/tests/qemu-iotests/049 b/tests/qemu-iotests/049
index 97d8a64697..92b6333a69 100755
--- a/tests/qemu-iotests/049
+++ b/tests/qemu-iotests/049
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Check qemu-img option parsing
 #
diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050
index 963a0db97f..51bda876e3 100755
--- a/tests/qemu-iotests/050
+++ b/tests/qemu-iotests/050
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qemu-img rebase with zero clusters
 #
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 32741d7efd..5717083205 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test command line configuration of block devices and driver-specific options
 #
diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052
index b992adf4ff..0985e4724f 100755
--- a/tests/qemu-iotests/052
+++ b/tests/qemu-iotests/052
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test bdrv_read/bdrv_write using BDRV_O_SNAPSHOT
 #
diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053
index afa109c950..1fa7ebf800 100755
--- a/tests/qemu-iotests/053
+++ b/tests/qemu-iotests/053
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qemu-img convert when image length is not a multiple of cluster size
 #
diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
index cf88a7c76e..bd70b2e789 100755
--- a/tests/qemu-iotests/054
+++ b/tests/qemu-iotests/054
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test huge qcow2 images
 #
diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
index d6d4f94d5d..c5c85e4e7c 100755
--- a/tests/qemu-iotests/058
+++ b/tests/qemu-iotests/058
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test export internal snapshot by qemu-nbd, convert it by qemu-img.
 #
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 54d5567acc..4bd2751b51 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for vmdk
 #
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index af0588ae9a..afa764785e 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for image corruption (overlapping data structures) in qcow2
 #
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index 1a50163419..aa1ccb817a 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for image option amendment in qcow2.
 #
diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
index 985fbef41e..29bc89e113 100755
--- a/tests/qemu-iotests/062
+++ b/tests/qemu-iotests/062
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for snapshotting images with unallocated zero clusters in
 # qcow2
diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063
index 041fb5c1ac..d287da974e 100755
--- a/tests/qemu-iotests/063
+++ b/tests/qemu-iotests/063
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # test of qemu-img convert -n - convert without creation
 #
diff --git a/tests/qemu-iotests/064 b/tests/qemu-iotests/064
index f55ff37ca7..e57242eb19 100755
--- a/tests/qemu-iotests/064
+++ b/tests/qemu-iotests/064
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test VHDX read/write from a sample image created with Hyper-V
 #
diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
index 26c043711b..758e1fe162 100755
--- a/tests/qemu-iotests/066
+++ b/tests/qemu-iotests/066
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for preallocated zero clusters in qcow2
 #
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index 342b2b0a30..efcca25704 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test automatic deletion of BDSes created by -drive/drive_add
 #
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
index f0583d52ae..f92a13351c 100755
--- a/tests/qemu-iotests/068
+++ b/tests/qemu-iotests/068
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for loading a saved VM state from a qcow2 image
 #
diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069
index fdee121f43..a9c8bcb038 100755
--- a/tests/qemu-iotests/069
+++ b/tests/qemu-iotests/069
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for deleting a backing file
 #
diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070
index 78e0390f5f..c3e3a567f6 100755
--- a/tests/qemu-iotests/070
+++ b/tests/qemu-iotests/070
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test VHDX log replay from an image with a journal that needs to be
 # replayed
diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
index 6e467dc1da..f47c9ce77c 100755
--- a/tests/qemu-iotests/071
+++ b/tests/qemu-iotests/071
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for the QMP blkdebug and blkverify interfaces
 #
diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072
index 08ef29f5b4..ad8f512e5a 100755
--- a/tests/qemu-iotests/072
+++ b/tests/qemu-iotests/072
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for nested image formats
 #
diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
index 5e7f76cb7f..ddde6eeab5 100755
--- a/tests/qemu-iotests/073
+++ b/tests/qemu-iotests/073
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test count_contiguous_clusters in qcow2
 #
diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074
index b17866bd34..f2a335188e 100755
--- a/tests/qemu-iotests/074
+++ b/tests/qemu-iotests/074
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 ##
 ## qemu-img compare test (qcow2 only ones)
 ##
diff --git a/tests/qemu-iotests/075 b/tests/qemu-iotests/075
index 45b8901ef0..82da837f03 100755
--- a/tests/qemu-iotests/075
+++ b/tests/qemu-iotests/075
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # cloop format input validation tests
 #
diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076
index 3b5ab3fd08..560bdbbc57 100755
--- a/tests/qemu-iotests/076
+++ b/tests/qemu-iotests/076
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # parallels format input validation tests
 #
diff --git a/tests/qemu-iotests/077 b/tests/qemu-iotests/077
index 58fe8932b3..c46b3d2e4c 100755
--- a/tests/qemu-iotests/077
+++ b/tests/qemu-iotests/077
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test concurrent pread/pwrite
 #
diff --git a/tests/qemu-iotests/078 b/tests/qemu-iotests/078
index 68d0ea8802..1a1a7643fc 100755
--- a/tests/qemu-iotests/078
+++ b/tests/qemu-iotests/078
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # bochs format input validation tests
 #
diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079
index fca2f77d37..baeaa8407c 100755
--- a/tests/qemu-iotests/079
+++ b/tests/qemu-iotests/079
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qcow2 preallocation with different cluster_sizes
 #
diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
index cec2376f59..2c2e3e0709 100755
--- a/tests/qemu-iotests/080
+++ b/tests/qemu-iotests/080
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 format input validation tests
 #
diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index edf6e6172a..84a034ebc2 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test Quorum block driver
 #
diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082
index 61eec63797..3fb76d61ee 100755
--- a/tests/qemu-iotests/082
+++ b/tests/qemu-iotests/082
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qemu-img command line parsing
 #
diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
index 89f67db70f..2384dbcb46 100755
--- a/tests/qemu-iotests/083
+++ b/tests/qemu-iotests/083
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test NBD client unexpected disconnect
 #
diff --git a/tests/qemu-iotests/084 b/tests/qemu-iotests/084
index e131fa9642..5632099a65 100755
--- a/tests/qemu-iotests/084
+++ b/tests/qemu-iotests/084
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for VDI header corruption; image too large, and too many blocks.
 # Also simple test for creating dynamic and static VDI images.
diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
index ade68ef853..c3aa6c20fe 100755
--- a/tests/qemu-iotests/085
+++ b/tests/qemu-iotests/085
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Live snapshot tests
 #
diff --git a/tests/qemu-iotests/086 b/tests/qemu-iotests/086
index 3cca3687ea..b47f9459f0 100755
--- a/tests/qemu-iotests/086
+++ b/tests/qemu-iotests/086
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qemu-img progress output
 #
diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
index f625887082..ef4e56e3e2 100755
--- a/tests/qemu-iotests/087
+++ b/tests/qemu-iotests/087
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test unsupported blockdev-add cases
 #
diff --git a/tests/qemu-iotests/088 b/tests/qemu-iotests/088
index c5e9ab42c7..eafc64ee0b 100755
--- a/tests/qemu-iotests/088
+++ b/tests/qemu-iotests/088
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # vpc (VHD) format input validation tests
 #
diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089
index 3165d79e2a..731930e5ab 100755
--- a/tests/qemu-iotests/089
+++ b/tests/qemu-iotests/089
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for support of JSON filenames
 #
diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090
index 1450993e15..08e9a7f6bd 100755
--- a/tests/qemu-iotests/090
+++ b/tests/qemu-iotests/090
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for discarding compressed clusters on qcow2 images
 #
diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091
index 2f2f98ee64..4d12476f1d 100755
--- a/tests/qemu-iotests/091
+++ b/tests/qemu-iotests/091
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Live migration test
 #
diff --git a/tests/qemu-iotests/092 b/tests/qemu-iotests/092
index 8e318f10b9..2c38c5cf7b 100755
--- a/tests/qemu-iotests/092
+++ b/tests/qemu-iotests/092
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow1 format input validation tests
 #
diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
index 7adc9b9138..1a6a31b61f 100755
--- a/tests/qemu-iotests/094
+++ b/tests/qemu-iotests/094
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for drive-mirror to NBD
 #
diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095
index 9fc47f6b87..5930a021f2 100755
--- a/tests/qemu-iotests/095
+++ b/tests/qemu-iotests/095
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for commit of larger active layer
 #
diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097
index 7234b16053..18c664ab0f 100755
--- a/tests/qemu-iotests/097
+++ b/tests/qemu-iotests/097
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Commit changes into backing chains and empty the top image if the
 # backing image is not explicitly specified
diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
index c7977da99a..8303630e0f 100755
--- a/tests/qemu-iotests/098
+++ b/tests/qemu-iotests/098
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qcow2's bdrv_make_empty for images without internal snapshots
 #
diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
index 578808b747..0faab57632 100755
--- a/tests/qemu-iotests/099
+++ b/tests/qemu-iotests/099
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test valid filenames for blkdebug and blkverify representatively for
 # other protocols (such as NBD) when queried
diff --git a/tests/qemu-iotests/101 b/tests/qemu-iotests/101
index 3001ba3c0a..c80201f54d 100755
--- a/tests/qemu-iotests/101
+++ b/tests/qemu-iotests/101
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test short file I/O
 #
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
index 29a6a940e2..e7cbd74d90 100755
--- a/tests/qemu-iotests/102
+++ b/tests/qemu-iotests/102
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for qemu-io -c map and qemu-img map
 #
diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
index 66f8167f02..87c2b10d0a 100755
--- a/tests/qemu-iotests/103
+++ b/tests/qemu-iotests/103
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for qcow2 metadata cache size specification
 #
diff --git a/tests/qemu-iotests/104 b/tests/qemu-iotests/104
index 34bb0d23ba..2d3ba91764 100755
--- a/tests/qemu-iotests/104
+++ b/tests/qemu-iotests/104
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test image creation with aligned and unaligned sizes
 #
diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105
index 943bda2f4f..c82e48fcf7 100755
--- a/tests/qemu-iotests/105
+++ b/tests/qemu-iotests/105
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Create, read, write big image
 #
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
index 4129fee6bc..771a3a6c7a 100755
--- a/tests/qemu-iotests/106
+++ b/tests/qemu-iotests/106
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test preallocated resize of raw images
 #
diff --git a/tests/qemu-iotests/107 b/tests/qemu-iotests/107
index 5d70ad2007..c78da8b660 100755
--- a/tests/qemu-iotests/107
+++ b/tests/qemu-iotests/107
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Tests updates of the qcow2 L1 table
 #
diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
index 58e8ad7636..d4ebf1a87e 100755
--- a/tests/qemu-iotests/108
+++ b/tests/qemu-iotests/108
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for repairing qcow2 images which cannot be repaired using
 # the on-disk refcount structures
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
index b51e4616c6..8ce6e5ea1b 100755
--- a/tests/qemu-iotests/109
+++ b/tests/qemu-iotests/109
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test writing image headers of other formats into raw images
 #
diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
index b64b3b215a..6846174fe3 100755
--- a/tests/qemu-iotests/110
+++ b/tests/qemu-iotests/110
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for relative backing file names in complex BDS trees
 #
diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
index e15e66ac5d..d4ed91e6ba 100755
--- a/tests/qemu-iotests/111
+++ b/tests/qemu-iotests/111
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for non-existing backing file when creating a qcow2 image
 # and not specifying the size
diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
index d67e6ebe9c..0ec5e2509d 100755
--- a/tests/qemu-iotests/112
+++ b/tests/qemu-iotests/112
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test cases for different refcount_bits values
 #
diff --git a/tests/qemu-iotests/113 b/tests/qemu-iotests/113
index d8d78c46dc..2f74ee89de 100755
--- a/tests/qemu-iotests/113
+++ b/tests/qemu-iotests/113
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for accessing creation options on image formats and
 # protocols not supporting image creation
diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
index e17fb514cb..391489dbb1 100755
--- a/tests/qemu-iotests/114
+++ b/tests/qemu-iotests/114
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test invalid backing file format in qcow2 images
 #
diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115
index 0581e03c26..aad0602bd5 100755
--- a/tests/qemu-iotests/115
+++ b/tests/qemu-iotests/115
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for non-self-referential qcow2 refcount blocks
 #
diff --git a/tests/qemu-iotests/116 b/tests/qemu-iotests/116
index f8a27b9c02..131d90af70 100755
--- a/tests/qemu-iotests/116
+++ b/tests/qemu-iotests/116
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test error code paths for invalid QED images
 #
diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117
index e533e230a3..465d95436c 100755
--- a/tests/qemu-iotests/117
+++ b/tests/qemu-iotests/117
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for shared BDS between backend trees
 #
diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119
index 32810d52c9..804034f59c 100755
--- a/tests/qemu-iotests/119
+++ b/tests/qemu-iotests/119
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # NBD test case for overriding BDRV_O_PROTOCOL by explicitly specifying
 # a driver
diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120
index 76afdf449b..83e63e213d 100755
--- a/tests/qemu-iotests/120
+++ b/tests/qemu-iotests/120
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Non-NBD test cases for overriding BDRV_O_PROTOCOL by explicitly
 # specifying a driver
diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
index d2885c700f..27651cddcf 100755
--- a/tests/qemu-iotests/121
+++ b/tests/qemu-iotests/121
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test cases for qcow2 refcount table growth
 #
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
index eab3399dd6..7d0abee6bf 100755
--- a/tests/qemu-iotests/122
+++ b/tests/qemu-iotests/122
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test some qemu-img convert cases
 #
diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
index 168b985c8b..4e60d3fd17 100755
--- a/tests/qemu-iotests/123
+++ b/tests/qemu-iotests/123
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for qemu-img convert to NBD
 #
diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
index 778c874933..3efc4f957a 100755
--- a/tests/qemu-iotests/125
+++ b/tests/qemu-iotests/125
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test preallocated growth of qcow2 images
 #
diff --git a/tests/qemu-iotests/126 b/tests/qemu-iotests/126
index 91148383ad..8fb6fab3f1 100755
--- a/tests/qemu-iotests/126
+++ b/tests/qemu-iotests/126
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Tests handling of colons in filenames (which may be confused with protocol
 # prefixes)
diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127
index c9139ed5e6..29e30c1d13 100755
--- a/tests/qemu-iotests/127
+++ b/tests/qemu-iotests/127
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for mirroring with dataplane
 #
diff --git a/tests/qemu-iotests/128 b/tests/qemu-iotests/128
index 925f5c7e98..24dae3c567 100755
--- a/tests/qemu-iotests/128
+++ b/tests/qemu-iotests/128
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that opening O_DIRECT succeeds when image file I/O produces EIO
 #
diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130
index f2f2706b28..1800be2ecb 100755
--- a/tests/qemu-iotests/130
+++ b/tests/qemu-iotests/130
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that temporary backing file overrides (on the command line or in
 # blockdev-add) don't replace the original path stored in the image during
diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131
index 58c25f7abe..ac4d79adf0 100755
--- a/tests/qemu-iotests/131
+++ b/tests/qemu-iotests/131
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # parallels format validation tests (created by QEMU)
 #
diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133
index 565e0b1b6e..fc4479e23d 100755
--- a/tests/qemu-iotests/133
+++ b/tests/qemu-iotests/133
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for reopen
 #
diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134
index cacabcd28b..cdcdbb7879 100755
--- a/tests/qemu-iotests/134
+++ b/tests/qemu-iotests/134
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test encrypted read/write using plain bdrv_read/bdrv_write
 #
diff --git a/tests/qemu-iotests/135 b/tests/qemu-iotests/135
index a18a0c7230..e7de998cb1 100755
--- a/tests/qemu-iotests/135
+++ b/tests/qemu-iotests/135
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test VPC open of image with large Max Table Entries value.
 #
diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
index 09cd4450ca..0a9492703f 100755
--- a/tests/qemu-iotests/137
+++ b/tests/qemu-iotests/137
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qcow2 reopen
 #
diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
index eccbcae3a6..f3a3401bb7 100755
--- a/tests/qemu-iotests/138
+++ b/tests/qemu-iotests/138
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # General test case for qcow2's image check
 #
diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140
index d4623b5a5d..ab5b6ab44d 100755
--- a/tests/qemu-iotests/140
+++ b/tests/qemu-iotests/140
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for ejecting a BlockBackend with an NBD server attached to it
 #
diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141
index e2408c7988..41bd4b8acf 100755
--- a/tests/qemu-iotests/141
+++ b/tests/qemu-iotests/141
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for ejecting BDSs with block jobs still running on them
 #
diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
index 5fc488f5d2..2b4c2a58d9 100755
--- a/tests/qemu-iotests/142
+++ b/tests/qemu-iotests/142
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for configuring cache modes of arbitrary nodes (requires O_DIRECT)
 #
diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143
index d6302cc06d..09b4abc3eb 100755
--- a/tests/qemu-iotests/143
+++ b/tests/qemu-iotests/143
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for connecting to a non-existing NBD export name
 #
diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144
index 118c099994..dbc99f2f60 100755
--- a/tests/qemu-iotests/144
+++ b/tests/qemu-iotests/144
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 # Check live snapshot, followed by active commit, and another snapshot.
 #
 # This test is to catch the error case of BZ #1300209:
diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145
index 6ce8a46f92..53b8dd1d79 100755
--- a/tests/qemu-iotests/145
+++ b/tests/qemu-iotests/145
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test the combination of -incoming and snapshot=on
 #
diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146
index 3f61351ffe..3cf9484662 100755
--- a/tests/qemu-iotests/146
+++ b/tests/qemu-iotests/146
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test VHD image format creator detection and override
 #
diff --git a/tests/qemu-iotests/150 b/tests/qemu-iotests/150
index 955b877efa..b9508cf10a 100755
--- a/tests/qemu-iotests/150
+++ b/tests/qemu-iotests/150
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that qemu-img convert -S 0 fully allocates the target image
 #
diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index 3120a61da4..05be7667a7 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test image locking
 #
diff --git a/tests/qemu-iotests/154 b/tests/qemu-iotests/154
index 4a4abf0589..cd9f8ff3d8 100755
--- a/tests/qemu-iotests/154
+++ b/tests/qemu-iotests/154
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qcow2 specific bdrv_pwrite_zeroes tests with backing files (complements 034)
 #
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
index f97f96f666..0c7f3ced8c 100755
--- a/tests/qemu-iotests/156
+++ b/tests/qemu-iotests/156
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Tests oVirt-like storage migration:
 #  - Create snapshot
diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157
index 6fb26596ad..7a6993360d 100755
--- a/tests/qemu-iotests/157
+++ b/tests/qemu-iotests/157
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test command line configuration of block devices with qdev
 #
diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158
index d277ddcc94..121141e078 100755
--- a/tests/qemu-iotests/158
+++ b/tests/qemu-iotests/158
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test encrypted read/write using backing files
 #
diff --git a/tests/qemu-iotests/159 b/tests/qemu-iotests/159
index e74b2739de..27736efbfd 100755
--- a/tests/qemu-iotests/159
+++ b/tests/qemu-iotests/159
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 #
 # qemu-img dd test with different block sizes
 #
diff --git a/tests/qemu-iotests/160 b/tests/qemu-iotests/160
index 92fff45d10..965d5199cc 100755
--- a/tests/qemu-iotests/160
+++ b/tests/qemu-iotests/160
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 #
 # qemu-img dd test for the skip option
 #
diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161
index 180df17ad6..788dbb7ce1 100755
--- a/tests/qemu-iotests/161
+++ b/tests/qemu-iotests/161
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test reopening a backing image after block-stream and block-commit
 #
diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162
index ef02d844a2..97d0368b1b 100755
--- a/tests/qemu-iotests/162
+++ b/tests/qemu-iotests/162
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for specifying runtime options of the wrong type to some
 # block drivers
diff --git a/tests/qemu-iotests/170 b/tests/qemu-iotests/170
index 861eabf5cc..0e3feacc88 100755
--- a/tests/qemu-iotests/170
+++ b/tests/qemu-iotests/170
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 #
 # qemu-img dd test
 #
diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171
index 5b46069fde..06617ea112 100755
--- a/tests/qemu-iotests/171
+++ b/tests/qemu-iotests/171
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test 'offset' and 'size' options of the raw driver. Make sure we can't
 # (or can) read and write outside of the image size.
diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
index 1e60a7e3d6..f8efc06759 100755
--- a/tests/qemu-iotests/172
+++ b/tests/qemu-iotests/172
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test floppy configuration
 #
diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173
index 1fe8c5d738..2043f55e92 100755
--- a/tests/qemu-iotests/173
+++ b/tests/qemu-iotests/173
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test QAPI commands looking up protocol based images with relative
 # filename backing strings
diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174
index d8bb05c4e2..5c7c74f232 100755
--- a/tests/qemu-iotests/174
+++ b/tests/qemu-iotests/174
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test that qemu-io fail with non-zero exit code
 #
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
index ebbeb6e74c..374920f28c 100755
--- a/tests/qemu-iotests/175
+++ b/tests/qemu-iotests/175
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test creating raw image preallocation mode
 #
diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
index 4ecd5894a3..b951a0f263 100755
--- a/tests/qemu-iotests/176
+++ b/tests/qemu-iotests/176
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Commit changes into backing chains and empty the top image if the
 # backing image is not explicitly specified.
diff --git a/tests/qemu-iotests/177 b/tests/qemu-iotests/177
index f0c1155e80..b6dbf75f3c 100755
--- a/tests/qemu-iotests/177
+++ b/tests/qemu-iotests/177
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test corner cases with unusual block geometries
 #
diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
index 3f4b4a4564..d990455582 100755
--- a/tests/qemu-iotests/178
+++ b/tests/qemu-iotests/178
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qemu-img measure sub-command tests
 #
diff --git a/tests/qemu-iotests/179 b/tests/qemu-iotests/179
index 3040631636..f4671cbcf2 100755
--- a/tests/qemu-iotests/179
+++ b/tests/qemu-iotests/179
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for write zeroes with unmap
 #
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index 0c44108dac..5e7c98f7b3 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test postcopy live migration with shared storage
 #
diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
index 9e078c5484..8533f26eab 100755
--- a/tests/qemu-iotests/182
+++ b/tests/qemu-iotests/182
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test image locking for POSIX locks
 #
diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183
index ebb5e304ac..2e20b63dbc 100755
--- a/tests/qemu-iotests/183
+++ b/tests/qemu-iotests/183
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test old-style block migration (migrate -b)
 #
diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
index 0af7a73aca..7021e3cde9 100755
--- a/tests/qemu-iotests/184
+++ b/tests/qemu-iotests/184
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test I/O throttle block filter driver interface
 #
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
index d8f1505cd8..822eaf5bc9 100755
--- a/tests/qemu-iotests/185
+++ b/tests/qemu-iotests/185
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test exiting qemu while jobs are still running
 #
diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
index c27dc953b6..525f2b23c5 100755
--- a/tests/qemu-iotests/186
+++ b/tests/qemu-iotests/186
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test 'info block' with all kinds of configurations
 #
diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187
index 1feddca508..ae6762c82b 100755
--- a/tests/qemu-iotests/187
+++ b/tests/qemu-iotests/187
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test switching between read-only and read-write
 #
diff --git a/tests/qemu-iotests/188 b/tests/qemu-iotests/188
index af40e496ee..a1f98744bf 100755
--- a/tests/qemu-iotests/188
+++ b/tests/qemu-iotests/188
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test encrypted read/write using plain bdrv_read/bdrv_write
 #
diff --git a/tests/qemu-iotests/189 b/tests/qemu-iotests/189
index 222bec133b..67b1ba64bc 100755
--- a/tests/qemu-iotests/189
+++ b/tests/qemu-iotests/189
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test encrypted read/write using backing files
 #
diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
index 95ba06d8f4..3eb50477af 100755
--- a/tests/qemu-iotests/190
+++ b/tests/qemu-iotests/190
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # qemu-img measure sub-command tests on huge qcow2 files
 #
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
index 198272ea3b..d9de1a0bde 100755
--- a/tests/qemu-iotests/191
+++ b/tests/qemu-iotests/191
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test commit block job where top has two parents
 #
diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192
index 415c706db5..53a7e76950 100755
--- a/tests/qemu-iotests/192
+++ b/tests/qemu-iotests/192
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test NBD export with -incoming (non-shared storage migration use case from
 # libvirt)
diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
index a977c9798e..dfd06eba23 100755
--- a/tests/qemu-iotests/195
+++ b/tests/qemu-iotests/195
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test change-backing-file command
 #
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index 8170f5d4ab..f8d1a7adc3 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for copy-on-read into qcow2
 #
diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
index 4d961f4f3a..4e5abba161 100755
--- a/tests/qemu-iotests/198
+++ b/tests/qemu-iotests/198
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test commit of encrypted qcow2 files
 #
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index b9ebd5a8c7..758f5bc1be 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Block job co-routine race condition test.
 #
diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201
index c1a1e00077..69de2d5a54 100755
--- a/tests/qemu-iotests/201
+++ b/tests/qemu-iotests/201
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test savevm and loadvm after live migration with postcopy flag
 #
diff --git a/tests/qemu-iotests/204 b/tests/qemu-iotests/204
index 30f0653ce9..192a4490b1 100755
--- a/tests/qemu-iotests/204
+++ b/tests/qemu-iotests/204
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test corner cases with unusual block geometries
 #
diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214
index 7a2d5391bb..fee7eca8e2 100755
--- a/tests/qemu-iotests/214
+++ b/tests/qemu-iotests/214
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qcow2 image compression
 #
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index 230fd2551a..9b0b155a56 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test case for copy-on-read into qcow2, using the COR filter driver
 #
diff --git a/tests/qemu-iotests/217 b/tests/qemu-iotests/217
index d3ab5d72be..28a94f1ab2 100755
--- a/tests/qemu-iotests/217
+++ b/tests/qemu-iotests/217
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # I/O errors when working with internal qcow2 snapshots, and repairing
 # the result
diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220
index 0c5682bda0..93b5c2639a 100755
--- a/tests/qemu-iotests/220
+++ b/tests/qemu-iotests/220
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # max limits on compression in huge qcow2 files
 #
diff --git a/tests/qemu-iotests/221 b/tests/qemu-iotests/221
index 06f48f1f23..5e72287e4b 100755
--- a/tests/qemu-iotests/221
+++ b/tests/qemu-iotests/221
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test qemu-img vs. unaligned images
 #
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index f120a01646..b45c18c2a3 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test reading dirty bitmap over NBD
 #
diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225
index e42ee94ff0..c1cad7a474 100755
--- a/tests/qemu-iotests/225
+++ b/tests/qemu-iotests/225
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test vmdk backing file correlation
 #
diff --git a/tests/qemu-iotests/226 b/tests/qemu-iotests/226
index aec413b23c..b81aaa80fd 100755
--- a/tests/qemu-iotests/226
+++ b/tests/qemu-iotests/226
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # This test covers expected filetypes for the file, host_cdrom and
 # host_device drivers.
diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
index be1b636af0..68c362c92e 100755
--- a/tests/qemu-iotests/227
+++ b/tests/qemu-iotests/227
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test query-blockstats with different ways to create a BB
 #
diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
index 893d098ad2..463080636e 100755
--- a/tests/qemu-iotests/229
+++ b/tests/qemu-iotests/229
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for force canceling a running blockjob that is paused in
 # an error state.
diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231
index e9f8aaacd3..327e074489 100755
--- a/tests/qemu-iotests/231
+++ b/tests/qemu-iotests/231
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test legacy and modern option parsing for rbd/ceph.  This will not
 # actually connect to a ceph server, but rather looks for the appropriate
diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
index 0708b8b155..044710ee79 100755
--- a/tests/qemu-iotests/232
+++ b/tests/qemu-iotests/232
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test for auto-read-only
 #
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
index fc345a1a46..b8ba12dcaf 100755
--- a/tests/qemu-iotests/233
+++ b/tests/qemu-iotests/233
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Test NBD TLS certificate / authorization integration
 #
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 89ed275988..6b618628f1 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2002,2006 Silicon Graphics, Inc.  All Rights Reserved.
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 9f460f203d..c87c944f7a 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc.  All Rights Reserved.
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 2031e353a5..17eb3402a7 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
diff --git a/tests/qemu-iotests/common.nbd b/tests/qemu-iotests/common.nbd
index 233187a25c..c762435bae 100644
--- a/tests/qemu-iotests/common.nbd
+++ b/tests/qemu-iotests/common.nbd
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 # -*- shell-script-mode -*-
 #
 # Helpers for NBD server related config
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index b67bb34136..8d3fdbaf0e 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Copyright (C) 2009 Red Hat, Inc.
 #
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 7c87b897fa..39098c2c13 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # This allows for launching of multiple QEMU instances, with independent
 # communication possible to each instance.
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index e15e7a7c8e..0c4f0a5987 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
index eae81789bb..191c26df09 100644
--- a/tests/qemu-iotests/common.tls
+++ b/tests/qemu-iotests/common.tls
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 #
 # Helpers for TLS related config
 #
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 07/18] tests/multiboot: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 18:10   ` Kamil Rytarowski
  2019-01-29 22:16   ` Eric Blake
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: " Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  17 siblings, 2 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/multiboot/run_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/multiboot/run_test.sh b/tests/multiboot/run_test.sh
index 6c33003e71..a88e423992 100755
--- a/tests/multiboot/run_test.sh
+++ b/tests/multiboot/run_test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#! /usr/bin/env bash
 
 # Copyright (c) 2013 Kevin Wolf <kwolf@redhat.com>
 #
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 07/18] tests/multiboot: " Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 18:12   ` Kamil Rytarowski
                     ` (2 more replies)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  17 siblings, 3 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Bash is not always installed as /bin/bash. In particular on OpenBSD,
the package installs it in /usr/local/bin.
Use the 'env' shebang to search bash in the $PATH.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/data/acpi/rebuild-expected-aml.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh
index bf9ba242ad..ff77a751c8 100755
--- a/tests/data/acpi/rebuild-expected-aml.sh
+++ b/tests/data/acpi/rebuild-expected-aml.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
 
 #
 # Rebuild expected AML files for acpi unit-test
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: " Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-02-05 13:20   ` Peter Maydell
  2019-02-05 16:09   ` Alex Bennée
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  17 siblings, 2 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Various iotests scripts (run via 'make check-block')  use bash
specific extentions.  OpenBSD comes with the Korn shell as default.
Install bash to be able to run those tests.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/vm/openbsd | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index 6263c8956b..e9c2a3f2c8 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -45,6 +45,8 @@ class OpenBSDVM(basevm.BaseVM):
         self.wait_ssh()
         sys.stderr.write("Disabling W^X on the build partition...\n")
         self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
+        sys.stderr.write("Installing bash...\n")
+        self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add bash")
         self.ssh_root("shutdown -p now")
         self.wait()
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 22:21   ` Eric Blake
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 11/18] tests/vm/openbsd: Install GNU sed from the ports Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Various sed regexp from common.filter use sed GNU extensions.
Instead of spending time to write these regex to be POSIX compliant,
verify the GNU sed is available and use it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
I think the test isn't well placed in common.filter and should be in
common.rc, but couldn't get that working.
---
 tests/qemu-iotests/common.filter | 36 ++++++++++++++++----------------
 tests/qemu-iotests/common.rc     | 12 +++++++++++
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 17eb3402a7..47a5ed77ee 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -23,37 +23,37 @@
 #
 _filter_date()
 {
-    sed \
+    ${SED} \
         -e 's/[A-Z][a-z][a-z] [A-z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'
 }
 
 _filter_generated_node_ids()
 {
-     sed -re 's/\#block[0-9]{3,}/NODE_NAME/'
+    ${SED} -re 's/\#block[0-9]{3,}/NODE_NAME/'
 }
 
 _filter_qom_path()
 {
-    sed -e 's#\(Attached to: *\) /.*#\1 PATH#'
+    ${SED} -e 's#\(Attached to: *\) /.*#\1 PATH#'
 }
 
 # replace occurrences of the actual TEST_DIR value with TEST_DIR
 _filter_testdir()
 {
-    sed -e "s#$TEST_DIR/#TEST_DIR/#g"
+    ${SED} -e "s#$TEST_DIR/#TEST_DIR/#g"
 }
 
 # replace occurrences of the actual IMGFMT value with IMGFMT
 _filter_imgfmt()
 {
-    sed -e "s#$IMGFMT#IMGFMT#g"
+    ${SED} -e "s#$IMGFMT#IMGFMT#g"
 }
 
 # Replace error message when the format is not supported and delete
 # the output lines after the first one
 _filter_qemu_img_check()
 {
-    sed -e '/allocated.*fragmented.*compressed clusters/d' \
+    ${SED} -e '/allocated.*fragmented.*compressed clusters/d' \
         -e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \
         -e '/Image end offset: [0-9]\+/d'
 }
@@ -61,13 +61,13 @@ _filter_qemu_img_check()
 # Removes \r from messages
 _filter_win32()
 {
-    sed -e 's/\r//g'
+    ${SED} -e 's/\r//g'
 }
 
 # sanitize qemu-io output
 _filter_qemu_io()
 {
-    _filter_win32 | sed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/" \
+    _filter_win32 | ${SED} -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/" \
         -e "s/: line [0-9][0-9]*:  *[0-9][0-9]*\( Aborted\| Killed\)/:\1/" \
         -e "s/qemu-io> //g"
 }
@@ -75,7 +75,7 @@ _filter_qemu_io()
 # replace occurrences of QEMU_PROG with "qemu"
 _filter_qemu()
 {
-    sed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
+    ${SED} -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
         -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
         -e $'s#\r##' # QEMU monitor uses \r\n line endings
 }
@@ -84,7 +84,7 @@ _filter_qemu()
 _filter_qmp()
 {
     _filter_win32 | \
-    sed -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \
+    ${SED} -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \
         -e 's#^{"QMP":.*}$#QMP_VERSION#' \
         -e '/^    "QMP": {\s*$/, /^    }\s*$/ c\' \
         -e '    QMP_VERSION'
@@ -93,32 +93,32 @@ _filter_qmp()
 # readline makes HMP command strings so long that git complains
 _filter_hmp()
 {
-    sed -e $'s/^\\((qemu) \\)\\?.*\e\\[D/\\1/g' \
+    ${SED} -e $'s/^\\((qemu) \\)\\?.*\e\\[D/\\1/g' \
         -e $'s/\e\\[K//g'
 }
 
 # replace block job offset
 _filter_block_job_offset()
 {
-    sed -e 's/, "offset": [0-9]\+,/, "offset": OFFSET,/'
+    ${SED} -e 's/, "offset": [0-9]\+,/, "offset": OFFSET,/'
 }
 
 # replace block job len
 _filter_block_job_len()
 {
-    sed -e 's/, "len": [0-9]\+,/, "len": LEN,/g'
+    ${SED} -e 's/, "len": [0-9]\+,/, "len": LEN,/g'
 }
 
 # replace actual image size (depends on the host filesystem)
 _filter_actual_image_size()
 {
-    sed -s 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
+    ${SED} -s 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
 }
 
 # replace driver-specific options in the "Formatting..." line
 _filter_img_create()
 {
-    sed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
+    ${SED} -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGFMT#IMGFMT#g" \
@@ -154,7 +154,7 @@ _filter_img_info()
 
     discard=0
     regex_json_spec_start='^ *"format-specific": \{'
-    sed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
+    ${SED} -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGFMT#IMGFMT#g" \
@@ -200,7 +200,7 @@ _filter_img_info()
 # human and json output
 _filter_qemu_img_map()
 {
-    sed -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \
+    ${SED} -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \
         -e 's/"offset": [0-9]\+/"offset": OFFSET/g' \
         -e 's/Mapped to *//' | _filter_testdir | _filter_imgfmt
 }
@@ -212,7 +212,7 @@ _filter_nbd()
     # receive callbacks sometimes, making them unreliable.
     #
     # Filter out the TCP port number since this changes between runs.
-    sed -e '/nbd\/.*\.c:/d' \
+    ${SED} -e '/nbd\/.*\.c:/d' \
         -e 's#127\.0\.0\.1:[0-9]*#127.0.0.1:PORT#g' \
         -e "s#?socket=$TEST_DIR#?socket=TEST_DIR#g" \
         -e 's#\(foo\|PORT/\?\|.sock\): Failed to .*$#\1#'
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 0c4f0a5987..9eb94d73d5 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -17,6 +17,18 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+for sed in sed gsed; do
+    (command $sed --version | grep 'GNU sed') > /dev/null 2>&1
+    if [ "$?" -eq 0 ]; then
+        SED=$sed
+        break
+    fi
+done
+if [ -z "$SED" ]; then
+    echo "$0: GNU sed not found"
+    exit 1
+fi
+
 dd()
 {
    if [ "$HOSTOS" == "Linux" ]
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 11/18] tests/vm/openbsd: Install GNU sed from the ports
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 12/18] test-iov: Disable iov/io test on OpenBSD Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Various iotests scripts (run via 'make check-block') require a
GNU sed to use the (non-POSIX) GNU extensions.
Install GNU sed from the ports to be able to run those tests.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/vm/openbsd | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index e9c2a3f2c8..7c456e9706 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -47,6 +47,8 @@ class OpenBSDVM(basevm.BaseVM):
         self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
         sys.stderr.write("Installing bash...\n")
         self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add bash")
+        sys.stderr.write("Installing GNU sed...\n")
+        self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add gsed")
         self.ssh_root("shutdown -p now")
         self.wait()
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 12/18] test-iov: Disable iov/io test on OpenBSD
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 11/18] tests/vm/openbsd: Install GNU sed from the ports Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

The iov/io test hangs on OpenBSD. Disable it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/test-iov.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/test-iov.c b/tests/test-iov.c
index 458ca25099..9288b7b862 100644
--- a/tests/test-iov.c
+++ b/tests/test-iov.c
@@ -147,9 +147,11 @@ static void test_to_from_buf(void)
 
 static void test_io(void)
 {
-#ifndef _WIN32
-/* socketpair(PF_UNIX) which does not exist on windows */
-
+#if defined(_WIN32)
+    /* socketpair(PF_UNIX) which does not exist on windows */
+#elif defined(__OpenBSD__)
+    /* FIXME: this test hangs on OpenBSD */
+#else
     int sv[2];
     int r;
     unsigned i, j, k, s, t;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 12/18] test-iov: Disable iov/io test on OpenBSD Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-02-05 13:22   ` Peter Maydell
  2019-02-05 17:40   ` Michael S. Tsirkin
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 14/18] tests/vm: Run tests on OpenBSD Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  17 siblings, 2 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Previous to OpenBSD 6.3 [1], fcntl(F_SETFL) is not permitted on
memory devices.
Trying this call sets errno to ENODEV ("not a memory device"):

  19 ENODEV Operation not supported by device.
    An attempt was made to apply an inappropriate function to a device,
    for example, trying to read a write-only device such as a printer.

Do not assert fcntl failures in this specific case (errno set to ENODEV)
on OpenBSD. This fixes:

  $ lm32-softmmu/qemu-system-lm32
  assertion "f != -1" failed: file "util/oslib-posix.c", line 247, function "qemu_set_nonblock"
  Abort trap (core dumped)

[1] The fix seems https://github.com/openbsd/src/commit/c2a35b387f9d3c
  "fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, so
  the memory devices (/dev/null, /dev/zero, etc) need to permit them."

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 util/oslib-posix.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 4ce1ba9ca4..2f0f27e6d9 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -244,7 +244,17 @@ void qemu_set_nonblock(int fd)
     f = fcntl(fd, F_GETFL);
     assert(f != -1);
     f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
+#ifdef __OpenBSD__
+    if (f == -1) {
+        /*
+         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
+         * memory devices and sets errno to ENODEV.
+         */
+        assert(errno == ENODEV);
+    }
+#else
     assert(f != -1);
+#endif
 }
 
 int socket_set_fast_reuse(int fd)
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [PATCH v2 14/18] tests/vm: Run tests on OpenBSD
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Philippe Mathieu-Daudé
@ 2019-01-29 17:53 ` Philippe Mathieu-Daudé
  2019-02-05 13:23   ` Peter Maydell
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 15/18] iotests: Let verify_platform() check for unsupported platforms Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:53 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Now than failing tests are commented out, let's reenable the testing
of this OS.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/vm/openbsd | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index 7c456e9706..ff6d5fa549 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -25,9 +25,7 @@ class OpenBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/rsd1c;
         ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts};
-        gmake --output-sync -j{jobs} {verbose};
-        # XXX: "gmake check" seems to always hang or fail
-        #gmake --output-sync -j{jobs} check {verbose};
+        gmake --output-sync -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 15/18] iotests: Let verify_platform() check for unsupported platforms
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (13 preceding siblings ...)
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 14/18] tests/vm: Run tests on OpenBSD Philippe Mathieu-Daudé
@ 2019-01-29 17:54 ` Philippe Mathieu-Daudé
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 16/18] iotests: Disable 208 on OpenBSD Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:54 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

Instead of checking for a supported platforms, it might be useful
to test for the opposite.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qemu-iotests/iotests.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index cbedfaf1df..9b6387b0a3 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -696,9 +696,11 @@ def verify_protocol(supported=[], unsupported=[]):
     if not_sup or (imgproto in unsupported):
         notrun('not suitable for this protocol: %s' % imgproto)
 
-def verify_platform(supported_oses=['linux']):
+def verify_platform(supported_oses=['linux'], unsupported_oses=[]):
     if True not in [sys.platform.startswith(x) for x in supported_oses]:
         notrun('not suitable for this OS: %s' % sys.platform)
+    if True in [sys.platform.startswith(x) for x in unsupported_oses]:
+        notrun('not suitable for this OS: %s' % sys.platform)
 
 def verify_cache_mode(supported_cache_modes=[]):
     if supported_cache_modes and (cachemode not in supported_cache_modes):
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 16/18] iotests: Disable 208 on OpenBSD
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (14 preceding siblings ...)
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 15/18] iotests: Let verify_platform() check for unsupported platforms Philippe Mathieu-Daudé
@ 2019-01-29 17:54 ` Philippe Mathieu-Daudé
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 17/18] iotests: Disable 209 " Philippe Mathieu-Daudé
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 18/18] iotests: Disable 236 and 238 " Philippe Mathieu-Daudé
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:54 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

This test explodes on OpenBSD:

  $ gmake check-block
  [...]
  208                [14:46:03] [14:46:03] [failed, exit status 1] - output mismatch (see 208.out.bad)
  --- /tmp/qemu-test.9cUFe0/tests/qemu-iotests/208.out    Tue Jan 29 13:33:43 2019
  +++ /tmp/qemu-test.9cUFe0/tests/qemu-iotests/208.out.bad        Tue Jan 29 14:46:03 2019
  @@ -1,9 +1,23 @@
  +WARNING:qemu:qemu received signal 9: /tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64 -chardev socket,id=mon,path=/tmp/qemu-iotests-quick-38268/tmpjdovgo/qemu-66480-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/tmp/qemu-iotests-quick-38268/qemu-66480-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=none,id=drive0,file=/tmp/qemu-iotests-quick-38268/66480-disk.img,format=qcow2,cache=writeback,node-name=drive0-node
  +WARNING:qemu:qemu received signal 9: /tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64 -chardev socket,id=mon,path=/tmp/qemu-iotests-quick-38268/tmpjdovgo/qemu-66480-monitor.sock -mon chardev=mon,mode=control -display none -vga none -qtest unix:path=/tmp/qemu-iotests-quick-38268/qemu-66480-qtest.sock -machine accel=qtest -nodefaults -machine accel=qtest -drive if=none,id=drive0,file=/tmp/qemu-iotests-quick-38268/66480-disk.img,format=qcow2,cache=writeback,node-name=drive0-node
   Launching VM...
  -Starting NBD server...
  -{"return": {}}
  -Adding NBD export...
  -{"return": {}}
  -Creating external snapshot...
  -{"return": {}}
  -Stopping NBD server...
  -{"return": {}}
  +Traceback (most recent call last):
  +  File "208", line 36, in <module>
  +    (vm.add_drive(disk_img_path, 'node-name=drive0-node', interface='none')
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qemu.py", line 295, in launch
  +    self._launch()
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qemu.py", line 321, in _launch
  +    self._post_launch()
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qtest.py", line 100, in _post_launch
  +    super(QEMUQtestMachine, self)._post_launch()
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qemu.py", line 266, in _post_launch
  +    self._qmp.accept()
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 157, in accept
  +    return self.__negotiate_capabilities()
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 71, in __negotiate_capabilities
  +    greeting = self.__json_read()
  +  File "/tmp/qemu-test.9cUFe0/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 82, in __json_read
  +    data = self.__sockfile.readline()
  +  File "/usr/local/lib/python2.7/socket.py", line 451, in readline
  +    data = self._sock.recv(self._rbufsize)
  +socket.error: [Errno 35] Resource temporarily unavailable

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qemu-iotests/208 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qemu-iotests/208 b/tests/qemu-iotests/208
index 1e202388dc..2a13259fe4 100755
--- a/tests/qemu-iotests/208
+++ b/tests/qemu-iotests/208
@@ -23,6 +23,7 @@
 import iotests
 
 iotests.verify_image_format(supported_fmts=['generic'])
+iotests.verify_platform(unsupported_oses=['openbsd']) # FIXME
 
 with iotests.FilePath('disk.img') as disk_img_path, \
      iotests.FilePath('disk-snapshot.img') as disk_snapshot_img_path, \
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 17/18] iotests: Disable 209 on OpenBSD
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (15 preceding siblings ...)
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 16/18] iotests: Disable 208 on OpenBSD Philippe Mathieu-Daudé
@ 2019-01-29 17:54 ` Philippe Mathieu-Daudé
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 18/18] iotests: Disable 236 and 238 " Philippe Mathieu-Daudé
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:54 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

This test simply hangs with no information on OpenBSD.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qemu-iotests/209 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qemu-iotests/209 b/tests/qemu-iotests/209
index 259e991ec6..7eb41e4363 100755
--- a/tests/qemu-iotests/209
+++ b/tests/qemu-iotests/209
@@ -23,6 +23,7 @@ from iotests import qemu_img_create, qemu_io, qemu_img_verbose, qemu_nbd, \
                     file_path
 
 iotests.verify_image_format(supported_fmts=['qcow2'])
+iotests.verify_platform(unsupported_oses=['openbsd']) # FIXME
 
 disk, nbd_sock = file_path('disk', 'nbd-sock')
 nbd_uri = 'nbd+unix:///exp?socket=' + nbd_sock
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [Qemu-devel] [RFC PATCH v2 18/18] iotests: Disable 236 and 238 on OpenBSD
  2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
                   ` (16 preceding siblings ...)
  2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 17/18] iotests: Disable 209 " Philippe Mathieu-Daudé
@ 2019-01-29 17:54 ` Philippe Mathieu-Daudé
  17 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 17:54 UTC (permalink / raw)
  To: Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng,
	Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Kamil Rytarowski

These tests explode on OpenBSD:

  $ gmake check-block
  [...]
  238                [17:16:09] [17:16:09] [failed, exit status 1] - output mismatch (see 238.out.bad)
  --- /tmp/qemu-test.VKNS07/tests/qemu-iotests/238.out    Tue Jan 29 17:09:03 2019
  +++ /tmp/qemu-test.VKNS07/tests/qemu-iotests/238.out.bad        Tue Jan 29 17:16:09 2019
  @@ -1,6 +1,14 @@
  -{"return": {}}
  -{"return": {}}
  -{"return": {}}
  -{"return": {}}
  -{"return": {}}
  -{"return": {}}
  +Traceback (most recent call last):
  +  File "238", line 37, in <module>
  +    vm.launch()
  +  File "/tmp/qemu-test.VKNS07/tests/qemu-iotests/../../scripts/qemu.py", line 295, in launch
  +    self._launch()
  +  File "/tmp/qemu-test.VKNS07/tests/qemu-iotests/../../scripts/qemu.py", line 321, in _launch
  +    self._post_launch()
  +  File "/tmp/qemu-test.VKNS07/tests/qemu-iotests/../../scripts/qemu.py", line 266, in _post_launch
  +    self._qmp.accept()
  +  File "/tmp/qemu-test.VKNS07/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 157, in accept
  +    return self.__negotiate_capabilities()
  +  File "/tmp/qemu-test.VKNS07/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 73, in __negotiate_capabilities
  +    raise QMPConnectError
  +qmp.qmp.QMPConnectError

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
This might be due to these tests requiring KVM?...
Maybe we need a has_kvm argument to iotests.verify_platform()?
---
 tests/qemu-iotests/236 | 1 +
 tests/qemu-iotests/238 | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236
index 79a6381f8e..b98df35ca4 100755
--- a/tests/qemu-iotests/236
+++ b/tests/qemu-iotests/236
@@ -23,6 +23,7 @@ import iotests
 from iotests import log
 
 iotests.verify_image_format(supported_fmts=['generic'])
+iotests.verify_platform(unsupported_oses=['openbsd']) # FIXME
 size = 64 * 1024 * 1024
 granularity = 64 * 1024
 
diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
index f81ee1112f..c62ff9a6dc 100755
--- a/tests/qemu-iotests/238
+++ b/tests/qemu-iotests/238
@@ -23,6 +23,8 @@ import os
 import iotests
 from iotests import log
 
+iotests.verify_platform(unsupported_oses=['openbsd']) # FIXME
+
 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts'))
 
 from qemu import QEMUMachine
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD Philippe Mathieu-Daudé
@ 2019-01-29 18:02   ` Philippe Mathieu-Daudé
  2019-01-29 21:54   ` Eric Blake
  1 sibling, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-29 18:02 UTC (permalink / raw)
  To: qemu-devel, Thomas Huth
  Cc: Brad Smith, Stefan Hajnoczi, qemu-block, Igor Mammedov,
	Paolo Bonzini, Eric Blake, Peter Maydell, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On 1/29/19 6:53 PM, Philippe Mathieu-Daudé wrote:
> Since OpenBSD 6.0 [1], W^X is enforced by default [2].
> TCG requires WX access. Disable W^X if it is available.
> This fixes:
> 
>   # lm32-softmmu/qemu-system-lm32
>   Could not allocate dynamic translator buffer
> 
>   # sysctl kern.wxabort=1
>   kern.wxabort: 0 -> 1
>   # lm32-softmmu/qemu-system-lm32
>   mmap: Not supported
>   Abort trap (core dumped)
>   # gdb -q lm32-softmmu/qemu-system-lm32 qemu-system-lm32.core
>   (gdb) bt
>   #0  0x000017e3c156c50a in _thread_sys___syscall () at {standard input}:5
>   #1  0x000017e3c15e5d7a in *_libc_mmap (addr=Variable "addr" is not available.) at /usr/src/lib/libc/sys/mmap.c:47
>   #2  0x000017e17d9abc8b in alloc_code_gen_buffer () at /usr/src/qemu/accel/tcg/translate-all.c:1064
>   #3  0x000017e17d9abd04 in code_gen_alloc (tb_size=0) at /usr/src/qemu/accel/tcg/translate-all.c:1112
>   #4  0x000017e17d9abe81 in tcg_exec_init (tb_size=0) at /usr/src/qemu/accel/tcg/translate-all.c:1149
>   #5  0x000017e17d9897e9 in tcg_init (ms=0x17e45e456800) at /usr/src/qemu/accel/tcg/tcg-all.c:66
>   #6  0x000017e17d9891b8 in accel_init_machine (acc=0x17e3c3f50800, ms=0x17e45e456800) at /usr/src/qemu/accel/accel.c:63
>   #7  0x000017e17d989312 in configure_accelerator (ms=0x17e45e456800, progname=0x7f7fffff07b0 "lm32-softmmu/qemu-system-lm32") at /usr/src/qemu/accel/accel.c:111
>   #8  0x000017e17d9d8616 in main (argc=1, argv=0x7f7fffff06b8, envp=0x7f7fffff06c8) at vl.c:4325
> 
> [1] https://www.openbsd.org/faq/upgrade60.html
> [2] https://undeadly.org/cgi?action=article&sid=20160527203200
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  configure | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/configure b/configure
> index b18281c61f..799ec2013b 100755
> --- a/configure
> +++ b/configure
> @@ -5795,6 +5795,17 @@ if test "$mingw32" = "yes" ; then
>      done
>  fi
>  
> +# Disable OpenBSD W^X if available
> +if test "$tcg" = "yes" -a "$targetos" = "OpenBSD"; then
> +    cat > $TMPC <<EOF
> +    int main(void) { return 0; }
> +EOF
> +    wx_ldflags="-Wl,-z,wxneeded"

I told Thomas I'd remove the wx_ldflags but forgot.
Anyway this doesn't change the patch correctness.

> +    if compile_prog "" "$wx_ldflags"; then
> +        QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags"
> +    fi
> +fi
> +
>  qemu_confdir=$sysconfdir$confsuffix
>  qemu_moddir=$libdir$confsuffix
>  qemu_datadir=$datadir$confsuffix
> 

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 07/18] tests/multiboot: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 07/18] tests/multiboot: " Philippe Mathieu-Daudé
@ 2019-01-29 18:10   ` Kamil Rytarowski
  2019-01-29 22:16   ` Eric Blake
  1 sibling, 0 replies; 55+ messages in thread
From: Kamil Rytarowski @ 2019-01-29 18:10 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

On 29.01.2019 18:53, Philippe Mathieu-Daudé wrote:
> Bash is not always installed as /bin/bash. In particular on OpenBSD,
> the package installs it in /usr/local/bin.
> Use the 'env' shebang to search bash in the $PATH.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Kamil Rytarowski <n54@gmx.com>

> ---
>  tests/multiboot/run_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/multiboot/run_test.sh b/tests/multiboot/run_test.sh
> index 6c33003e71..a88e423992 100755
> --- a/tests/multiboot/run_test.sh
> +++ b/tests/multiboot/run_test.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#! /usr/bin/env bash
>  
>  # Copyright (c) 2013 Kevin Wolf <kwolf@redhat.com>
>  #
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 850 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: " Philippe Mathieu-Daudé
@ 2019-01-29 18:12   ` Kamil Rytarowski
  2019-01-30  8:30   ` Igor Mammedov
  2019-02-20 20:01   ` Michael S. Tsirkin
  2 siblings, 0 replies; 55+ messages in thread
From: Kamil Rytarowski @ 2019-01-29 18:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Peter Maydell, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

On 29.01.2019 18:53, Philippe Mathieu-Daudé wrote:
> Bash is not always installed as /bin/bash. In particular on OpenBSD,
> the package installs it in /usr/local/bin.
> Use the 'env' shebang to search bash in the $PATH.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Kamil Rytarowski <n54@gmx.com>

> ---
>  tests/data/acpi/rebuild-expected-aml.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh
> index bf9ba242ad..ff77a751c8 100755
> --- a/tests/data/acpi/rebuild-expected-aml.sh
> +++ b/tests/data/acpi/rebuild-expected-aml.sh
> @@ -1,4 +1,4 @@
> -#! /bin/bash
> +#! /usr/bin/env bash
>  
>  #
>  # Rebuild expected AML files for acpi unit-test
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 850 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD Philippe Mathieu-Daudé
  2019-01-29 18:02   ` Philippe Mathieu-Daudé
@ 2019-01-29 21:54   ` Eric Blake
  2019-01-30  7:17     ` Thomas Huth
  1 sibling, 1 reply; 55+ messages in thread
From: Eric Blake @ 2019-01-29 21:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
> Since OpenBSD 6.0 [1], W^X is enforced by default [2].
> TCG requires WX access. Disable W^X if it is available.
> This fixes:
> 

>  configure | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/configure b/configure
> index b18281c61f..799ec2013b 100755
> --- a/configure
> +++ b/configure
> @@ -5795,6 +5795,17 @@ if test "$mingw32" = "yes" ; then
>      done
>  fi
>  
> +# Disable OpenBSD W^X if available
> +if test "$tcg" = "yes" -a "$targetos" = "OpenBSD"; then

test ... -a ...

is not portable (POSIX permits non-XSI systems to omit support for these
operators, but even where they are supported, there are some inherently
ambiguous inputs where you CANNOT predict whether the shell will parse
-a as a binary operator or as an argument to some other operator).
Instead, you should ALWAYS break dual tests into:

test ... && test ...

instead.  (Same for '-o' vs '|| test')

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 03/18] tests/vm/openbsd: Disable the W^X protection on the build partition
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 03/18] tests/vm/openbsd: Disable the W^X protection on the build partition Philippe Mathieu-Daudé
@ 2019-01-29 21:58   ` Eric Blake
  0 siblings, 0 replies; 55+ messages in thread
From: Eric Blake @ 2019-01-29 21:58 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]

On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
> Since OpenBSD 6.0 [1], W^X is enforced by default [2].
> TCG requires WX access, and QEMU binaries are now built with the WX
> flag to disable the protection. However, WX allowed binaries need
> to be run on a WX allowed partition.
> To be able to run the QEMU test suite on the VM, mount the partition
> where QEMU is built/tested as WX allowed.
> 
> [1] https://www.openbsd.org/faq/upgrade60.html
> [2] https://undeadly.org/cgi?action=article&sid=20160527203200
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/vm/openbsd | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
> index 2105c01a26..6263c8956b 100755
> --- a/tests/vm/openbsd
> +++ b/tests/vm/openbsd
> @@ -41,6 +41,12 @@ class OpenBSDVM(basevm.BaseVM):
>          if os.path.exists(img):
>              os.remove(img)
>          os.rename(img_tmp, img)
> +        self.boot(img)
> +        self.wait_ssh()
> +        sys.stderr.write("Disabling W^X on the build partition...\n")
> +        self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")

sed -i is non-POSIX, but it looks like it works in OpenBSD.

> +        self.ssh_root("shutdown -p now")
> +        self.wait()
>  
>  if __name__ == "__main__":
>      sys.exit(basevm.main(OpenBSDVM))
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 05/18] qemu-iotests: Add dependency to qemu-nbd tool
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 05/18] qemu-iotests: Add dependency to qemu-nbd tool Philippe Mathieu-Daudé
@ 2019-01-29 22:03   ` Eric Blake
  0 siblings, 0 replies; 55+ messages in thread
From: Eric Blake @ 2019-01-29 22:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
> Since a9660664fde, some iotests use qemu-nbd.
> Add a dependency to build it before using it.
> This fixes:
> 
>   $ gmake check-block
>           CHK version_gen.h
>     GEN     qemu-img-cmds.h
>     CC      qemu-img.o
>     LINK    qemu-img
>     CC      qemu-io.o
>     LINK    qemu-io
>   tests/qemu-iotests-quick.sh
>   tests/qemu-iotests-quick.sh[6]: ./check: No such file or directory
>   gmake: *** [/tmp/qemu-test.9GLXBk/tests/Makefile.include:1059: check-tests/qemu-iotests-quick.sh] Error 1
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---

Reviewed-by: Eric Blake <eblake@redhat.com>


> +++ b/tests/Makefile.include
> @@ -1055,7 +1055,7 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES)
>  QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
>  
>  .PHONY: check-tests/qemu-iotests-quick.sh
> -check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
> +check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)

Worth using backslash-newline to wrap this into a series of shorter lines?


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH Philippe Mathieu-Daudé
@ 2019-01-29 22:15   ` Eric Blake
  2019-01-30 10:11     ` Thomas Huth
  0 siblings, 1 reply; 55+ messages in thread
From: Eric Blake @ 2019-01-29 22:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 2361 bytes --]

On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
> Bash is not always installed as /bin/bash. In particular on OpenBSD,
> the package installs it in /usr/local/bin.
> Use the 'env' shebang to search bash in the $PATH.
> 
> Patch created mechanically by running:
> 
>   $ git grep -lE '#! ?/bin/bash' -- tests/qemu-iotests | \
>     while read f; do \
>       sed -i 's_#!.\?/bin/bash_#! /usr/bin/env bash_' $f; \

I prefer | over _ when writing a sed expression around something with
embedded / (why? Because | has to be quoted in shell, but _ does not,
and it makes it more likely that I'll notice if I botched quoting or the
intended sed command).  But for a commit message, pasting what you
actually ran is fine.

Why a space between #! and /usr/bin/env? That's not our prevailing style:

$ git grep '^#! /' | wc
     13      30     541
$ git grep '^#!/' | wc
    337     448   13442

Mishandles instances of:

#!/bin/bash -x

or any other case where there is something after /bin/bash (since some
platforms permit at most 1 argument to the interpreter, and your
conversion would be trying to pass 2 arguments as 1).  BSD env (and more
recently GNU Coreutils env) added:

#!/usr/bin/env -S /bin/bash -x

to work around platforms with odd shebang limitations (the lone argument
"-S /bin/bash -x" is sensibly re-split by env before exec'ing bash with
an argument of -x) - but that's not portable yet.  Thankfully, it looks
like none of your conversions encountered that problem; but I might used
an explict end-of-line anchor to make sure, as in:

sed -i 's|^#!.\?/bin/bash$|#!/usr/bin/env bash|' $f

>     done
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Can 'env' be located elsewhere than /usr/bin/env?

Possibly, but #! requires absolute paths on some platforms, so you have
a chicken-and-egg problem if it is not, so in practice /usr/bin/env is
reliable; and we're already using it elsewhere, so any platform where it
does not exist will have a lot more than just this patch to fix up.

Comments are tied to the commit message, but the mechanical conversion
itself looks sound, therefore:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 07/18] tests/multiboot: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 07/18] tests/multiboot: " Philippe Mathieu-Daudé
  2019-01-29 18:10   ` Kamil Rytarowski
@ 2019-01-29 22:16   ` Eric Blake
  1 sibling, 0 replies; 55+ messages in thread
From: Eric Blake @ 2019-01-29 22:16 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
> Bash is not always installed as /bin/bash. In particular on OpenBSD,
> the package installs it in /usr/local/bin.
> Use the 'env' shebang to search bash in the $PATH.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/multiboot/run_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/multiboot/run_test.sh b/tests/multiboot/run_test.sh
> index 6c33003e71..a88e423992 100755
> --- a/tests/multiboot/run_test.sh
> +++ b/tests/multiboot/run_test.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#! /usr/bin/env bash

Again, why the space after #!? Having or omitting it makes no
difference, but the prevailing style is to omit it.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used Philippe Mathieu-Daudé
@ 2019-01-29 22:21   ` Eric Blake
  2019-02-04 23:55     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 55+ messages in thread
From: Eric Blake @ 2019-01-29 22:21 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]

On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
> Various sed regexp from common.filter use sed GNU extensions.
> Instead of spending time to write these regex to be POSIX compliant,
> verify the GNU sed is available and use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> I think the test isn't well placed in common.filter and should be in
> common.rc, but couldn't get that working.
> ---

> +++ b/tests/qemu-iotests/common.filter
> @@ -23,37 +23,37 @@
>  #
>  _filter_date()
>  {
> -    sed \
> +    ${SED} \

I might have written $SED instead of ${SED}, but that's merely
aesthetics and not a correctness issue.


> +++ b/tests/qemu-iotests/common.rc
> @@ -17,6 +17,18 @@
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  #
>  

If SED is inherited in the environment prior to this point,...

> +for sed in sed gsed; do
> +    (command $sed --version | grep 'GNU sed') > /dev/null 2>&1

Why do you need command here? (It doesn't hurt, but I also don't see how
it helps).

> +    if [ "$?" -eq 0 ]; then
> +        SED=$sed
> +        break
> +    fi
> +done

...but neither sed nor gsed are GNU sed,

> +if [ -z "$SED" ]; then
> +    echo "$0: GNU sed not found"
> +    exit 1
> +fi

...then you fail to diagnose that. Fix it by adding SED= prior to the loop.


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD
  2019-01-29 21:54   ` Eric Blake
@ 2019-01-30  7:17     ` Thomas Huth
  2019-02-05  3:04       ` Eric Blake
  0 siblings, 1 reply; 55+ messages in thread
From: Thomas Huth @ 2019-01-30  7:17 UTC (permalink / raw)
  To: Eric Blake, Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Max Reitz, Kamil Rytarowski, Stefan Hajnoczi,
	Paolo Bonzini, Igor Mammedov, Fam Zheng, Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

On 2019-01-29 22:54, Eric Blake wrote:
> On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
>> Since OpenBSD 6.0 [1], W^X is enforced by default [2].
>> TCG requires WX access. Disable W^X if it is available.
>> This fixes:
>>
> 
>>  configure | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/configure b/configure
>> index b18281c61f..799ec2013b 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5795,6 +5795,17 @@ if test "$mingw32" = "yes" ; then
>>      done
>>  fi
>>  
>> +# Disable OpenBSD W^X if available
>> +if test "$tcg" = "yes" -a "$targetos" = "OpenBSD"; then
> 
> test ... -a ...
> 
> is not portable (POSIX permits non-XSI systems to omit support for these
> operators, but even where they are supported, there are some inherently
> ambiguous inputs where you CANNOT predict whether the shell will parse
> -a as a binary operator or as an argument to some other operator).
> Instead, you should ALWAYS break dual tests into:
> 
> test ... && test ...
> 
> instead.  (Same for '-o' vs '|| test')

$ grep 'test.* -a ' configure | wc -l
21
$ grep 'test.* && ' configure | wc -l
16

Looks like we do not really care?

 Thomas


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: " Philippe Mathieu-Daudé
  2019-01-29 18:12   ` Kamil Rytarowski
@ 2019-01-30  8:30   ` Igor Mammedov
  2019-02-20 20:01   ` Michael S. Tsirkin
  2 siblings, 0 replies; 55+ messages in thread
From: Igor Mammedov @ 2019-01-30  8:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, qemu-devel, Stefan Hajnoczi, qemu-block,
	Paolo Bonzini, Eric Blake, Peter Maydell, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On Tue, 29 Jan 2019 18:53:53 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Bash is not always installed as /bin/bash. In particular on OpenBSD,
> the package installs it in /usr/local/bin.
> Use the 'env' shebang to search bash in the $PATH.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/data/acpi/rebuild-expected-aml.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh
> index bf9ba242ad..ff77a751c8 100755
> --- a/tests/data/acpi/rebuild-expected-aml.sh
> +++ b/tests/data/acpi/rebuild-expected-aml.sh
> @@ -1,4 +1,4 @@
> -#! /bin/bash
> +#! /usr/bin/env bash
>  
>  #
>  # Rebuild expected AML files for acpi unit-test

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH
  2019-01-29 22:15   ` Eric Blake
@ 2019-01-30 10:11     ` Thomas Huth
  0 siblings, 0 replies; 55+ messages in thread
From: Thomas Huth @ 2019-01-30 10:11 UTC (permalink / raw)
  To: Eric Blake, Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Max Reitz, Kamil Rytarowski, Stefan Hajnoczi,
	Paolo Bonzini, Igor Mammedov, Fam Zheng, Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

On 2019-01-29 23:15, Eric Blake wrote:
[...]
> Why a space between #! and /usr/bin/env? That's not our prevailing style
There is an urban legend that this was required on certain old Unix
systems, but as far as I know, it's only wrong information:

 https://www.in-ulm.de/~mascheck/various/shebang/#blankrequired

Anyway, the blank is certainly not required anymore in the 21st century,
so I'd also suggest to remove it in these patches here.

 Thomas


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used
  2019-01-29 22:21   ` Eric Blake
@ 2019-02-04 23:55     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-04 23:55 UTC (permalink / raw)
  To: Eric Blake, Brad Smith, qemu-devel
  Cc: Stefan Hajnoczi, qemu-block, Igor Mammedov, Paolo Bonzini,
	Peter Maydell, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

On 1/29/19 11:21 PM, Eric Blake wrote:
> On 1/29/19 11:53 AM, Philippe Mathieu-Daudé wrote:
>> Various sed regexp from common.filter use sed GNU extensions.
>> Instead of spending time to write these regex to be POSIX compliant,
>> verify the GNU sed is available and use it.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> I think the test isn't well placed in common.filter and should be in
>> common.rc, but couldn't get that working.
>> ---
> 
>> +++ b/tests/qemu-iotests/common.filter
>> @@ -23,37 +23,37 @@
>>  #
>>  _filter_date()
>>  {
>> -    sed \
>> +    ${SED} \
> 
> I might have written $SED instead of ${SED}, but that's merely
> aesthetics and not a correctness issue.
> 
> 
>> +++ b/tests/qemu-iotests/common.rc
>> @@ -17,6 +17,18 @@
>>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>>  #
>>  
> 
> If SED is inherited in the environment prior to this point,...
> 
>> +for sed in sed gsed; do
>> +    (command $sed --version | grep 'GNU sed') > /dev/null 2>&1
> 
> Why do you need command here? (It doesn't hurt, but I also don't see how
> it helps).

I copy/pasted the 'dd' use in the same file :/

> 
>> +    if [ "$?" -eq 0 ]; then
>> +        SED=$sed
>> +        break
>> +    fi
>> +done
> 
> ...but neither sed nor gsed are GNU sed,
> 
>> +if [ -z "$SED" ]; then
>> +    echo "$0: GNU sed not found"
>> +    exit 1
>> +fi
> 
> ...then you fail to diagnose that. Fix it by adding SED= prior to the loop.

Good point, thanks!

Regards,

Phil.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD
  2019-01-30  7:17     ` Thomas Huth
@ 2019-02-05  3:04       ` Eric Blake
  0 siblings, 0 replies; 55+ messages in thread
From: Eric Blake @ 2019-02-05  3:04 UTC (permalink / raw)
  To: Thomas Huth, Philippe Mathieu-Daudé, Brad Smith, qemu-devel
  Cc: Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Max Reitz, Kamil Rytarowski, Stefan Hajnoczi,
	Paolo Bonzini, Igor Mammedov, Fam Zheng, Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

On 1/30/19 1:17 AM, Thomas Huth wrote:

>> test ... -a ...
>>
>> is not portable (POSIX permits non-XSI systems to omit support for these
>> operators, but even where they are supported, there are some inherently
>> ambiguous inputs where you CANNOT predict whether the shell will parse
>> -a as a binary operator or as an argument to some other operator).
>> Instead, you should ALWAYS break dual tests into:
>>
>> test ... && test ...
>>
>> instead.  (Same for '-o' vs '|| test')
> 
> $ grep 'test.* -a ' configure | wc -l
> 21
> $ grep 'test.* && ' configure | wc -l
> 16
> 
> Looks like we do not really care?

Well, I care. Enough to propose a patch :)

https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg00960.html

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images Philippe Mathieu-Daudé
@ 2019-02-05 13:17   ` Peter Maydell
  2019-02-07 22:08   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 55+ messages in thread
From: Peter Maydell @ 2019-02-05 13:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, QEMU Developers, Stefan Hajnoczi, Qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On Tue, 29 Jan 2019 at 17:54, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Depending of the host hardware, copying and extracting VM images can
> take up to few minutes. Add verbosity to avoid the user to worry about
> VMs hanging.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/vm/centos  | 3 ++-
>  tests/vm/freebsd | 3 ++-
>  tests/vm/netbsd  | 3 ++-
>  tests/vm/openbsd | 3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports Philippe Mathieu-Daudé
@ 2019-02-05 13:20   ` Peter Maydell
  2019-02-05 13:42     ` Philippe Mathieu-Daudé
  2019-02-05 16:09   ` Alex Bennée
  1 sibling, 1 reply; 55+ messages in thread
From: Peter Maydell @ 2019-02-05 13:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, QEMU Developers, Stefan Hajnoczi, Qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On Tue, 29 Jan 2019 at 17:57, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Various iotests scripts (run via 'make check-block')  use bash
> specific extentions.  OpenBSD comes with the Korn shell as default.
> Install bash to be able to run those tests.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/vm/openbsd | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
> index 6263c8956b..e9c2a3f2c8 100755
> --- a/tests/vm/openbsd
> +++ b/tests/vm/openbsd
> @@ -45,6 +45,8 @@ class OpenBSDVM(basevm.BaseVM):
>          self.wait_ssh()
>          sys.stderr.write("Disabling W^X on the build partition...\n")
>          self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
> +        sys.stderr.write("Installing bash...\n")
> +        self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add bash")
>          self.ssh_root("shutdown -p now")
>          self.wait()
>

Wouldn't it make more sense to just update the image to include
the necessary package, the same way we do with all QEMU's
other build dependencies ?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Philippe Mathieu-Daudé
@ 2019-02-05 13:22   ` Peter Maydell
  2019-02-05 13:43     ` Philippe Mathieu-Daudé
  2019-02-05 17:40   ` Michael S. Tsirkin
  1 sibling, 1 reply; 55+ messages in thread
From: Peter Maydell @ 2019-02-05 13:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, QEMU Developers, Stefan Hajnoczi, Qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On Tue, 29 Jan 2019 at 17:59, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Previous to OpenBSD 6.3 [1], fcntl(F_SETFL) is not permitted on
> memory devices.
> Trying this call sets errno to ENODEV ("not a memory device"):
>
>   19 ENODEV Operation not supported by device.
>     An attempt was made to apply an inappropriate function to a device,
>     for example, trying to read a write-only device such as a printer.
>
> Do not assert fcntl failures in this specific case (errno set to ENODEV)
> on OpenBSD. This fixes:
>
>   $ lm32-softmmu/qemu-system-lm32
>   assertion "f != -1" failed: file "util/oslib-posix.c", line 247, function "qemu_set_nonblock"
>   Abort trap (core dumped)
>
> [1] The fix seems https://github.com/openbsd/src/commit/c2a35b387f9d3c
>   "fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, so
>   the memory devices (/dev/null, /dev/zero, etc) need to permit them."
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  util/oslib-posix.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4ce1ba9ca4..2f0f27e6d9 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -244,7 +244,17 @@ void qemu_set_nonblock(int fd)
>      f = fcntl(fd, F_GETFL);
>      assert(f != -1);
>      f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
> +#ifdef __OpenBSD__
> +    if (f == -1) {
> +        /*
> +         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
> +         * memory devices and sets errno to ENODEV.
> +         */
> +        assert(errno == ENODEV);
> +    }
> +#else
>      assert(f != -1);
> +#endif

You might also add "It's OK if we fail to set O_NONBLOCK on devices
like /dev/null, because they will never block anyway."

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 14/18] tests/vm: Run tests on OpenBSD
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 14/18] tests/vm: Run tests on OpenBSD Philippe Mathieu-Daudé
@ 2019-02-05 13:23   ` Peter Maydell
  0 siblings, 0 replies; 55+ messages in thread
From: Peter Maydell @ 2019-02-05 13:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, QEMU Developers, Stefan Hajnoczi, Qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On Tue, 29 Jan 2019 at 17:59, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Now than failing tests are commented out, let's reenable the testing
> of this OS.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/vm/openbsd | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
> index 7c456e9706..ff6d5fa549 100755
> --- a/tests/vm/openbsd
> +++ b/tests/vm/openbsd
> @@ -25,9 +25,7 @@ class OpenBSDVM(basevm.BaseVM):
>          cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
>          tar -xf /dev/rsd1c;
>          ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts};
> -        gmake --output-sync -j{jobs} {verbose};
> -        # XXX: "gmake check" seems to always hang or fail
> -        #gmake --output-sync -j{jobs} check {verbose};
> +        gmake --output-sync -j{jobs} check {verbose};
>      """
>
>      def build_image(self, img):
> --
> 2.20.1

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 13:20   ` Peter Maydell
@ 2019-02-05 13:42     ` Philippe Mathieu-Daudé
  2019-02-05 13:57       ` Brad Smith
  0 siblings, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-05 13:42 UTC (permalink / raw)
  To: Peter Maydell, Gerd Hoffmann, Daniel P. Berrange
  Cc: Brad Smith, QEMU Developers, Stefan Hajnoczi, Qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

Hi Peter,

On 2/5/19 2:20 PM, Peter Maydell wrote:
> On Tue, 29 Jan 2019 at 17:57, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Various iotests scripts (run via 'make check-block')  use bash
>> specific extentions.  OpenBSD comes with the Korn shell as default.
>> Install bash to be able to run those tests.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  tests/vm/openbsd | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
>> index 6263c8956b..e9c2a3f2c8 100755
>> --- a/tests/vm/openbsd
>> +++ b/tests/vm/openbsd
>> @@ -45,6 +45,8 @@ class OpenBSDVM(basevm.BaseVM):
>>          self.wait_ssh()
>>          sys.stderr.write("Disabling W^X on the build partition...\n")
>>          self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
>> +        sys.stderr.write("Installing bash...\n")
>> +        self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add bash")
>>          self.ssh_root("shutdown -p now")
>>          self.wait()
>>
> 
> Wouldn't it make more sense to just update the image to include
> the necessary package, the same way we do with all QEMU's
> other build dependencies ?

Instead of updating the image, Daniel asked if we could upgrade this
image to a more recent release (to remove SDL1), but IIRC the outcome
was there is no manpower for that. Meanwhile, this kludge seems the
simplest way.
BTW This command is run once at image creation.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
  2019-02-05 13:22   ` Peter Maydell
@ 2019-02-05 13:43     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-05 13:43 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Brad Smith, QEMU Developers, Stefan Hajnoczi, Qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Alex Bennée,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski

On 2/5/19 2:22 PM, Peter Maydell wrote:
> On Tue, 29 Jan 2019 at 17:59, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Previous to OpenBSD 6.3 [1], fcntl(F_SETFL) is not permitted on
>> memory devices.
>> Trying this call sets errno to ENODEV ("not a memory device"):
>>
>>   19 ENODEV Operation not supported by device.
>>     An attempt was made to apply an inappropriate function to a device,
>>     for example, trying to read a write-only device such as a printer.
>>
>> Do not assert fcntl failures in this specific case (errno set to ENODEV)
>> on OpenBSD. This fixes:
>>
>>   $ lm32-softmmu/qemu-system-lm32
>>   assertion "f != -1" failed: file "util/oslib-posix.c", line 247, function "qemu_set_nonblock"
>>   Abort trap (core dumped)
>>
>> [1] The fix seems https://github.com/openbsd/src/commit/c2a35b387f9d3c
>>   "fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, so
>>   the memory devices (/dev/null, /dev/zero, etc) need to permit them."
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  util/oslib-posix.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
>> index 4ce1ba9ca4..2f0f27e6d9 100644
>> --- a/util/oslib-posix.c
>> +++ b/util/oslib-posix.c
>> @@ -244,7 +244,17 @@ void qemu_set_nonblock(int fd)
>>      f = fcntl(fd, F_GETFL);
>>      assert(f != -1);
>>      f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
>> +#ifdef __OpenBSD__
>> +    if (f == -1) {
>> +        /*
>> +         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
>> +         * memory devices and sets errno to ENODEV.
>> +         */
>> +        assert(errno == ENODEV);
>> +    }
>> +#else
>>      assert(f != -1);
>> +#endif
> 
> You might also add "It's OK if we fail to set O_NONBLOCK on devices
> like /dev/null, because they will never block anyway."

OK!

> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thanks for reviewing this series :)

> 
> thanks
> -- PMM
> 

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 13:42     ` Philippe Mathieu-Daudé
@ 2019-02-05 13:57       ` Brad Smith
  2019-02-05 14:23         ` Philippe Mathieu-Daudé
  2019-02-06 18:15         ` Brad Smith
  0 siblings, 2 replies; 55+ messages in thread
From: Brad Smith @ 2019-02-05 13:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé,
	Peter Maydell, Gerd Hoffmann, Daniel P. Berrange
  Cc: QEMU Developers, Stefan Hajnoczi, Qemu-block, Igor Mammedov,
	Paolo Bonzini, Eric Blake, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

If someone could point me in the right direction as to how the image is 
created
I could look at coming up with something newer. I would prefer that over 
some
of the workarounds I've seen to date.

On 2/5/2019 8:42 AM, Philippe Mathieu-Daudé wrote:
> Hi Peter,
>
> On 2/5/19 2:20 PM, Peter Maydell wrote:
>> On Tue, 29 Jan 2019 at 17:57, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>> Various iotests scripts (run via 'make check-block')  use bash
>>> specific extentions.  OpenBSD comes with the Korn shell as default.
>>> Install bash to be able to run those tests.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>>   tests/vm/openbsd | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
>>> index 6263c8956b..e9c2a3f2c8 100755
>>> --- a/tests/vm/openbsd
>>> +++ b/tests/vm/openbsd
>>> @@ -45,6 +45,8 @@ class OpenBSDVM(basevm.BaseVM):
>>>           self.wait_ssh()
>>>           sys.stderr.write("Disabling W^X on the build partition...\n")
>>>           self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
>>> +        sys.stderr.write("Installing bash...\n")
>>> +        self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add bash")
>>>           self.ssh_root("shutdown -p now")
>>>           self.wait()
>>>
>> Wouldn't it make more sense to just update the image to include
>> the necessary package, the same way we do with all QEMU's
>> other build dependencies ?
> Instead of updating the image, Daniel asked if we could upgrade this
> image to a more recent release (to remove SDL1), but IIRC the outcome
> was there is no manpower for that. Meanwhile, this kludge seems the
> simplest way.
> BTW This command is run once at image creation.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 13:57       ` Brad Smith
@ 2019-02-05 14:23         ` Philippe Mathieu-Daudé
  2019-02-05 22:24           ` Brad Smith
  2019-02-06  7:29           ` Gerd Hoffmann
  2019-02-06 18:15         ` Brad Smith
  1 sibling, 2 replies; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-05 14:23 UTC (permalink / raw)
  To: Brad Smith
  Cc: Peter Maydell, Gerd Hoffmann, Daniel P. Berrange,
	QEMU Developers, Stefan Hajnoczi, Qemu-block, Igor Mammedov,
	Paolo Bonzini, Eric Blake, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

Hi Brad,

On 2/5/19 2:57 PM, Brad Smith wrote:
> If someone could point me in the right direction as to how the image is
> created
> I could look at coming up with something newer. I would prefer that over
> some
> of the workarounds I've seen to date.

I'm not an OpenBSD user, so I'm more than happy if you can help the
upstream community to test QEMU codebase on this OS. Testing helps us to
avoid code rot.

What we currently use to run tests is the 'tests/vm/openbsd' script.
The script itself doesn't document how it was built, but looking at the
commit of his introduction fdfaa33291eb we have:

    The image is prepared following instructions as in:

    https://wiki.qemu.org/Hosts/BSD

Regards,

Phil.

> On 2/5/2019 8:42 AM, Philippe Mathieu-Daudé wrote:
>> Hi Peter,
>>
>> On 2/5/19 2:20 PM, Peter Maydell wrote:
>>> On Tue, 29 Jan 2019 at 17:57, Philippe Mathieu-Daudé
>>> <philmd@redhat.com> wrote:
>>>> Various iotests scripts (run via 'make check-block')  use bash
>>>> specific extentions.  OpenBSD comes with the Korn shell as default.
>>>> Install bash to be able to run those tests.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>> ---
>>>>   tests/vm/openbsd | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
>>>> index 6263c8956b..e9c2a3f2c8 100755
>>>> --- a/tests/vm/openbsd
>>>> +++ b/tests/vm/openbsd
>>>> @@ -45,6 +45,8 @@ class OpenBSDVM(basevm.BaseVM):
>>>>           self.wait_ssh()
>>>>           sys.stderr.write("Disabling W^X on the build partition...\n")
>>>>           self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\
>>>> ]*)_\\1 \\2,wxallowed_' /etc/fstab")
>>>> +        sys.stderr.write("Installing bash...\n")
>>>> +       
>>>> self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64
>>>> pkg_add bash")
>>>>           self.ssh_root("shutdown -p now")
>>>>           self.wait()
>>>>
>>> Wouldn't it make more sense to just update the image to include
>>> the necessary package, the same way we do with all QEMU's
>>> other build dependencies ?
>> Instead of updating the image, Daniel asked if we could upgrade this
>> image to a more recent release (to remove SDL1), but IIRC the outcome
>> was there is no manpower for that. Meanwhile, this kludge seems the
>> simplest way.
>> BTW This command is run once at image creation.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports Philippe Mathieu-Daudé
  2019-02-05 13:20   ` Peter Maydell
@ 2019-02-05 16:09   ` Alex Bennée
  2019-02-05 16:17     ` Daniel P. Berrangé
  1 sibling, 1 reply; 55+ messages in thread
From: Alex Bennée @ 2019-02-05 16:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, qemu-devel, Stefan Hajnoczi, qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Peter Maydell,
	Kevin Wolf, Max Reitz, Markus Armbruster, Fam Zheng,
	Michael S. Tsirkin, Kamil Rytarowski


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Various iotests scripts (run via 'make check-block')  use bash
> specific extentions.  OpenBSD comes with the Korn shell as default.
> Install bash to be able to run those tests.

Hmmm given we use plain POSIX shell for configure portability is there a
reason the check-block test scripts use bash? I guess it doesn't get
picked up as check-block isn't run normally.

>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/vm/openbsd | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
> index 6263c8956b..e9c2a3f2c8 100755
> --- a/tests/vm/openbsd
> +++ b/tests/vm/openbsd
> @@ -45,6 +45,8 @@ class OpenBSDVM(basevm.BaseVM):
>          self.wait_ssh()
>          sys.stderr.write("Disabling W^X on the build partition...\n")
>          self.ssh_root_check("sed -E -i 's_(/tmp\ ffs)\ ([^\ ]*)_\\1 \\2,wxallowed_' /etc/fstab")
> +        sys.stderr.write("Installing bash...\n")
> +        self.ssh_root_check("PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.1/packages/amd64 pkg_add bash")
>          self.ssh_root("shutdown -p now")
>          self.wait()


--
Alex Bennée

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 16:09   ` Alex Bennée
@ 2019-02-05 16:17     ` Daniel P. Berrangé
  0 siblings, 0 replies; 55+ messages in thread
From: Daniel P. Berrangé @ 2019-02-05 16:17 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Philippe Mathieu-Daudé,
	Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, qemu-devel, Max Reitz, Kamil Rytarowski,
	Stefan Hajnoczi, Paolo Bonzini, Igor Mammedov, Fam Zheng,
	Brad Smith

On Tue, Feb 05, 2019 at 04:09:24PM +0000, Alex Bennée wrote:
> 
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
> > Various iotests scripts (run via 'make check-block')  use bash
> > specific extentions.  OpenBSD comes with the Korn shell as default.
> > Install bash to be able to run those tests.
> 
> Hmmm given we use plain POSIX shell for configure portability is there a
> reason the check-block test scripts use bash? I guess it doesn't get
> picked up as check-block isn't run normally.

configure requests any POSIX shell (#!/bin/sh) & aim for portability.

The block iotests though made an explicit choice not to care for POSIX
shell portability and so explicitly request bash (#!/bin/bash).

The block iotests are not something we expect every user of QEMU
to run, so it is valid to have a more specific requirement for
executing them, than is required by configure for general purpose
build + unit tests.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
  2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Philippe Mathieu-Daudé
  2019-02-05 13:22   ` Peter Maydell
@ 2019-02-05 17:40   ` Michael S. Tsirkin
  1 sibling, 0 replies; 55+ messages in thread
From: Michael S. Tsirkin @ 2019-02-05 17:40 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, qemu-devel, Stefan Hajnoczi, qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Peter Maydell,
	Alex Bennée, Kevin Wolf, Max Reitz, Markus Armbruster,
	Fam Zheng, Kamil Rytarowski

On Tue, Jan 29, 2019 at 06:53:58PM +0100, Philippe Mathieu-Daudé wrote:
> Previous to OpenBSD 6.3 [1], fcntl(F_SETFL) is not permitted on
> memory devices.
> Trying this call sets errno to ENODEV ("not a memory device"):
> 
>   19 ENODEV Operation not supported by device.
>     An attempt was made to apply an inappropriate function to a device,
>     for example, trying to read a write-only device such as a printer.
> 
> Do not assert fcntl failures in this specific case (errno set to ENODEV)
> on OpenBSD. This fixes:
> 
>   $ lm32-softmmu/qemu-system-lm32
>   assertion "f != -1" failed: file "util/oslib-posix.c", line 247, function "qemu_set_nonblock"
>   Abort trap (core dumped)
> 
> [1] The fix seems https://github.com/openbsd/src/commit/c2a35b387f9d3c
>   "fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, so
>   the memory devices (/dev/null, /dev/zero, etc) need to permit them."
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  util/oslib-posix.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4ce1ba9ca4..2f0f27e6d9 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -244,7 +244,17 @@ void qemu_set_nonblock(int fd)
>      f = fcntl(fd, F_GETFL);
>      assert(f != -1);
>      f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
> +#ifdef __OpenBSD__
> +    if (f == -1) {
> +        /*
> +         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
> +         * memory devices and sets errno to ENODEV.
> +         */
> +        assert(errno == ENODEV);
> +    }
> +#else
>      assert(f != -1);
> +#endif
>  }
>  
>  int socket_set_fast_reuse(int fd)
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 14:23         ` Philippe Mathieu-Daudé
@ 2019-02-05 22:24           ` Brad Smith
  2019-02-06  9:17             ` Daniel P. Berrangé
  2019-02-06  7:29           ` Gerd Hoffmann
  1 sibling, 1 reply; 55+ messages in thread
From: Brad Smith @ 2019-02-05 22:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Gerd Hoffmann, Daniel P. Berrange,
	QEMU Developers, Stefan Hajnoczi, Qemu-block, Igor Mammedov,
	Paolo Bonzini, Eric Blake, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

On 2/5/2019 9:23 AM, Philippe Mathieu-Daudé wrote:

> Hi Brad,
>
> On 2/5/19 2:57 PM, Brad Smith wrote:
>> If someone could point me in the right direction as to how the image is
>> created
>> I could look at coming up with something newer. I would prefer that over
>> some
>> of the workarounds I've seen to date.
> I'm not an OpenBSD user, so I'm more than happy if you can help the
> upstream community to test QEMU codebase on this OS. Testing helps us to
> avoid code rot.
>
> What we currently use to run tests is the 'tests/vm/openbsd' script.
> The script itself doesn't document how it was built, but looking at the
> commit of his introduction fdfaa33291eb we have:
>
>      The image is prepared following instructions as in:
>
>      https://wiki.qemu.org/Hosts/BSD

Ok, well that brings me to my next question. How do I get access to the 
Wiki to update
the instructions?

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 14:23         ` Philippe Mathieu-Daudé
  2019-02-05 22:24           ` Brad Smith
@ 2019-02-06  7:29           ` Gerd Hoffmann
  2019-02-06 12:11             ` Peter Maydell
  1 sibling, 1 reply; 55+ messages in thread
From: Gerd Hoffmann @ 2019-02-06  7:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, Peter Maydell, Daniel P. Berrange, QEMU Developers,
	Stefan Hajnoczi, Qemu-block, Igor Mammedov, Paolo Bonzini,
	Eric Blake, Alex Bennée, Kevin Wolf, Max Reitz,
	Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

On Tue, Feb 05, 2019 at 03:23:53PM +0100, Philippe Mathieu-Daudé wrote:
> Hi Brad,
> 
> On 2/5/19 2:57 PM, Brad Smith wrote:
> > If someone could point me in the right direction as to how the image is
> > created
> > I could look at coming up with something newer. I would prefer that over
> > some
> > of the workarounds I've seen to date.
> 
> I'm not an OpenBSD user, so I'm more than happy if you can help the
> upstream community to test QEMU codebase on this OS. Testing helps us to
> avoid code rot.
> 
> What we currently use to run tests is the 'tests/vm/openbsd' script.
> The script itself doesn't document how it was built, but looking at the
> commit of his introduction fdfaa33291eb we have:

There also is a patch floating around to auto-install openbsd:
	https://patchwork.kernel.org/patch/10749459/

Not fully sure why this wasn't merged yet.  One problem is that this
patch depends on a new slirp feature (added in the 3.1 devel cycle,
needed to serve install.conf via http).  Which blocked merge during the
3.1 cycle, because depending on unreleased qemu for test builds isn't a
good idea.  But 3.1 is released, so maybe we can merge that for 4.0 now?

The openbsd installer trying to fetch install.conf not only via http but
also via tftp would also simplify things, maybe implementing that is an
option for the next openbsd release?

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 22:24           ` Brad Smith
@ 2019-02-06  9:17             ` Daniel P. Berrangé
  0 siblings, 0 replies; 55+ messages in thread
From: Daniel P. Berrangé @ 2019-02-06  9:17 UTC (permalink / raw)
  To: Brad Smith
  Cc: Philippe Mathieu-Daudé,
	Peter Maydell, Gerd Hoffmann, QEMU Developers, Stefan Hajnoczi,
	Qemu-block, Igor Mammedov, Paolo Bonzini, Eric Blake,
	Alex Bennée, Kevin Wolf, Max Reitz, Markus Armbruster,
	Fam Zheng, Michael S. Tsirkin, Kamil Rytarowski

On Tue, Feb 05, 2019 at 05:24:02PM -0500, Brad Smith wrote:
> On 2/5/2019 9:23 AM, Philippe Mathieu-Daudé wrote:
> 
> > Hi Brad,
> > 
> > On 2/5/19 2:57 PM, Brad Smith wrote:
> > > If someone could point me in the right direction as to how the image is
> > > created
> > > I could look at coming up with something newer. I would prefer that over
> > > some
> > > of the workarounds I've seen to date.
> > I'm not an OpenBSD user, so I'm more than happy if you can help the
> > upstream community to test QEMU codebase on this OS. Testing helps us to
> > avoid code rot.
> > 
> > What we currently use to run tests is the 'tests/vm/openbsd' script.
> > The script itself doesn't document how it was built, but looking at the
> > commit of his introduction fdfaa33291eb we have:
> > 
> >      The image is prepared following instructions as in:
> > 
> >      https://wiki.qemu.org/Hosts/BSD
> 
> Ok, well that brings me to my next question. How do I get access to the Wiki
> to update the instructions?

I'll create you an account and send you details offlist.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-06  7:29           ` Gerd Hoffmann
@ 2019-02-06 12:11             ` Peter Maydell
  0 siblings, 0 replies; 55+ messages in thread
From: Peter Maydell @ 2019-02-06 12:11 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Philippe Mathieu-Daudé,
	Brad Smith, Daniel P. Berrange, QEMU Developers, Stefan Hajnoczi,
	Qemu-block, Igor Mammedov, Paolo Bonzini, Eric Blake,
	Alex Bennée, Kevin Wolf, Max Reitz, Markus Armbruster,
	Fam Zheng, Michael S. Tsirkin, Kamil Rytarowski

On Wed, 6 Feb 2019 at 07:29, Gerd Hoffmann <kraxel@redhat.com> wrote:
> There also is a patch floating around to auto-install openbsd:
>         https://patchwork.kernel.org/patch/10749459/
>
> Not fully sure why this wasn't merged yet.  One problem is that this
> patch depends on a new slirp feature (added in the 3.1 devel cycle,
> needed to serve install.conf via http).  Which blocked merge during the
> 3.1 cycle, because depending on unreleased qemu for test builds isn't a
> good idea.  But 3.1 is released, so maybe we can merge that for 4.0 now?

The feature isn't in the installed QEMU for the Ubuntu box I
run the BSD VM tests on, which is what the blocker is -- I don't
want to have to keep around and maintain a non-system QEMU to run
the VMs that are doing the tests here. It would be preferable to
remove the dependency on the bleeding-edge slirp feature.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-05 13:57       ` Brad Smith
  2019-02-05 14:23         ` Philippe Mathieu-Daudé
@ 2019-02-06 18:15         ` Brad Smith
  2019-02-06 20:25           ` Alex Bennée
  1 sibling, 1 reply; 55+ messages in thread
From: Brad Smith @ 2019-02-06 18:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé,
	Peter Maydell, Gerd Hoffmann, Daniel P. Berrange
  Cc: QEMU Developers, Stefan Hajnoczi, Qemu-block, Igor Mammedov,
	Paolo Bonzini, Eric Blake, Alex Bennée, Kevin Wolf,
	Max Reitz, Markus Armbruster, Fam Zheng, Michael S. Tsirkin,
	Kamil Rytarowski

On 2/5/2019 8:57 AM, Brad Smith wrote:

> If someone could point me in the right direction as to how the image 
> is created
> I could look at coming up with something newer. I would prefer that 
> over some
> of the workarounds I've seen to date.

I started creating the image and then wondered what do I set the root 
password
to? The instructions also talk about an SSH key but I don't know how 
that would
work when this image is used for the VM test framework.

I updated the instructions on the Wiki to make use of VirtIO for both 
the NIC and
disk controller.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-06 18:15         ` Brad Smith
@ 2019-02-06 20:25           ` Alex Bennée
  2019-02-07  1:03             ` Brad Smith
  0 siblings, 1 reply; 55+ messages in thread
From: Alex Bennée @ 2019-02-06 20:25 UTC (permalink / raw)
  To: Brad Smith
  Cc: Philippe Mathieu-Daudé,
	Peter Maydell, Gerd Hoffmann, Daniel P. Berrange, Kevin Wolf,
	Fam Zheng, Qemu-block, Michael S. Tsirkin, QEMU Developers,
	Max Reitz, Kamil Rytarowski, Stefan Hajnoczi, Paolo Bonzini,
	Igor Mammedov, Markus Armbruster


Brad Smith <brad@comstyle.com> writes:

> On 2/5/2019 8:57 AM, Brad Smith wrote:
>
>> If someone could point me in the right direction as to how the image
>> is created
>> I could look at coming up with something newer. I would prefer that
>> over some
>> of the workarounds I've seen to date.
>
> I started creating the image and then wondered what do I set the root
> password
> to? The instructions also talk about an SSH key but I don't know how
> that would
> work when this image is used for the VM test framework.

See tests/keys - basically we have a hard-wired testing key.

> I updated the instructions on the Wiki to make use of VirtIO for both
> the NIC and disk controller.

Can the OpenBSD kernel use virtio-net-pci and virtio-scsi-pci?

It's not super important for build testing but they are the most capable
variants of virtio. The virtio-pci gives nice discover-able hotplug and
I believe you need virtio-scsi-pci if you want to use funky options like
discard for thin provisioning.

--
Alex Bennée

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-06 20:25           ` Alex Bennée
@ 2019-02-07  1:03             ` Brad Smith
  2019-02-07  7:59               ` Alex Bennée
  0 siblings, 1 reply; 55+ messages in thread
From: Brad Smith @ 2019-02-07  1:03 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Philippe Mathieu-Daudé,
	Peter Maydell, Gerd Hoffmann, Daniel P. Berrange, Kevin Wolf,
	Fam Zheng, Qemu-block, Michael S. Tsirkin, QEMU Developers,
	Max Reitz, Kamil Rytarowski, Stefan Hajnoczi, Paolo Bonzini,
	Igor Mammedov, Markus Armbruster

On 2/6/2019 3:25 PM, Alex Bennée wrote:

> Brad Smith <brad@comstyle.com> writes:
>
>> On 2/5/2019 8:57 AM, Brad Smith wrote:
>>
>>> If someone could point me in the right direction as to how the image
>>> is created
>>> I could look at coming up with something newer. I would prefer that
>>> over some
>>> of the workarounds I've seen to date.
>> I started creating the image and then wondered what do I set the root
>> password
>> to? The instructions also talk about an SSH key but I don't know how
>> that would
>> work when this image is used for the VM test framework.
> See tests/keys - basically we have a hard-wired testing key.
So the root password doesn't matter?
>> I updated the instructions on the Wiki to make use of VirtIO for both
>> the NIC and disk controller.
> Can the OpenBSD kernel use virtio-net-pci and virtio-scsi-pci?
>
> It's not super important for build testing but they are the most capable
> variants of virtio. The virtio-pci gives nice discover-able hotplug and
> I believe you need virtio-scsi-pci if you want to use funky options like
> discard for thin provisioning.

Yes to both.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports
  2019-02-07  1:03             ` Brad Smith
@ 2019-02-07  7:59               ` Alex Bennée
  0 siblings, 0 replies; 55+ messages in thread
From: Alex Bennée @ 2019-02-07  7:59 UTC (permalink / raw)
  To: Brad Smith
  Cc: Kevin Wolf, Peter Maydell, Qemu-block, Michael S. Tsirkin,
	Markus Armbruster, QEMU Developers, Max Reitz, Kamil Rytarowski,
	Gerd Hoffmann, Stefan Hajnoczi, Igor Mammedov, Paolo Bonzini,
	Fam Zheng, Philippe Mathieu-Daudé


Brad Smith <brad@comstyle.com> writes:

> On 2/6/2019 3:25 PM, Alex Bennée wrote:
>
>> Brad Smith <brad@comstyle.com> writes:
>>
>>> On 2/5/2019 8:57 AM, Brad Smith wrote:
>>>
>>>> If someone could point me in the right direction as to how the image
>>>> is created
>>>> I could look at coming up with something newer. I would prefer that
>>>> over some
>>>> of the workarounds I've seen to date.
>>> I started creating the image and then wondered what do I set the root
>>> password
>>> to? The instructions also talk about an SSH key but I don't know how
>>> that would
>>> work when this image is used for the VM test framework.
>> See tests/keys - basically we have a hard-wired testing key.
> So the root password doesn't matter?

I don't think so. See "Adding new guests" in docs/devel/testing.rst

The Ubuntu and CentOS build_image methods are a bit more elaborate in
that they build a cloud-image iso which contains a bunch of metadata for
the image to apply on boot-up. The OpenBSD build_image just downloads
the data and uncompresses it.

The defaults in BaseIMG are:

    GUEST_USER = "qemu"
    GUEST_PASS = "qemupass"
    ROOT_PASS = "qemupass"

>>> I updated the instructions on the Wiki to make use of VirtIO for both
>>> the NIC and disk controller.
>> Can the OpenBSD kernel use virtio-net-pci and virtio-scsi-pci?
>>
>> It's not super important for build testing but they are the most capable
>> variants of virtio. The virtio-pci gives nice discover-able hotplug and
>> I believe you need virtio-scsi-pci if you want to use funky options like
>> discard for thin provisioning.
>
> Yes to both.

Cool.

--
Alex Bennée

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images Philippe Mathieu-Daudé
  2019-02-05 13:17   ` Peter Maydell
@ 2019-02-07 22:08   ` Philippe Mathieu-Daudé
  2019-02-08 17:36     ` Alex Bennée
  1 sibling, 1 reply; 55+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-07 22:08 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Brad Smith, qemu-devel, Kevin Wolf, Peter Maydell, qemu-block,
	Michael S. Tsirkin, Markus Armbruster, Max Reitz,
	Kamil Rytarowski, Stefan Hajnoczi, Paolo Bonzini, Igor Mammedov,
	Fam Zheng

Hi Alex,

Can you queue this patch?

On 1/29/19 6:53 PM, Philippe Mathieu-Daudé wrote:
> Depending of the host hardware, copying and extracting VM images can
> take up to few minutes. Add verbosity to avoid the user to worry about
> VMs hanging.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/vm/centos  | 3 ++-
>  tests/vm/freebsd | 3 ++-
>  tests/vm/netbsd  | 3 ++-
>  tests/vm/openbsd | 3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/vm/centos b/tests/vm/centos
> index daa2dbca03..ba133ea429 100755
> --- a/tests/vm/centos
> +++ b/tests/vm/centos
> @@ -65,8 +65,9 @@ class CentosVM(basevm.BaseVM):
>      def build_image(self, img):
>          cimg = self._download_with_cache("https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1802.qcow2.xz")
>          img_tmp = img + ".tmp"
> +        sys.stderr.write("Extracting the image...\n")
>          subprocess.check_call(["cp", "-f", cimg, img_tmp + ".xz"])
> -        subprocess.check_call(["xz", "-df", img_tmp + ".xz"])
> +        subprocess.check_call(["xz", "-dvf", img_tmp + ".xz"])
>          subprocess.check_call(["qemu-img", "resize", img_tmp, "50G"])
>          self.boot(img_tmp, extra_args = ["-cdrom", self._gen_cloud_init_iso()])
>          self.wait_ssh()
> diff --git a/tests/vm/freebsd b/tests/vm/freebsd
> index 19a3729172..2007c495a8 100755
> --- a/tests/vm/freebsd
> +++ b/tests/vm/freebsd
> @@ -34,8 +34,9 @@ class FreeBSDVM(basevm.BaseVM):
>                  sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891')
>          img_tmp_xz = img + ".tmp.xz"
>          img_tmp = img + ".tmp"
> +        sys.stderr.write("Extracting the image...\n")
>          subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
> -        subprocess.check_call(["xz", "-df", img_tmp_xz])
> +        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
>          if os.path.exists(img):
>              os.remove(img)
>          os.rename(img_tmp, img)
> diff --git a/tests/vm/netbsd b/tests/vm/netbsd
> index fac6a7ce51..93b267c292 100755
> --- a/tests/vm/netbsd
> +++ b/tests/vm/netbsd
> @@ -34,8 +34,9 @@ class NetBSDVM(basevm.BaseVM):
>                                           sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732')
>          img_tmp_xz = img + ".tmp.xz"
>          img_tmp = img + ".tmp"
> +        sys.stderr.write("Extracting the image...\n")
>          subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
> -        subprocess.check_call(["xz", "-df", img_tmp_xz])
> +        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
>          if os.path.exists(img):
>              os.remove(img)
>          os.rename(img_tmp, img)
> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
> index cfe0572c59..2105c01a26 100755
> --- a/tests/vm/openbsd
> +++ b/tests/vm/openbsd
> @@ -35,8 +35,9 @@ class OpenBSDVM(basevm.BaseVM):
>                  sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf')
>          img_tmp_xz = img + ".tmp.xz"
>          img_tmp = img + ".tmp"
> +        sys.stderr.write("Extracting the image...\n")
>          subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
> -        subprocess.check_call(["xz", "-df", img_tmp_xz])
> +        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
>          if os.path.exists(img):
>              os.remove(img)
>          os.rename(img_tmp, img)
> 

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images
  2019-02-07 22:08   ` Philippe Mathieu-Daudé
@ 2019-02-08 17:36     ` Alex Bennée
  0 siblings, 0 replies; 55+ messages in thread
From: Alex Bennée @ 2019-02-08 17:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, qemu-devel, Kevin Wolf, Peter Maydell, qemu-block,
	Michael S. Tsirkin, Markus Armbruster, Max Reitz,
	Kamil Rytarowski, Stefan Hajnoczi, Paolo Bonzini, Igor Mammedov,
	Fam Zheng


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Hi Alex,
>
> Can you queue this patch?

Done.

>
> On 1/29/19 6:53 PM, Philippe Mathieu-Daudé wrote:
>> Depending of the host hardware, copying and extracting VM images can
>> take up to few minutes. Add verbosity to avoid the user to worry about
>> VMs hanging.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  tests/vm/centos  | 3 ++-
>>  tests/vm/freebsd | 3 ++-
>>  tests/vm/netbsd  | 3 ++-
>>  tests/vm/openbsd | 3 ++-
>>  4 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/vm/centos b/tests/vm/centos
>> index daa2dbca03..ba133ea429 100755
>> --- a/tests/vm/centos
>> +++ b/tests/vm/centos
>> @@ -65,8 +65,9 @@ class CentosVM(basevm.BaseVM):
>>      def build_image(self, img):
>>          cimg = self._download_with_cache("https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1802.qcow2.xz")
>>          img_tmp = img + ".tmp"
>> +        sys.stderr.write("Extracting the image...\n")
>>          subprocess.check_call(["cp", "-f", cimg, img_tmp + ".xz"])
>> -        subprocess.check_call(["xz", "-df", img_tmp + ".xz"])
>> +        subprocess.check_call(["xz", "-dvf", img_tmp + ".xz"])
>>          subprocess.check_call(["qemu-img", "resize", img_tmp, "50G"])
>>          self.boot(img_tmp, extra_args = ["-cdrom", self._gen_cloud_init_iso()])
>>          self.wait_ssh()
>> diff --git a/tests/vm/freebsd b/tests/vm/freebsd
>> index 19a3729172..2007c495a8 100755
>> --- a/tests/vm/freebsd
>> +++ b/tests/vm/freebsd
>> @@ -34,8 +34,9 @@ class FreeBSDVM(basevm.BaseVM):
>>                  sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891')
>>          img_tmp_xz = img + ".tmp.xz"
>>          img_tmp = img + ".tmp"
>> +        sys.stderr.write("Extracting the image...\n")
>>          subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
>> -        subprocess.check_call(["xz", "-df", img_tmp_xz])
>> +        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
>>          if os.path.exists(img):
>>              os.remove(img)
>>          os.rename(img_tmp, img)
>> diff --git a/tests/vm/netbsd b/tests/vm/netbsd
>> index fac6a7ce51..93b267c292 100755
>> --- a/tests/vm/netbsd
>> +++ b/tests/vm/netbsd
>> @@ -34,8 +34,9 @@ class NetBSDVM(basevm.BaseVM):
>>                                           sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732')
>>          img_tmp_xz = img + ".tmp.xz"
>>          img_tmp = img + ".tmp"
>> +        sys.stderr.write("Extracting the image...\n")
>>          subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
>> -        subprocess.check_call(["xz", "-df", img_tmp_xz])
>> +        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
>>          if os.path.exists(img):
>>              os.remove(img)
>>          os.rename(img_tmp, img)
>> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
>> index cfe0572c59..2105c01a26 100755
>> --- a/tests/vm/openbsd
>> +++ b/tests/vm/openbsd
>> @@ -35,8 +35,9 @@ class OpenBSDVM(basevm.BaseVM):
>>                  sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf')
>>          img_tmp_xz = img + ".tmp.xz"
>>          img_tmp = img + ".tmp"
>> +        sys.stderr.write("Extracting the image...\n")
>>          subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
>> -        subprocess.check_call(["xz", "-df", img_tmp_xz])
>> +        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
>>          if os.path.exists(img):
>>              os.remove(img)
>>          os.rename(img_tmp, img)
>>


--
Alex Bennée

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: Improve portability by searching bash in the $PATH
  2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: " Philippe Mathieu-Daudé
  2019-01-29 18:12   ` Kamil Rytarowski
  2019-01-30  8:30   ` Igor Mammedov
@ 2019-02-20 20:01   ` Michael S. Tsirkin
  2 siblings, 0 replies; 55+ messages in thread
From: Michael S. Tsirkin @ 2019-02-20 20:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Brad Smith, qemu-devel, Stefan Hajnoczi, qemu-block,
	Igor Mammedov, Paolo Bonzini, Eric Blake, Peter Maydell,
	Alex Bennée, Kevin Wolf, Max Reitz, Markus Armbruster,
	Fam Zheng, Kamil Rytarowski

On Tue, Jan 29, 2019 at 06:53:53PM +0100, Philippe Mathieu-Daudé wrote:
> Bash is not always installed as /bin/bash. In particular on OpenBSD,
> the package installs it in /usr/local/bin.
> Use the 'env' shebang to search bash in the $PATH.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  tests/data/acpi/rebuild-expected-aml.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh
> index bf9ba242ad..ff77a751c8 100755
> --- a/tests/data/acpi/rebuild-expected-aml.sh
> +++ b/tests/data/acpi/rebuild-expected-aml.sh
> @@ -1,4 +1,4 @@
> -#! /bin/bash
> +#! /usr/bin/env bash
>  
>  #
>  # Rebuild expected AML files for acpi unit-test
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2019-02-20 20:01 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 17:53 [Qemu-devel] [PATCH v2 00/18] OpenBSD: Enable qtesting Philippe Mathieu-Daudé
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 01/18] tests/vm: Be verbose while extracting compressed images Philippe Mathieu-Daudé
2019-02-05 13:17   ` Peter Maydell
2019-02-07 22:08   ` Philippe Mathieu-Daudé
2019-02-08 17:36     ` Alex Bennée
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 02/18] configure: Disable W^X on OpenBSD Philippe Mathieu-Daudé
2019-01-29 18:02   ` Philippe Mathieu-Daudé
2019-01-29 21:54   ` Eric Blake
2019-01-30  7:17     ` Thomas Huth
2019-02-05  3:04       ` Eric Blake
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 03/18] tests/vm/openbsd: Disable the W^X protection on the build partition Philippe Mathieu-Daudé
2019-01-29 21:58   ` Eric Blake
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 04/18] ahci-test: Add dependency to qemu-img tool Philippe Mathieu-Daudé
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 05/18] qemu-iotests: Add dependency to qemu-nbd tool Philippe Mathieu-Daudé
2019-01-29 22:03   ` Eric Blake
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 06/18] qemu-iotests: Improve portability by searching bash in the $PATH Philippe Mathieu-Daudé
2019-01-29 22:15   ` Eric Blake
2019-01-30 10:11     ` Thomas Huth
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 07/18] tests/multiboot: " Philippe Mathieu-Daudé
2019-01-29 18:10   ` Kamil Rytarowski
2019-01-29 22:16   ` Eric Blake
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 08/18] tests/bios-tables: " Philippe Mathieu-Daudé
2019-01-29 18:12   ` Kamil Rytarowski
2019-01-30  8:30   ` Igor Mammedov
2019-02-20 20:01   ` Michael S. Tsirkin
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 09/18] tests/vm/openbsd: Install Bash from the ports Philippe Mathieu-Daudé
2019-02-05 13:20   ` Peter Maydell
2019-02-05 13:42     ` Philippe Mathieu-Daudé
2019-02-05 13:57       ` Brad Smith
2019-02-05 14:23         ` Philippe Mathieu-Daudé
2019-02-05 22:24           ` Brad Smith
2019-02-06  9:17             ` Daniel P. Berrangé
2019-02-06  7:29           ` Gerd Hoffmann
2019-02-06 12:11             ` Peter Maydell
2019-02-06 18:15         ` Brad Smith
2019-02-06 20:25           ` Alex Bennée
2019-02-07  1:03             ` Brad Smith
2019-02-07  7:59               ` Alex Bennée
2019-02-05 16:09   ` Alex Bennée
2019-02-05 16:17     ` Daniel P. Berrangé
2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 10/18] qemu-iotests: Ensure GNU sed is used Philippe Mathieu-Daudé
2019-01-29 22:21   ` Eric Blake
2019-02-04 23:55     ` Philippe Mathieu-Daudé
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 11/18] tests/vm/openbsd: Install GNU sed from the ports Philippe Mathieu-Daudé
2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 12/18] test-iov: Disable iov/io test on OpenBSD Philippe Mathieu-Daudé
2019-01-29 17:53 ` [Qemu-devel] [RFC PATCH v2 13/18] oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Philippe Mathieu-Daudé
2019-02-05 13:22   ` Peter Maydell
2019-02-05 13:43     ` Philippe Mathieu-Daudé
2019-02-05 17:40   ` Michael S. Tsirkin
2019-01-29 17:53 ` [Qemu-devel] [PATCH v2 14/18] tests/vm: Run tests on OpenBSD Philippe Mathieu-Daudé
2019-02-05 13:23   ` Peter Maydell
2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 15/18] iotests: Let verify_platform() check for unsupported platforms Philippe Mathieu-Daudé
2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 16/18] iotests: Disable 208 on OpenBSD Philippe Mathieu-Daudé
2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 17/18] iotests: Disable 209 " Philippe Mathieu-Daudé
2019-01-29 17:54 ` [Qemu-devel] [RFC PATCH v2 18/18] iotests: Disable 236 and 238 " Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.