Implement test case for 'device' category
authorsaerome.kim <saerome.kim@samsung.com>
Mon, 6 Mar 2017 12:52:56 +0000 (21:52 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:09:10 +0000 (11:09 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
test/mesh_device.c

index a6e2c0f..c6377c9 100644 (file)
@@ -30,8 +30,6 @@
 extern mesh_h mesh;
 extern void event_cb(mesh_event_e event_type, void* param);
 
-static char data_mesh_interface[MENU_DATA_SIZE + 1] = "mesh0";
-
 static int run_mesh_create(MManager *mm, struct menu_data *menu)
 {
        int ret;
@@ -92,16 +90,37 @@ static int run_mesh_disable(MManager *mm, struct menu_data *menu)
        return RET_SUCCESS;
 }
 
-static struct menu_data menu_mesh_enable[] = {
-       { "1", "interface", NULL, NULL, data_mesh_interface },
-       { "2", "enable", NULL, run_mesh_enable, NULL },
+static char mesh_interface[MENU_DATA_SIZE + 1] = "wlan0";
+static char gate_interface[MENU_DATA_SIZE + 1] = "eth0";
+static char softap_interface[MENU_DATA_SIZE + 1] = "wlan1";
+static int run_mesh_set_interface(MManager *mm, struct menu_data *menu)
+{
+       int ret;
+       msg("set_interfaces");
+
+       ret = mesh_set_interface(mesh, mesh_interface, gate_interface, softap_interface);
+       if (ret != 0) {
+               msg("Failed to set interface: [%s(0x%X)]",
+                               mesh_error_to_string(ret), ret);
+               return RET_FAILURE;
+       }
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data menu_mesh_interface[] = {
+       { "1", "mesh", NULL, NULL, mesh_interface },
+       { "2", "gate", NULL, NULL, gate_interface },
+       { "3", "softap", NULL, NULL, softap_interface },
+       { "4", "run", NULL, run_mesh_set_interface, NULL },
        { NULL, NULL, },
 };
 
 struct menu_data menu_mesh_device[] = {
-       { "1", "create", NULL, run_mesh_create, NULL },
-       { "2", "destroy", NULL, run_mesh_destroy, NULL },
-       { "3", "enable", menu_mesh_enable, NULL, NULL },
+       { "1", "initialize", NULL, run_mesh_create, NULL },
+       { "2", "deinitialize", NULL, run_mesh_destroy, NULL },
+       { "3", "enable", NULL, run_mesh_enable, NULL },
        { "4", "disable", NULL, run_mesh_disable, NULL },
+       { "5", "set_inteface", menu_mesh_interface, NULL, NULL},
        { NULL, NULL, },
 };