qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH] qemu-iotests: Fix core dump suppression in test 039
Date: Tue, 13 May 2014 10:46:03 +0200	[thread overview]
Message-ID: <1399970763-8102-1-git-send-email-armbru@redhat.com> (raw)

The shell script attempts to suppress core dumps like this:

    old_ulimit=$(ulimit -c)
    ulimit -c 0
    $QEMU_IO arg...
    ulimit -c "$old_ulimit"

This breaks the test hard unless the limit was zero to begin with!
ulimit sets both hard and soft limit by default, and (re-)raising the
hard limit requires privileges.  Broken since it was added in commit
dc68afe.

Could be fixed by adding -S to set only the soft limit, but I'm not
sure how portable that is in practice.  Simply do it in a subshell
instead, like this:

    (ulimit -c 0; exec $QEMU_IO arg...)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 tests/qemu-iotests/039 | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index b9cbe99..182b0f0 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -67,10 +67,8 @@ echo "== Creating a dirty image file =="
 IMGOPTS="compat=1.1,lazy_refcounts=on"
 _make_test_img $size
 
-old_ulimit=$(ulimit -c)
-ulimit -c 0 # do not produce a core dump on abort(3)
-$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" | _filter_qemu_io
-ulimit -c "$old_ulimit"
+(ulimit -c 0 # do not produce a core dump on abort(3)
+exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG") | _filter_qemu_io
 
 # The dirty bit must be set
 ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
@@ -103,10 +101,8 @@ echo "== Opening a dirty image read/write should repair it =="
 IMGOPTS="compat=1.1,lazy_refcounts=on"
 _make_test_img $size
 
-old_ulimit=$(ulimit -c)
-ulimit -c 0 # do not produce a core dump on abort(3)
-$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" | _filter_qemu_io
-ulimit -c "$old_ulimit"
+(ulimit -c 0 # do not produce a core dump on abort(3)
+exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG") | _filter_qemu_io
 
 # The dirty bit must be set
 ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
@@ -122,10 +118,8 @@ echo "== Creating an image file with lazy_refcounts=off =="
 IMGOPTS="compat=1.1,lazy_refcounts=off"
 _make_test_img $size
 
-old_ulimit=$(ulimit -c)
-ulimit -c 0 # do not produce a core dump on abort(3)
-$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" | _filter_qemu_io
-ulimit -c "$old_ulimit"
+(ulimit -c 0 # do not produce a core dump on abort(3)
+exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG") | _filter_qemu_io
 
 # The dirty bit must not be set since lazy_refcounts=off
 ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
-- 
1.8.1.4

             reply	other threads:[~2014-05-13  8:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13  8:46 Markus Armbruster [this message]
2014-05-13  9:22 ` [Qemu-devel] [PATCH] qemu-iotests: Fix core dump suppression in test 039 Fam Zheng
2014-05-13 11:30   ` Markus Armbruster
2014-05-13 12:43     ` Fam Zheng
2014-05-13 17:44   ` Markus Armbruster
2014-05-13 19:30     ` Eric Blake
2014-05-14  7:58     ` Kevin Wolf
2014-05-14  9:25       ` Markus Armbruster
2014-05-14 11:16         ` Markus Armbruster
2014-05-14 11:42           ` Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2014-05-14 13:12 Markus Armbruster
2014-05-14 13:28 ` Fam Zheng
2014-05-14 14:28   ` Kevin Wolf
2014-05-26  9:10     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399970763-8102-1-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).