From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su0cf-0003q1-0W for qemu-devel@nongnu.org; Wed, 25 Jul 2012 08:23:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Su0cZ-0007cB-7y for qemu-devel@nongnu.org; Wed, 25 Jul 2012 08:23:24 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:50693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su0cY-0007c6-V2 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 08:23:19 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2012 13:23:18 +0100 Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6PCLgir2834466 for ; Wed, 25 Jul 2012 13:21:42 +0100 Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6PCLeqg009584 for ; Wed, 25 Jul 2012 06:21:42 -0600 From: Stefan Hajnoczi Date: Wed, 25 Jul 2012 13:21:23 +0100 Message-Id: <1343218884-14980-7-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1343218884-14980-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1343218884-14980-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 6/7] qemu-io: add "abort" command to simulate program crash List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Khoa Huynh , Anthony Liguori , Stefan Hajnoczi Avoiding data loss and corruption is the top requirement for image file formats. The qemu-io "abort" command makes it possible to simulate program crashes and does not give the image format a chance to cleanly shut down. This command is useful for data integrity test cases. Signed-off-by: Stefan Hajnoczi --- qemu-io.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qemu-io.c b/qemu-io.c index 8f3b94b..d0f4fb7 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -1652,6 +1652,17 @@ static const cmdinfo_t map_cmd = { .oneline = "prints the allocated areas of a file", }; +static int abort_f(int argc, char **argv) +{ + abort(); +} + +static const cmdinfo_t abort_cmd = { + .name = "abort", + .cfunc = abort_f, + .flags = CMD_NOFILE_OK, + .oneline = "simulate a program crash using abort(3)", +}; static int close_f(int argc, char **argv) { @@ -1905,6 +1916,7 @@ int main(int argc, char **argv) add_command(&discard_cmd); add_command(&alloc_cmd); add_command(&map_cmd); + add_command(&abort_cmd); add_args_command(init_args_command); add_check_command(init_check_command); -- 1.7.10.4