aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-blockjob-txn.c7
-rw-r--r--tests/test-blockjob.c10
2 files changed, 10 insertions, 7 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)
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index 740e740398..23bdf1a932 100644
--- a/tests/test-blockjob.c
+++ b/tests/test-blockjob.c
@@ -116,11 +116,11 @@ static void test_job_ids(void)
job[1] = do_test_id(blk[1], "id0", false);
/* But once job[0] finishes we can reuse its ID */
- block_job_unref(job[0]);
+ block_job_early_fail(job[0]);
job[1] = do_test_id(blk[1], "id0", true);
/* No job ID specified, defaults to the backend name ('drive1') */
- block_job_unref(job[1]);
+ block_job_early_fail(job[1]);
job[1] = do_test_id(blk[1], NULL, true);
/* Duplicate job ID */
@@ -133,9 +133,9 @@ static void test_job_ids(void)
/* This one is valid */
job[2] = do_test_id(blk[2], "id_2", true);
- block_job_unref(job[0]);
- block_job_unref(job[1]);
- block_job_unref(job[2]);
+ block_job_early_fail(job[0]);
+ block_job_early_fail(job[1]);
+ block_job_early_fail(job[2]);
destroy_blk(blk[0]);
destroy_blk(blk[1]);