thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
619821
From 5eef8556fa85c070a242f93b675e7fb8e24a2fa0 Mon Sep 17 00:00:00 2001
619821
From: Max Reitz <mreitz@redhat.com>
619821
Date: Mon, 13 Mar 2017 17:46:56 +0100
619821
Subject: [PATCH 15/24] iotests: Fix test 039
619821
619821
RH-Author: Max Reitz <mreitz@redhat.com>
619821
Message-id: <20170313174659.29164-1-mreitz@redhat.com>
619821
Patchwork-id: 74277
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH 6/9] iotests: Fix test 039
619821
Bugzilla: 1427176
619821
RH-Acked-by: Fam Zheng <famz@redhat.com>
619821
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
619821
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
619821
619821
Test 039 used qemu-io -c abort for simulating a qemu crash; however,
619821
abort() generally results in a core dump and ulimit -c 0 is no reliable
619821
way of preventing that. Use "sigraise $(kill -l KILL)" instead to have
619821
it crash without a core dump.
619821
619821
Signed-off-by: Max Reitz <mreitz@redhat.com>
619821
Reviewed-by: Fam Zheng <famz@redhat.com>
619821
Message-id: 1418032092-16813-4-git-send-email-mreitz@redhat.com
619821
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
619821
(cherry picked from commit 3f394472c5bca59de5cab9baafdff1984b0213a3)
619821
Signed-off-by: Max Reitz <mreitz@redhat.com>
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
---
619821
 tests/qemu-iotests/039     | 18 +++++++++++++-----
619821
 tests/qemu-iotests/039.out |  6 +++---
619821
 2 files changed, 16 insertions(+), 8 deletions(-)
619821
619821
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
619821
index 1e50651..ac85476 100755
619821
--- a/tests/qemu-iotests/039
619821
+++ b/tests/qemu-iotests/039
619821
@@ -46,9 +46,11 @@ _supported_proto generic
619821
 _supported_os Linux
619821
 _unsupported_qemu_io_options --nocache
619821
 
619821
-_no_dump_exec()
619821
+_subshell_exec()
619821
 {
619821
-    (ulimit -c 0; exec "$@")
619821
+    # Executing crashing commands in a subshell prevents information like the
619821
+    # "Killed" line from being lost
619821
+    (exec "$@")
619821
 }
619821
 
619821
 size=128M
619821
@@ -71,7 +73,9 @@ echo "== Creating a dirty image file =="
619821
 IMGOPTS="compat=1.1,lazy_refcounts=on"
619821
 _make_test_img $size
619821
 
619821
-_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
619821
+_subshell_exec $QEMU_IO -c "write -P 0x5a 0 512" \
619821
+                        -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \
619821
+    | _filter_qemu_io
619821
 
619821
 # The dirty bit must be set
619821
 ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
619821
@@ -104,7 +108,9 @@ echo "== Opening a dirty image read/write should repair it =="
619821
 IMGOPTS="compat=1.1,lazy_refcounts=on"
619821
 _make_test_img $size
619821
 
619821
-_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
619821
+_subshell_exec $QEMU_IO -c "write -P 0x5a 0 512" \
619821
+                        -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \
619821
+    | _filter_qemu_io
619821
 
619821
 # The dirty bit must be set
619821
 ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
619821
@@ -120,7 +126,9 @@ echo "== Creating an image file with lazy_refcounts=off =="
619821
 IMGOPTS="compat=1.1,lazy_refcounts=off"
619821
 _make_test_img $size
619821
 
619821
-_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
619821
+_subshell_exec $QEMU_IO -c "write -P 0x5a 0 512" \
619821
+                        -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \
619821
+    | _filter_qemu_io
619821
 
619821
 # The dirty bit must not be set since lazy_refcounts=off
619821
 ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
619821
diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
619821
index af62da1..f3fe58b 100644
619821
--- a/tests/qemu-iotests/039.out
619821
+++ b/tests/qemu-iotests/039.out
619821
@@ -11,7 +11,7 @@ No errors were found on the image.
619821
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
619821
 wrote 512/512 bytes at offset 0
619821
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
619821
-./039: Aborted                 ( ulimit -c 0; exec "$@" )
619821
+./039: Killed                  ( exec "$@" )
619821
 incompatible_features     0x1
619821
 ERROR cluster 5 refcount=0 reference=1
619821
 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
619821
@@ -46,7 +46,7 @@ read 512/512 bytes at offset 0
619821
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
619821
 wrote 512/512 bytes at offset 0
619821
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
619821
-./039: Aborted                 ( ulimit -c 0; exec "$@" )
619821
+./039: Killed                  ( exec "$@" )
619821
 incompatible_features     0x1
619821
 ERROR cluster 5 refcount=0 reference=1
619821
 Rebuilding refcount structure
619821
@@ -60,7 +60,7 @@ incompatible_features     0x0
619821
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
619821
 wrote 512/512 bytes at offset 0
619821
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
619821
-./039: Aborted                 ( ulimit -c 0; exec "$@" )
619821
+./039: Killed                  ( exec "$@" )
619821
 incompatible_features     0x0
619821
 No errors were found on the image.
619821
 *** done
619821
-- 
619821
1.8.3.1
619821