| 209 | } |
| 210 | |
| 211 | void test_reftable_stack__uptodate(void) |
| 212 | { |
| 213 | struct reftable_write_options opts = { 0 }; |
| 214 | struct reftable_stack *st1 = NULL; |
| 215 | struct reftable_stack *st2 = NULL; |
| 216 | char *dir = get_tmp_dir(__LINE__); |
| 217 | |
| 218 | struct reftable_ref_record ref1 = { |
| 219 | .refname = (char *) "HEAD", |
| 220 | .update_index = 1, |
| 221 | .value_type = REFTABLE_REF_SYMREF, |
| 222 | .value.symref = (char *) "master", |
| 223 | }; |
| 224 | struct reftable_ref_record ref2 = { |
| 225 | .refname = (char *) "branch2", |
| 226 | .update_index = 2, |
| 227 | .value_type = REFTABLE_REF_SYMREF, |
| 228 | .value.symref = (char *) "master", |
| 229 | }; |
| 230 | |
| 231 | |
| 232 | /* simulate multi-process access to the same stack |
| 233 | by creating two stacks for the same directory. |
| 234 | */ |
| 235 | cl_assert_equal_i(reftable_new_stack(&st1, dir, &opts), 0); |
| 236 | cl_assert_equal_i(reftable_new_stack(&st2, dir, &opts), 0); |
| 237 | cl_assert_equal_i(reftable_stack_add(st1, write_test_ref, |
| 238 | &ref1, 0), 0); |
| 239 | cl_assert_equal_i(reftable_stack_add(st2, write_test_ref, |
| 240 | &ref2, 0), REFTABLE_OUTDATED_ERROR); |
| 241 | cl_assert_equal_i(reftable_stack_reload(st2), 0); |
| 242 | cl_assert_equal_i(reftable_stack_add(st2, write_test_ref, |
| 243 | &ref2, 0), 0); |
| 244 | reftable_stack_destroy(st1); |
| 245 | reftable_stack_destroy(st2); |
| 246 | clear_dir(dir); |
| 247 | } |
| 248 | |
| 249 | void test_reftable_stack__transaction_api(void) |
| 250 | { |
nothing calls this directly
no test coverage detected