]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/run_blackbox_tests/test_cases_channel_send.c
Fix __warn_unused_result__, add more of it and fix the resulting warnings.
[meshlink] / test / blackbox / run_blackbox_tests / test_cases_channel_send.c
index 651e16edd0d6da0049d297211e75addd67765ebd..d818a0c7efac8c7589558c4db47d36b932bb0fc0 100644 (file)
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include "execute_tests.h"
 #include "test_cases_channel_send.h"
 #include "../common/containers.h"
@@ -101,6 +105,8 @@ static bool reject_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint
 }
 
 static bool accept_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint16_t port, const void *data, size_t len) {
+       (void)data;
+
        assert(port == 7);
        assert(!len);
 
@@ -111,6 +117,9 @@ static bool accept_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint
 
 /* channel receive callback */
 static void receive_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, const void *dat, size_t len) {
+       (void)mesh;
+       (void)channel;
+
        if(len == 5 && !memcmp(dat, "Hello", 5)) {
                pthread_mutex_lock(& bar_responded_lock);
                bar_responded = true;
@@ -133,8 +142,8 @@ static void poll_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, size_t
 /* Test Steps for meshlink_channel_send Test Case # 1*/
 static bool test_steps_mesh_channel_send_01(void) {
        struct timespec timeout = {0};
-       meshlink_destroy("chan_send_conf.1");
-       meshlink_destroy("chan_send_conf.2");
+       assert(meshlink_destroy("chan_send_conf.1"));
+       assert(meshlink_destroy("chan_send_conf.2"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh1 = meshlink_open("chan_send_conf.1", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -207,8 +216,8 @@ static bool test_steps_mesh_channel_send_01(void) {
 
        meshlink_close(mesh2);
        meshlink_close(mesh1);
-       meshlink_destroy("chan_send_conf.1");
-       meshlink_destroy("chan_send_conf.2");
+       assert(meshlink_destroy("chan_send_conf.1"));
+       assert(meshlink_destroy("chan_send_conf.2"));
 
        return true;
 }
@@ -221,7 +230,7 @@ static void test_case_mesh_channel_send_02(void **state) {
 /* Test Steps for meshlink_channel_send Test Case # 2*/
 static bool test_steps_mesh_channel_send_02(void) {
        struct timespec timeout = {0};
-       meshlink_destroy("chan_send_conf.5");
+       assert(meshlink_destroy("chan_send_conf.5"));
 
        // Open new meshlink instance.
 
@@ -256,7 +265,7 @@ static bool test_steps_mesh_channel_send_02(void) {
        // Clean up.
 
        meshlink_close(mesh1);
-       meshlink_destroy("chan_send_conf.5");
+       assert(meshlink_destroy("chan_send_conf.5"));
 
        return true;
 }
@@ -268,8 +277,7 @@ static void test_case_mesh_channel_send_03(void **state) {
 
 /* Test Steps for meshlink_channel_send Test Case # 3*/
 static bool test_steps_mesh_channel_send_03(void) {
-       struct timespec timeout = {0};
-       meshlink_destroy("chan_send_conf.7");
+       assert(meshlink_destroy("chan_send_conf.7"));
        // Open new meshlink instance.
 
        meshlink_handle_t *mesh1 = meshlink_open("chan_send_conf.7", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -287,7 +295,7 @@ static bool test_steps_mesh_channel_send_03(void) {
        // Clean up.
 
        meshlink_close(mesh1);
-       meshlink_destroy("chan_send_conf.7");
+       assert(meshlink_destroy("chan_send_conf.7"));
 
        return true;
 }
@@ -300,7 +308,7 @@ static void test_case_mesh_channel_send_04(void **state) {
 /* Test Steps for meshlink_channel_send Test Case # 4*/
 static bool test_steps_mesh_channel_send_04(void) {
        struct timespec timeout = {0};
-       meshlink_destroy("chan_send_conf.9");
+       assert(meshlink_destroy("chan_send_conf.9"));
        // Open two new meshlink instance.
 
        meshlink_handle_t *mesh1 = meshlink_open("chan_send_conf.9", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -334,7 +342,7 @@ static bool test_steps_mesh_channel_send_04(void) {
        // Clean up.
 
        meshlink_close(mesh1);
-       meshlink_destroy("chan_send_conf.9");
+       assert(meshlink_destroy("chan_send_conf.9"));
 
        return true;
 }