aboutsummaryrefslogtreecommitdiff
path: root/tests/test-blockjob-txn.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-05-08 16:13:08 +0200
committerJeff Cody <jcody@redhat.com>2017-05-24 16:38:51 -0400
commit7e74a73499059263212048ad989facae5500d230 (patch)
tree767368cdbaf1eda486893d987c6923ceebe0bb93 /tests/test-blockjob-txn.c
parentc8ab5c2dde2d9321552830350e60c83a059486d7 (diff)
blockjob: strengthen a bit test-blockjob-txn
Unlike test-blockjob-txn, QMP releases the reference to the transaction before the jobs finish. Thus, qemu-iotest 124 showed a failure while working on the next patch that the unit tests did not have. Make the test a little nastier. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20170508141310.8674-10-pbonzini@redhat.com Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'tests/test-blockjob-txn.c')
-rw-r--r--tests/test-blockjob-txn.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c
index 0f80194e85..c77343fc04 100644
--- a/tests/test-blockjob-txn.c
+++ b/tests/test-blockjob-txn.c
@@ -167,6 +167,11 @@ static void test_pair_jobs(int expected1, int expected2)
block_job_start(job1);
block_job_start(job2);
+ /* Release our reference now to trigger as many nice
+ * use-after-free bugs as possible.
+ */
+ block_job_txn_unref(txn);
+
if (expected1 == -ECANCELED) {
block_job_cancel(job1);
}
@@ -187,8 +192,6 @@ static void test_pair_jobs(int expected1, int expected2)
g_assert_cmpint(result1, ==, expected1);
g_assert_cmpint(result2, ==, expected2);
-
- block_job_txn_unref(txn);
}
static void test_pair_jobs_success(void)