This is an automated email from the git hooks/post-receive script.
firstyear pushed a commit to branch master
in repository libsds.
commit 7278fef84170b43aa87161a5b2d19938532d4c8f
Author: William Brown <firstyear(a)redhat.com>
Date: Fri Feb 17 13:51:31 2017 +1000
Make test a bit more correct
---
test/test_sds_cow.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/test/test_sds_cow.c b/test/test_sds_cow.c
index 2868b39..777b1ad 100644
--- a/test/test_sds_cow.c
+++ b/test/test_sds_cow.c
@@ -490,7 +490,8 @@ static void
test_cow_update(void **state) {
sds_bptree_cow_instance *binst = *state;
sds_bptree_transaction *wr_btxn = NULL;
- sds_bptree_transaction *ro_btxn = NULL;
+ sds_bptree_transaction *ro_btxn_a = NULL;
+ sds_bptree_transaction *ro_btxn_b = NULL;
uint64_t result = 0;
@@ -498,22 +499,26 @@ test_cow_update(void **state) {
assert_int_equal(sds_bptree_cow_insert(wr_btxn, (void *)1, (void *)1), SDS_SUCCESS);
assert_int_equal(sds_bptree_cow_wrtxn_commit(&wr_btxn), SDS_SUCCESS);
- assert_int_equal(sds_bptree_cow_rotxn_begin(binst, &ro_btxn), SDS_SUCCESS);
- assert_int_equal(sds_bptree_cow_retrieve(ro_btxn, (void *)1, (void *)&result),
SDS_KEY_PRESENT);
- assert_int_equal(result, 1);
- assert_int_equal(sds_bptree_cow_rotxn_close(&ro_btxn), SDS_SUCCESS);
+ assert_int_equal(sds_bptree_cow_rotxn_begin(binst, &ro_btxn_a), SDS_SUCCESS);
+ /* Don't close yet! */
assert_int_equal(sds_bptree_cow_wrtxn_begin(binst, &wr_btxn), SDS_SUCCESS);
assert_int_equal(sds_bptree_cow_update(wr_btxn, (void *)1, (void *)2), SDS_SUCCESS);
assert_int_equal(sds_bptree_cow_update(wr_btxn, (void *)2, (void *)3), SDS_SUCCESS);
assert_int_equal(sds_bptree_cow_wrtxn_commit(&wr_btxn), SDS_SUCCESS);
- assert_int_equal(sds_bptree_cow_rotxn_begin(binst, &ro_btxn), SDS_SUCCESS);
- assert_int_equal(sds_bptree_cow_retrieve(ro_btxn, (void *)1, (void *)&result),
SDS_KEY_PRESENT);
+ assert_int_equal(sds_bptree_cow_rotxn_begin(binst, &ro_btxn_b), SDS_SUCCESS);
+ assert_int_equal(sds_bptree_cow_retrieve(ro_btxn_b, (void *)1, (void *)&result),
SDS_KEY_PRESENT);
assert_int_equal(result, 2);
- assert_int_equal(sds_bptree_cow_retrieve(ro_btxn, (void *)2, (void *)&result),
SDS_KEY_PRESENT);
+ assert_int_equal(sds_bptree_cow_retrieve(ro_btxn_b, (void *)2, (void *)&result),
SDS_KEY_PRESENT);
assert_int_equal(result, 3);
- assert_int_equal(sds_bptree_cow_rotxn_close(&ro_btxn), SDS_SUCCESS);
+ /* Make sure we didn't affect the previous transaction. */
+ assert_int_equal(sds_bptree_cow_retrieve(ro_btxn_a, (void *)1, (void *)&result),
SDS_KEY_PRESENT);
+ assert_int_equal(result, 1);
+
+ /* Close now */
+ assert_int_equal(sds_bptree_cow_rotxn_close(&ro_btxn_a), SDS_SUCCESS);
+ assert_int_equal(sds_bptree_cow_rotxn_close(&ro_btxn_b), SDS_SUCCESS);
}
int
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.