netopeer2
netopeer2 copied to clipboard
Tests doesn't cleanup /dev/shm
After running the test suite, the /dev/shm
is left with files like these:
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-ssh-server.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-subscribed-notifications.operational
-rw------- 1 ondrej ondrej 130 Nov 25 16:17 _tests_np_test_yang_push_ietf-subscribed-notifications.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-tcp-common.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-tcp-common.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-tls-server.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-tls-server.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-truststore.operational
-rw------- 1 ondrej ondrej 59 Nov 25 16:17 _tests_np_test_yang_push_ietf-truststore.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-x509-cert-to-name.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-x509-cert-to-name.running
-rw-r--r-- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-yang-library.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-yang-library.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-yang-push.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_ietf-yang-push.running
-rw-rw-rw- 1 ondrej ondrej 88064 Nov 25 16:17 _tests_np_test_yang_push_main
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_nc-notifications.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_nc-notifications.running
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_notifications.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_notifications.running
-rw-rw-rw- 1 ondrej ondrej 175 Nov 25 16:17 _tests_np_test_yang_pushsub_data_edit1.running
-rw-rw-rw- 1 ondrej ondrej 137 Nov 25 16:17 _tests_np_test_yang_pushsub_data_edit2.running
-rw-rw-rw- 1 ondrej ondrej 24872 Nov 25 16:17 _tests_np_test_yang_pushsub_data_ietf-netconf-nmda.rpc.4464632f
-rw-rw-rw- 1 ondrej ondrej 115 Nov 25 16:17 _tests_np_test_yang_pushsub_data_ietf-subscribed-notifications.rpc.6dc51fb3
-rw-rw-rw- 1 ondrej ondrej 57 Nov 25 16:17 _tests_np_test_yang_pushsub_data_ietf-yang-push.rpc.4bb7766e
-rw-r--r-- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_sysrepo-monitoring.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_sysrepo-monitoring.running
-rw-r--r-- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_sysrepo-plugind.operational
-rw------- 1 ondrej ondrej 69 Nov 25 16:17 _tests_np_test_yang_push_sysrepo-plugind.running
-r--r--r-- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_yang.operational
-rw------- 1 ondrej ondrej 11 Nov 25 16:17 _tests_np_test_yang_push_yang.running
The test suite should cleanup after itself.
Could you use this?
- https://cmake.org/cmake/help/latest/prop_test/FIXTURES_REQUIRED.html
- https://cmake.org/cmake/help/latest/prop_test/FIXTURES_CLEANUP.html
It seems exactly like the thing that should be used to cleanup after the tests (also adding a FIXTURE_SETUP
to start the np_server).
Thanks, I did not think about using mechanisms outside cmocka
before. And even though this is available only in cmake
versions 3.7 and higher, the SHM files should now be properly cleaned after the tests, since you seem to care only about those. The test repositories are kept because they include server log files which are often inspected whether the tests succeed or fail. Also, the way it is now there is full control over the server process and I am not sure it is worth it to rewrite it all (not mentioning distributions with older cmake
would not be able to run the tests), so that will stay it is for now.