51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
#include "execute_tests.h"
#include "test_cases_whitelist.h"
#include "../common/containers.h"
static void receive(meshlink_handle_t *mesh, meshlink_node_t *src, const void *data, size_t len) {
- const char *msg = data;
+ (void)mesh;
+ (void)src;
+ (void)data;
+
assert(len);
pthread_mutex_lock(& lock_receive);
}
static void status_cb(meshlink_handle_t *mesh, meshlink_node_t *node, bool reach) {
+ (void)mesh;
+
if(!strcmp(node->name, "bar")) {
pthread_mutex_lock(&reachable_lock);
reachable = reach;
// Open two new meshlink instance.
- meshlink_destroy("whitelist_conf.1");
- meshlink_destroy("whitelist_conf.2");
+ assert(meshlink_destroy("whitelist_conf.1"));
+ assert(meshlink_destroy("whitelist_conf.2"));
meshlink_handle_t *mesh1 = meshlink_open("whitelist_conf.1", "foo", "test", DEV_CLASS_BACKBONE);
assert(mesh1);
meshlink_set_log_cb(mesh1, MESHLINK_DEBUG, meshlink_callback_logger);
pthread_mutex_unlock(& lock_receive);
- meshlink_blacklist(mesh1, foo);
+ assert(meshlink_blacklist(mesh1, foo));
rec_stat = false;
assert(meshlink_send(mesh1, bar, "test", 5));
}
pthread_mutex_unlock(& lock_receive);
- meshlink_whitelist(mesh1, foo);
+ assert(meshlink_whitelist(mesh1, foo));
rec_stat = false;
bool result = meshlink_send(mesh2, foo, "test", 5);
meshlink_close(mesh2);
meshlink_close(mesh1);
- meshlink_destroy("whitelist_conf.1");
- meshlink_destroy("whitelist_conf.2");
+ assert(meshlink_destroy("whitelist_conf.1"));
+ assert(meshlink_destroy("whitelist_conf.2"));
return result;
}
// Open two new meshlink instance.
- meshlink_destroy("whitelist_conf.3");
- meshlink_destroy("whitelist_conf.4");
+ assert(meshlink_destroy("whitelist_conf.3"));
+ assert(meshlink_destroy("whitelist_conf.4"));
meshlink_handle_t *mesh1 = meshlink_open("whitelist_conf.3", "foo", "test", DEV_CLASS_BACKBONE);
assert(mesh1);
meshlink_handle_t *mesh2 = meshlink_open("whitelist_conf.4", "bar", "test", DEV_CLASS_BACKBONE);
assert(meshlink_send(mesh1, bar, "test", 5));
- meshlink_blacklist(mesh1, foo);
+ assert(meshlink_blacklist(mesh1, foo));
// Passing NULL as mesh handle but with valid node handle 'foo'
- meshlink_whitelist(NULL, foo);
+ assert(!meshlink_whitelist(NULL, foo));
assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
// Clean up.
meshlink_close(mesh2);
meshlink_close(mesh1);
- meshlink_destroy("whitelist_conf.3");
- meshlink_destroy("whitelist_conf.4");
+ assert(meshlink_destroy("whitelist_conf.3"));
+ assert(meshlink_destroy("whitelist_conf.4"));
return true;
}
static bool test_steps_mesh_whitelist_03(void) {
// Open meshlink instance.
- meshlink_destroy("whitelist_conf");
+ assert(meshlink_destroy("whitelist_conf"));
meshlink_handle_t *mesh = meshlink_open("whitelist_conf", "foo", "test", DEV_CLASS_BACKBONE);
assert(mesh);
// Start instance
assert(meshlink_start(mesh));
- meshlink_whitelist(mesh, NULL);
+ assert(!meshlink_whitelist(mesh, NULL));
assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
// Clean up.
meshlink_close(mesh);
- meshlink_destroy("whitelist_conf");
+ assert(meshlink_destroy("whitelist_conf"));
return true;
}