#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
+#include <getopt.h>
+#include <unzip.h>
+#include <tzplatform_config.h>
#include <app2ext_interface.h>
#define SUCCESS 0
#define FAIL 1
#define CMD_LEN 256
+#define TEST_PKGNAME "org.example.basicuiapplication"
+#define TEST_PKGNAME_PATH "/tmp/org.example.basicuiapplication-1.0.0-arm.tpk"
app2ext_handle *handle = NULL;
-#define TEST_PKGNAME "org.example.basicuiapplication"
-
char pkg_ro_content_rpm[3][5] = { "bin", "res", "lib" };
-char error_list[45][100] = {
+#define COUNT_OF_ERROR_LIST 50
+char error_list[COUNT_OF_ERROR_LIST][100] = {
"SUCCESS",
- "APP2EXT_ERROR_UNKNOW",
+ "APP2EXT_ERROR_UNKNOWN",
"APP2EXT_ERROR_INVALID_ARGUMENTS",
"APP2EXT_ERROR_MOVE",
"APP2EXT_ERROR_PRE_UNINSTALL",
"APP2EXT_ERROR_DETACH_LOOPBACK_DEVICE",
"APP2EXT_ERROR_ALREADY_MOUNTED",
"APP2EXT_ERROR_PLUGIN_INIT_FAILED",
- "APP2EXT_ERROR_PLUGIN_DEINIT_FAILED"
+ "APP2EXT_ERROR_PLUGIN_DEINIT_FAILED",
+ "APP2EXT_ERROR_DBUS_FAILED",
+ "APP2EXT_ERROR_MEMORY_ALLOC_FAILED",
+ "APP2EXT_ERROR_OPERATION_NOT_PERMITTED",
+ "APP2EXT_ERROR_SAME_LOOPBACK_DEVICE_EXISTS",
+ "APP2EXT_ERROR_PKGMGR_ERROR"
};
-static int __get_integer_input_data(void);
-
-static int __get_integer_input_data(void)
+static void usage(void)
{
- char input_str[32] = { 0, };
- int data = 0;
-
- if (fgets(input_str, 32, stdin) == NULL) {
- printf("Input buffer overflow....\n");
- return -1;
- }
-
- if (sscanf(input_str, "%4d", &data) != 1) {
- printf("Input only integer option....\n");
- return -1;
- }
-
- return data;
+ printf("\n");
+ printf("*************************************************\n");
+ printf("app2sd test usage:\n");
+ printf("pre-condition: /tmp/org.example.basicuiapplication-1.0.0-arm.tpk\n");
+ printf("\n");
+ printf("<INSTALL>\n");
+ printf("1.(at target_user)$test_app2ext --pre-install\n");
+ printf("2.(at target_user)$pkgcmd -it tpk {pkg-path}\n");
+ printf("3.(at target_user)$test_app2ext --post-install\n");
+ printf("------------------------------------------------\n");
+ printf("\n");
+ printf("<UPGRADE>\n");
+ printf("1.(at target_user)$test_app2ext --pre-upgrade\n");
+ printf("2.(at target_user)$pkgcmd -it tpk {pkg-path}\n");
+ printf("3.(at target_user)$test_app2ext --post-upgrade\n");
+ printf("------------------------------------------------\n");
+ printf("\n");
+ printf("<INSTALL>\n");
+ printf("1.(at target_user)$test_app2ext --pre-uninstall\n");
+ printf("2.(at target_user)$pkgcmd -un {pkg-id}\n");
+ printf("3.(at target_user)$test_app2ext --post-uninstall\n");
+ printf("------------------------------------------------\n");
+ printf("\n");
+ printf("<MOVE PKG TEST>\n");
+ printf("(at target_user)$test_app2ext --move\n");
+ printf("------------------------------------------------\n");
+ printf("\n");
+ printf("<GET INSTALLED LOCATION (Ext/Internal)>\n");
+ printf("(at target_user)$test_app2ext --getlocation\n");
+ printf("------------------------------------------------\n");
+ printf("\n");
+ printf("<ENABLE(mount)/DISABLE(umount) TEST W/ Installed PKG>\n");
+ printf("(at target_user)$test_app2ext --enable\n");
+ printf("(at target_user)$test_app2ext --disable\n");
+ printf("------------------------------------------------\n");
+ printf("**************************************************\n");
+ printf("\n");
}
-static void usage(void)
+#define OPTVAL_PRE_INSTALL 1000
+#define OPTVAL_POST_INSTALL 1001
+#define OPTVAL_PRE_UNINSTALL 1002
+#define OPTVAL_POST_UNINSTALL 1003
+#define OPTVAL_PRE_UPGRADE 1004
+#define OPTVAL_POST_UPGRADE 1005
+#define OPTVAL_MOVE 1006
+#define OPTVAL_GET_LOCATION 1007
+#define OPTVAL_ENABLE_APP 1008
+#define OPTVAL_DISABLE_APP 1009
+#define OPTVAL_USAGE 1010
+
+/* Supported options */
+const struct option long_opts[] = {
+ { "pre-install", 0, NULL, OPTVAL_PRE_INSTALL },
+ { "post-install", 0, NULL, OPTVAL_POST_INSTALL },
+ { "pre-uninstall", 0, NULL, OPTVAL_PRE_UNINSTALL },
+ { "post-uninstall", 0, NULL, OPTVAL_POST_UNINSTALL },
+ { "pre-upgrade", 0, NULL, OPTVAL_PRE_UPGRADE },
+ { "post-upgrade", 0, NULL, OPTVAL_POST_UPGRADE },
+ { "move", 0, NULL, OPTVAL_MOVE },
+ { "getlocation", 0, NULL, OPTVAL_GET_LOCATION },
+ { "enable", 0, NULL, OPTVAL_ENABLE_APP },
+ { "disable", 0, NULL, OPTVAL_DISABLE_APP },
+ { "help", 0, NULL, OPTVAL_USAGE },
+ { "usage", 0, NULL, OPTVAL_USAGE },
+ { 0, 0, 0, 0 } /* sentinel */
+};
+
+void clear_dir_list(GList* dir_list)
{
- printf("\n*********************************************\n");
- printf("app2sd test\n");
- printf("test_case\n");
- printf("<1> app_install (pre-install, install, post-install, enable, launch, disable)\n");
- printf("<2> app_uninstall (pre-uninstall, uninstall, post-uninstall)\n");
- printf("<3> app_upgrade (pre-upgrade, upgrade, post-Upgrade)\n");
- printf("<4> app_move\n");
- printf("<5> app_get_location\n");
- printf("<6> enable_external_dir\n");
- printf("<7> disable_external_dir\n");
- printf("<8> exit\n");
+ GList *list = NULL;
+ app2ext_dir_details* dir_detail = NULL;
+
+ if (dir_list) {
+ list = g_list_first(dir_list);
+ while (list) {
+ dir_detail = (app2ext_dir_details *)list->data;
+ if (dir_detail && dir_detail->name) {
+ free(dir_detail->name);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(dir_list);
+ }
}
GList * populate_dir_details()
{
GList *dir_list = NULL;
GList *list = NULL;
- app2ext_dir_details* dir_detail = NULL;
+ app2ext_dir_details *dir_detail = NULL;
int i;
-
- for (i=0; i<3; i++) {
- dir_detail = (app2ext_dir_details*) calloc(1, sizeof(app2ext_dir_details));
+ for (i = 0; i < 3; i++) {
+ dir_detail = (app2ext_dir_details*)calloc(1, sizeof(app2ext_dir_details));
if (dir_detail == NULL) {
- printf("\nMemory allocation failed\n");
+ printf("memory allocation failed\n");
goto FINISH_OFF;
}
- dir_detail->name = (char*) calloc(1, sizeof(char)*(strlen(pkg_ro_content_rpm[i])+2));
+
+ dir_detail->name = (char*)calloc(1, sizeof(char) * (strlen(pkg_ro_content_rpm[i]) + 2));
if (dir_detail->name == NULL) {
- printf("\nMemory allocation failed\n");
+ printf("memory allocation failed\n");
free(dir_detail);
goto FINISH_OFF;
}
- snprintf(dir_detail->name, (strlen(pkg_ro_content_rpm[i])+1), "%s", pkg_ro_content_rpm[i]);
+ snprintf(dir_detail->name, (strlen(pkg_ro_content_rpm[i]) + 1), "%s", pkg_ro_content_rpm[i]);
dir_detail->type = APP2EXT_DIR_RO;
dir_list = g_list_append(dir_list, dir_detail);
}
+
if (dir_list) {
list = g_list_first(dir_list);
while (list) {
list = g_list_next(list);
}
}
+
return dir_list;
+
FINISH_OFF:
- if (dir_list) {
- list = g_list_first(dir_list);
- while (list) {
- dir_detail = (app2ext_dir_details *)list->data;
- if (dir_detail && dir_detail->name) {
- free(dir_detail->name);
- }
- list = g_list_next(list);
- }
- g_list_free(dir_list);
- }
+
+ clear_dir_list(dir_list);
+
return NULL;
}
-void clear_dir_list(GList* dir_list)
+static int get_unzip_size(const char *item, unsigned long long *size)
{
- GList *list = NULL;
- app2ext_dir_details* dir_detail = NULL;
- if (dir_list) {
- list = g_list_first(dir_list);
- while (list) {
- dir_detail = (app2ext_dir_details *)list->data;
- if (dir_detail && dir_detail->name) {
- free(dir_detail->name);
- }
- list = g_list_next(list);
+ if (!item || !size) {
+ printf("get size : invalid argument\n");
+ return -1;
+ }
+ int ret = 0;
+ unzFile uzf = unzOpen64(item);
+ if (uzf == NULL) {
+ printf("get size : failed to open item : [%s]\n", item);
+ *size = 0;
+ return -1;
+ } else {
+ ret = unzGoToFirstFile(uzf);
+ if (ret != UNZ_OK) {
+ printf("get size : error get first zip file\n");
+ unzClose(uzf);
+ *size = 0;
+ return -1;
+ } else {
+ do {
+ ret = unzOpenCurrentFile(uzf);
+ if (ret != UNZ_OK) {
+ printf("get size : error unzOpenCurrentFile\n");
+ unzClose(uzf);
+ *size = 0;
+ return -1;
+ }
+
+ unz_file_info fileInfo = { 0 };
+ char *filename = (char *)calloc(1, 4096);
+ ret = unzGetCurrentFileInfo(uzf, &fileInfo, filename, (4096 - 1), NULL, 0, NULL, 0);
+ *size = (unsigned long long)fileInfo.uncompressed_size + *size;
+ if (ret != UNZ_OK) {
+ printf("get size : error get current file info\n");
+ unzCloseCurrentFile(uzf);
+ *size = 0;
+ break;
+ }
+
+ free(filename);
+ filename = NULL;
+ } while (unzGoToNextFile(uzf) == UNZ_OK);
}
- g_list_free(dir_list);
}
+ unzClose(uzf);
+
+ return 0;
}
-int app_install()
+static void print_error_code(const char *func_name, int ret)
+{
+ if (ret < 0 || ret > COUNT_OF_ERROR_LIST - 1) {
+ printf("%s failed : unknown error(%d)\n", func_name, ret);
+ } else {
+ printf("%s return(%s)\n", func_name, error_list[ret]);
+ }
+}
+
+static int pre_app_install()
{
- printf("app_install %s\n", TEST_PKGNAME);
GList *dir_list = NULL;
int ret = -1;
+ unsigned long long size_byte = 0;
+ int size_mega = 0;
- //char cmd_install[CMD_LEN+1];
- //snprintf(cmd_install, CMD_LEN,"tpk-backend -y %s", TEST_PKGNAME);
+ printf("pre_app_install for [%s]\n", TEST_PKGNAME_PATH);
dir_list = populate_dir_details();
if (dir_list == NULL) {
- printf("Error in populating the directory list\n");
+ printf("error in populating the directory list\n");
return -1;
}
- ret = handle->interface.pre_install(TEST_PKGNAME, dir_list, 20);
- if (ret) {
- printf("pre_install failed(%s)\n", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
+
+ /* size : in MB */
+ ret = get_unzip_size(TEST_PKGNAME_PATH, &size_byte);
+ if (ret < 0 || size_byte == 0) {
+ printf("wrong pkg size, ret(%d), size_byte(%llu)\n", ret, size_byte);
}
+ size_mega = size_byte / (1024 * 1024) + 1;
+ printf("get pkg size : (%d)MB\n", size_mega);
- /*
- printf("\n cmd_install is %s ", cmd_install);
- ret = system(cmd_install);
- if (ret) {
+ ret = handle->interface.client_pre_install(TEST_PKGNAME,
+ dir_list, size_mega);
+ print_error_code(__func__, ret);
- printf("tpk-backend install command fail %d ", ret);
- ret = handle->interface.post_install(TEST_PKGNAME, 1);
- if (ret) {
- printf("post_install failed(%s)\n", error_list[ret]);
- }
- clear_dir_list(dir_list);
- return -1;
- }
- */
+ clear_dir_list(dir_list);
- ret = handle->interface.post_install(TEST_PKGNAME, 2);
- if (ret) {
- printf("post_install failed(%s)\n", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
- }
+ return ret;
+}
- ret = handle->interface.enable(TEST_PKGNAME);
- if (ret) {
- printf("enable failed(%s)\n", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
- }
+static int post_app_install()
+{
+ int ret = -1;
- /*
- printf("\nLaunching application after install");
- ret = aul_open_app(TEST_PKGNAME);
+ ret = handle->interface.client_post_install(TEST_PKGNAME,
+ APP2EXT_STATUS_SUCCESS);
+ print_error_code(__func__, ret);
- if (ret < 0)
- printf("\n launch fail");
- else
- printf("\n application launched");
+ return ret;
+}
- sleep(5);
+static int app_enable()
+{
+ int ret = -1;
- ret = system("killall -9 basicuiapplication");
- if (ret < 0)
- printf("\n app exit fail");
- else
- printf("\n application exited");
+ ret = handle->interface.client_enable(TEST_PKGNAME);
+ print_error_code(__func__, ret);
- sleep(5);
- */
+ return ret;
+}
- ret = handle->interface.disable(TEST_PKGNAME);
- if (ret < 0 || ret > 44) {
- printf("disable failed : unknown error\n");
- } else {
- printf("disable return(%s)\n", error_list[ret]);
- }
+static int app_disable()
+{
+ int ret = -1;
- clear_dir_list(dir_list);
+ ret = handle->interface.client_disable(TEST_PKGNAME);
+ print_error_code(__func__, ret);
return ret;
}
-int app_uninstall()
+static int pre_app_uninstall()
{
- printf("app_uninstall %s\n", TEST_PKGNAME);
int ret = -1;
- //char cmd_uninstall[CMD_LEN+1];
- //snprintf(cmd_uninstall, CMD_LEN, "tpk-backend -y %s", TEST_PKGNAME);
- ret = handle->interface.pre_uninstall(TEST_PKGNAME);
- if (ret) {
- printf("pre_uninstall failed(%s)", error_list[ret]);
- return -1;
- }
+ printf("pre_app_uninstall for [%s]\n", TEST_PKGNAME);
- /*
- printf("\n cmd_uninstall is %s ", cmd_uninstall);
- ret = system(cmd_uninstall);
- if (ret) {
- printf("\nrpm uninstall command fail Reason %s", error_list[ret]);
- return -1;
- }
- */
+ ret = handle->interface.client_pre_uninstall(TEST_PKGNAME);
+ print_error_code(__func__, ret);
- ret = handle->interface.post_uninstall(TEST_PKGNAME);
- if (ret) {
- printf("post app uninstall API fail Reason %s\n", error_list[ret]);
- return -1;
- }
+ return ret;
+}
+
+static int post_app_uninstall()
+{
+ int ret = -1;
+
+ ret = handle->interface.client_post_uninstall(TEST_PKGNAME);
+ print_error_code(__func__, ret);
return ret;
}
-int app_upgrade()
+static int pre_app_upgrade()
{
- printf("app_upgrade %s\n", TEST_PKGNAME);
+ GList *dir_list = NULL;
int ret = -1;
- //char cmd_uninstall[CMD_LEN+1];
- //snprintf(cmd_uninstall, CMD_LEN, "rpm -U %s", TEST_PKGNAME);
+ unsigned long long size_byte = 0;
+ int size_mega = 0;
- GList *dir_list = populate_dir_details();
+ printf("pre_app_upgrade for [%s]\n", TEST_PKGNAME);
+
+ dir_list = populate_dir_details();
if (dir_list == NULL) {
printf("Error in populating the directory list\n");
return -1;
}
- ret = handle->interface.pre_upgrade(TEST_PKGNAME, dir_list, 40);
- if (ret) {
- printf("pre app upgrade API fail. Reason %s\n", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
+ /* size : in MB */
+ ret = get_unzip_size(TEST_PKGNAME_PATH, &size_byte);
+ if (ret < 0 || size_byte == 0) {
+ printf("wrong pkg size, ret(%d), size_byte(%llu)\n", ret, size_byte);
}
+ size_mega = size_byte / (1024 * 1024) + 1;
+ printf("get pkg size : (%d)MB\n", size_mega);
- /*
- printf("\n cmd_uninstall is %s ", cmd_uninstall);
- ret = system(cmd_uninstall);
- if (ret) {
- printf("\nrpm upgrade command fail Reason %s", error_list[ret]);
- ret = handle->interface.post_upgrade(TEST_PKGNAME_RPM, 1);
- if (ret) {
- printf("post app upgrade API fail Reason %s\n", error_list[ret]);
- }
- clear_dir_list(dir_list);
- return -1;
- }
- */
+ ret = handle->interface.client_pre_upgrade(TEST_PKGNAME, dir_list,
+ size_mega);
+ print_error_code(__func__, ret);
- ret = handle->interface.post_upgrade(TEST_PKGNAME, 2);
- if (ret) {
- printf("\n TC : post app upgrade API fail Reason %s", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
- }
clear_dir_list(dir_list);
+
return ret;
}
-int app_move()
+static int post_app_upgrade()
{
- printf("app_move %s\n", TEST_PKGNAME);
+ int ret = -1;
+
+ ret = handle->interface.client_post_upgrade(TEST_PKGNAME,
+ APP2EXT_STATUS_SUCCESS);
+ print_error_code(__func__, ret);
+
+ return ret;
+}
+
+static int app_move()
+{
+ GList *dir_list = NULL;
int ret = -1;
int ret_check = -1;
- GList *dir_list = populate_dir_details();
+
+ printf("app_move %s\n", TEST_PKGNAME);
+
+ dir_list = populate_dir_details();
if (dir_list == NULL) {
- printf("\nError in populating the directory list\n");
+ printf("Error in populating the directory list\n");
return -1;
}
- ret = app2ext_get_app_location(TEST_PKGNAME);
- printf("return value = (%d)", ret);
+ ret = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
+ printf("return value = (%d)\n", ret);
if (ret == APP2EXT_SD_CARD) {
- printf("\n app %s is in sd card ", TEST_PKGNAME);
- printf("\n app %s will be moved to internal memory ",
- TEST_PKGNAME);
- ret = handle->interface.move(TEST_PKGNAME, dir_list, APP2EXT_MOVE_TO_PHONE);
- if (ret) {
- printf("\n TC: move API failed Reason %s", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
- }
- ret = app2ext_get_app_location(TEST_PKGNAME);
+ printf("pkg %s is in sd card\n", TEST_PKGNAME);
+ printf("pkg %s will be moved to internal memory\n", TEST_PKGNAME);
+ ret = handle->interface.client_move(TEST_PKGNAME,
+ dir_list, APP2EXT_MOVE_TO_PHONE);
+ print_error_code(__func__, ret);
+ ret = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
if (ret_check == APP2EXT_INTERNAL_MEM)
- printf("\n app %s is moved to internal memory ",
- TEST_PKGNAME);
+ printf("pkg %s is moved to internal memory\n", TEST_PKGNAME);
} else if (ret == APP2EXT_INTERNAL_MEM) {
- printf("\n app %s is in internal memory ", TEST_PKGNAME);
- printf("\n app %s will be moved to sd card", TEST_PKGNAME);
-
- ret = handle->interface.move(TEST_PKGNAME, dir_list, APP2EXT_MOVE_TO_EXT);
- if (ret) {
- printf("\n TC: move API failed Reason %s", error_list[ret]);
- clear_dir_list(dir_list);
- return -1;
- }
- ret = app2ext_get_app_location(TEST_PKGNAME);
+ printf("pkg %s is in internal memory\n", TEST_PKGNAME);
+ printf("pkg %s will be moved to sd card\n", TEST_PKGNAME);
+ ret = handle->interface.client_move(TEST_PKGNAME,
+ dir_list, APP2EXT_MOVE_TO_EXT);
+ print_error_code(__func__, ret);
+ ret = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
if (ret_check == APP2EXT_SD_CARD)
- printf("\n app %s is moved to sd card ",
- TEST_PKGNAME);
+ printf("pkg %s is moved to sd card\n", TEST_PKGNAME);
} else {
ret = APP2EXT_ERROR_INVALID_PACKAGE;
- printf("\n errorReason %s", error_list[ret]);
- clear_dir_list(dir_list);
- return ret;
+ printf("app_move failed (%s)\n", error_list[ret]);
}
+
clear_dir_list(dir_list);
+
return ret;
}
-void app_get_location()
+static void app_get_location()
{
- printf("app_get_location %s \n", TEST_PKGNAME);
+ printf("app_get_location for pkg(%s)\n", TEST_PKGNAME);
int ret = -1;
- ret = app2ext_get_app_location(TEST_PKGNAME);
+ ret = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
if (ret == APP2EXT_SD_CARD) {
- printf("\n app %s is in sd card ", TEST_PKGNAME);
+ printf("pkg is in sd card\n");
} else if (ret == APP2EXT_INTERNAL_MEM) {
- printf("\n app %s is in internal memory ", TEST_PKGNAME);
+ printf("pkg is in internal memory\n");
} else {
- printf("\napp %s is not installed", TEST_PKGNAME);
- }
-}
-
-void enable_external_dir()
-{
- printf("enable_external_dir\n");
- int ret = -1;
-
- ret = app2ext_enable_external_dir();
- if (ret == 0) {
- printf("\n app2ext_enable_external_dir() success");
- } else {
- printf("\n app2ext_enable_external_dir() failed");
- }
-}
-
-void disable_external_dir()
-{
- printf("disable_external_dir\n");
- int ret = -1;
-
- ret = app2ext_disable_external_dir();
- if (ret == 0) {
- printf("\n app2ext_disable_external_dir() success");
- } else {
- printf("\n app2ext_disable_external_dir() failed");
+ printf("pkg is not installed\n");
}
}
int main(int argc, char **argv)
{
int ret = 0;
-
- /* check authorized user */
+ int opt_idx = 0;
+ int c;
+ uid_t uid = getuid();
+
+ /* check user */
+ if (uid == GLOBAL_USER) {
+ printf("test for global app\n");
+ } else if (uid == OWNER_ROOT) {
+ printf("for root user, a test isn't supproted yet\n");
+ return 0;
+ } else {
+ printf("test for user(%d) app\n", uid);
+ }
handle = app2ext_init(APP2EXT_SD_CARD);
if (handle == NULL) {
return -1;
}
- do {
- usage();
- printf("enter testcase\n");
- int option = __get_integer_input_data();
- switch (option) {
- case 1:
- app_install();
+ /* Parse argv */
+ optind = 1; /* Initialize optind to clear prev. index */
+ while (1) {
+ c = getopt_long(argc, argv, "", long_opts, &opt_idx);
+ if (-1 == c) {
+ usage();
+ break; /* Parse is end */
+ }
+ switch (c) {
+ case OPTVAL_PRE_INSTALL:
+ pre_app_install();
break;
- case 2:
- app_uninstall();
+ case OPTVAL_POST_INSTALL:
+ post_app_install();
break;
- case 3:
- app_upgrade();
+ case OPTVAL_PRE_UNINSTALL:
+ pre_app_uninstall();
break;
- case 4:
+ case OPTVAL_POST_UNINSTALL:
+ post_app_uninstall();
+ break;
+ case OPTVAL_PRE_UPGRADE:
+ pre_app_upgrade();
+ break;
+ case OPTVAL_POST_UPGRADE:
+ post_app_upgrade();
+ break;
+ case OPTVAL_MOVE:
app_move();
break;
- case 5:
+ case OPTVAL_GET_LOCATION:
app_get_location();
break;
- case 6:
- enable_external_dir();
+ case OPTVAL_ENABLE_APP:
+ app_enable();
break;
- case 7:
- disable_external_dir();
+ case OPTVAL_DISABLE_APP:
+ app_disable();
break;
- case 8:
- app2ext_deinit(handle);
- printf("Exit!\n");
- return 0;
+ case OPTVAL_USAGE:
default:
- printf("\nInvalid test id\n");
+ usage();
break;
}
- } while(1);
+
+ break;
+ }
app2ext_deinit(handle);