Rewrite some old tests (add_rem_dev, copy_proxy) to catch2

Rewrite those simple tests, and add a test to check that get_adm_device do not return a nullptr.

For the second part it is not the case and a bug IMHO, so now we have a test and a fix. The fix is more or less to have a lazy init of the inner pointer to the admin device in get_adm_device but with some implications.

The behavior is changed. Before a call to get_adm_device would get the internal pointer to the admin device, now we get a copy, thus preventing a client calling delete on the pointer to mess up the inner pointer. It's a bit annoying, as previously it meant than the memory was managed by the lib, while now it should be done by the client, but it looks like a clearer contract to me when returning a raw pointer.

Internally it doesn't change much, expect that LockerThread held this pointer, now they have copies. Not sure how much of an impact this has, we could replace the pointer with a reference if this is a concern. I feel there are better ways to achieve what's done by this LockerThread anyway, so I didn't spent much time looking into it.

Merge request reports

Loading