summaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-07-27 09:05:23 +0100
committerKevin Wolf <kwolf@redhat.com>2012-08-06 22:39:14 +0200
commite01c30d3e20eb8cf068b08af46c532f99975527a (patch)
tree0b2830470ae2f1a31a9e2d2da63e903f97133f8a /qemu-io.c
parentbfe8043e9214d2fc6572cc72b5f2218308747acd (diff)
downloadqemu-e01c30d3e20eb8cf068b08af46c532f99975527a.tar.gz
qemu-io: add "abort" command to simulate program crash
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 <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 8f3b94b838..d0f4fb70c7 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);