aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2017-05-30 14:14:48 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-05-30 14:14:48 +0100
commit7b6badb6a93956e83135a9b7017997cad6ea7faf (patch)
tree86898dc7c205ac9ff2facf30a61656f1a97106e3 /tests
parent5bb0d22cb41a366efff662d45bec26ab343b5532 (diff)
parent223a23c198787328ae75bc65d84edf5fde33c0b6 (diff)
Merge remote-tracking branch 'jtc/tags/block-pull-request' into staging
# gpg: Signature made Fri 26 May 2017 08:22:27 PM BST # gpg: using RSA key 0xBDBE7B27C0DE3057 # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>" # gpg: aka "Jeffrey Cody <jeff@codyprime.org>" # gpg: aka "Jeffrey Cody <codyprime@gmail.com>" # Primary key fingerprint: 9957 4B4D 3474 90E7 9D98 D624 BDBE 7B27 C0DE 3057 * jtc/tags/block-pull-request: block/gluster: glfs_lseek() workaround blockjob: use deferred_to_main_loop to indicate the coroutine has ended blockjob: reorganize block_job_completed_txn_abort blockjob: strengthen a bit test-blockjob-txn blockjob: group BlockJob transaction functions together blockjob: introduce block_job_cancel_async, check iostatus invariants blockjob: move iostatus reset inside block_job_user_resume blockjob: separate monitor and blockjob APIs blockjob: introduce block_job_pause/resume_all blockjob: introduce block_job_early_fail blockjob: remove iostatus_reset callback blockjob: remove unnecessary check Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
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]);