diff --git a/src/lib/kvmgr.c b/src/lib/kvmgr.c index 05252957..69c76437 100644 --- a/src/lib/kvmgr.c +++ b/src/lib/kvmgr.c @@ -290,7 +290,9 @@ typeinfo_t xkvmgr_type = { .vget_vec = (vget_vec_fn_t)xkvmgr_get_vec, .vput = (vput_fn_t)xkvmgr_put, .vput_vec = (vput_vec_fn_t)xkvmgr_put_vec, - .vclear = (vclear_fn_t)NULL }, + .vclear = (vclear_fn_t)NULL, + .vfreeze = NULL, /* wired in P0-2 */ + .vthaw = NULL /* wired in P0-2 */ }, .iter = &(intf_iterator_t) { .make = (iter_make_fn_t)xkvmgr_make_iter, .next = (iter_next_fn_t)xkvmgr_iter_next, diff --git a/src/lib/meson.build b/src/lib/meson.build index 8503f2ba..1da3de05 100644 --- a/src/lib/meson.build +++ b/src/lib/meson.build @@ -163,6 +163,7 @@ libxce_test_src = ['testsuite/test.c', 'testsuite/test_wobj.c', 'testsuite/test_qobj.c', 'testsuite/test_request.c', + 'testsuite/test_zarray_cow.c', ] libxce_test_deps = [libxce_deps, librtti_dep, unity_dep, libxce_dep] diff --git a/src/lib/testsuite/test.c b/src/lib/testsuite/test.c index 760e5b04..333ce3e0 100644 --- a/src/lib/testsuite/test.c +++ b/src/lib/testsuite/test.c @@ -29,6 +29,7 @@ extern void test_jobobj(void); extern void test_qobj(void); extern void test_wobj(void); extern void test_request(void); +extern void test_zarray_cow(void); void setUp(void) { return; } @@ -127,6 +128,7 @@ int main(int argc, char* argv[]) TEST(test_wobj); TEST(test_qobj); TEST(test_request); + TEST(test_zarray_cow); return UNITY_END(); } diff --git a/src/lib/testsuite/test_zarray_cow.c b/src/lib/testsuite/test_zarray_cow.c new file mode 100644 index 00000000..d6beef6a --- /dev/null +++ b/src/lib/testsuite/test_zarray_cow.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +#include "zarray.h" + +/* xzarray_type is defined in zarray.c */ +extern typeinfo_t xzarray_type; + +static void test_freeze_thaw_slots_exist(void) +{ + /* After P0-0b, intf_varray_t has vfreeze and vthaw slots. + * They are NULL until P0-2 wires the implementations. */ + const intf_varray_t* iface + = (const intf_varray_t*)xzarray_type.interfaces.varray; + + TEST_ASSERT_NOT_NULL(iface); + + /* Access slots without crash — verifies struct layout has them */ + (void)iface->vfreeze; + (void)iface->vthaw; + + /* Slots must be NULL until P0-2 wires the real implementations */ + TEST_ASSERT_NULL(iface->vfreeze); + TEST_ASSERT_NULL(iface->vthaw); + + printf("test_freeze_thaw_slots_exist: PASS\n"); +} + +void test_zarray_cow(void) +{ + printf("\n>> zarray COW interface slot test\n\n"); + RUN_TEST(test_freeze_thaw_slots_exist); +} diff --git a/src/lib/zarray.c b/src/lib/zarray.c index 32133a7f..e6324165 100644 --- a/src/lib/zarray.c +++ b/src/lib/zarray.c @@ -668,7 +668,9 @@ typeinfo_t xzarray_type = { .vget_vec = (vget_vec_fn_t)xzarray_get_vec, .vput = (vput_fn_t)xzarray_put, .vput_vec = (vput_vec_fn_t)xzarray_put_vec, - .vclear = (vclear_fn_t)xzarray_clear }, + .vclear = (vclear_fn_t)xzarray_clear, + .vfreeze = NULL, /* wired in P0-2 */ + .vthaw = NULL /* wired in P0-2 */ }, .iter = &(intf_iterator_t) { .make = (iter_make_fn_t)xzarray_make_iter, .next = (iter_next_fn_t)xzarray_iter_next,