update test code

Signed-off-by: 王达 <wangda20@huawei.com>
This commit is contained in:
王达 2024-04-08 16:28:24 +08:00
parent 37929fc18c
commit 3a41de58ab

View File

@ -35,7 +35,7 @@
using namespace testing;
using namespace testing::ext;
#define HNP_BASE_PATH "/data/app/el1/bundle/10000"
#define HNP_BASE_PATH "/data/app/el1/bundle/10000/hnp"
#ifdef __cplusplus
extern "C" {
@ -81,14 +81,11 @@ void HnpPackWithoutBin(void)
EXPECT_EQ(mkdir("./hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
char arg1[] = "hnpcli";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "./hnp_out";
char arg5[] = "-name";
char arg6[] = "sample";
char arg7[] = "-v";
char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
char arg3[] = "-i", arg4[] = "./hnp_sample", arg5[] = "-o", arg6[] = "./hnp_out";
char arg7[] = "-n", arg8[] = "sample", arg9[] = "-v", arg10[] = "1.1";
char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
}
@ -112,14 +109,11 @@ void HnpPackWithBin(void)
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
char arg1[] = "hnpcli";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "./hnp_out";
char arg5[] = "-name";
char arg6[] = "sample";
char arg7[] = "-v";
char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
char arg3[] = "-i", arg4[] = "./hnp_sample", arg5[] = "-o", arg6[] = "./hnp_out";
char arg7[] = "-n", arg8[] = "sample", arg9[] = "-v", arg10[] = "1.1";
char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
}
@ -150,22 +144,19 @@ void HnpPackWithCfg(void)
fp = fopen("hnp_sample/bin/out2", "wb");
EXPECT_NE(fp, NULL);
(void)fclose(fp);
fp = fopen("hnp.cfg", "w");
fp = fopen("hnp_sample/hnp.json", "w");
EXPECT_NE(fp, nullptr);
(void)fclose(fp);
char arg1[] = "hnp";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "./hnp_out";
char arg5[] = "-cfg";
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-i", arg4[] = "./hnp_sample", arg5[] = "-o", arg6[] = "./hnp_out";
char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"outt\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
fp = fopen("./hnp.cfg", "w");
fp = fopen("hnp_sample/hnp.json", "w");
whiteLen = fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp);
(void)fclose(fp);
EXPECT_EQ(whiteLen, strlen(cfg) + 1);
@ -183,7 +174,7 @@ void HnpPackWithCfgDelete(void)
EXPECT_EQ(ret, 0);
ret = remove("hnp_sample/bin/out2");
EXPECT_EQ(ret, 0);
ret = remove("hnp.cfg");
ret = remove("hnp_sample/hnp.json");
EXPECT_EQ(ret, 0);
EXPECT_EQ(rmdir("hnp_sample/bin"), 0);
EXPECT_EQ(rmdir("hnp_sample"), 0);
@ -194,11 +185,9 @@ void HnpInstall(void)
{
char arg1[] = "hnp";
char arg2[] = "install";
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000"; char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
@ -208,11 +197,9 @@ void HnpUnInstall(void)
{
char arg1[] = "hnp";
char arg2[] = "uninstall";
char arg3[] = "10000";
char arg4[] = "hnp_sample";
char arg5[] = "1.1";
char arg6[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000"; char arg5[] = "-n"; char arg6[] = "hnp_sample";
char arg7[] = "-v"; char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
@ -221,12 +208,10 @@ void HnpUnInstall(void)
void HnpInstallPrivate(void)
{
char arg1[] = "hnp";
char arg2[] = "uninstall";
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "test";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg2[] = "install";
char arg3[] = "-u"; char arg4[] = "10000"; char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-i"; char arg8[] = HNP_BASE_PATH"/test"; char arg9[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
@ -236,11 +221,9 @@ void HnpUnInstallPrivate(void)
{
char arg1[] = "hnp";
char arg2[] = "uninstall";
char arg3[] = "10000";
char arg4[] = "hnp_sample";
char arg5[] = "1.1";
char arg6[] = "test";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000"; char arg5[] = "-n"; char arg6[] = "hnp_sample";
char arg7[] = "-v"; char arg8[] = "1.1"; char arg9[] = "-i"; char arg10[] = "test";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
@ -275,22 +258,20 @@ HWTEST(HnpInstallerTest, Hnp_Install_001, TestSize.Level0)
char* argv[] = {arg1, arg2};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_ARGV_NUM_INVALID);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_OPERATOR_ARGV_MISS);
}
{ // param uid is invalid
char arg3[] = "asd1231";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "asd1231";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_ARGV_UID_INVALID);
}
{ // ok
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
@ -321,21 +302,19 @@ HWTEST(HnpInstallerTest, Hnp_Install_002, TestSize.Level0)
char arg2[] = "install";
{ // dir exist but force is false
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_PATH_IS_EXIST);
}
{ //ok
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
@ -364,10 +343,9 @@ HWTEST(HnpInstallerTest, Hnp_Install_003, TestSize.Level0)
{ // scr path bin not exist
EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
HnpPackWithoutBin();
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
@ -378,10 +356,9 @@ HWTEST(HnpInstallerTest, Hnp_Install_003, TestSize.Level0)
{ //ok
EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
HnpPackWithBin();
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
@ -416,13 +393,12 @@ HWTEST(HnpInstallerTest, Hnp_Install_004, TestSize.Level0)
EXPECT_NE(fp, NULL);
fwrite(data, sizeof(int), 5, fp);
(void)fclose(fp);
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/example.zip";
char arg7[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_BASE_FILE_READ_FAILED);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_HNP_NAME_FAILED);
remove("./hnp_out/example.zip");
}
{ //src path file is not hnp
@ -431,21 +407,19 @@ HWTEST(HnpInstallerTest, Hnp_Install_004, TestSize.Level0)
EXPECT_NE(fp, NULL);
fwrite(data, sizeof(int), 15, fp);
(void)fclose(fp);
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/example.zip";
char arg7[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_BASE_MAGIC_CHECK_FAILED);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_HNP_NAME_FAILED);
remove("./hnp_out/example.zip");
}
{ //ok
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
@ -475,11 +449,10 @@ HWTEST(HnpInstallerTest, Hnp_Install_005, TestSize.Level0)
char arg2[] = "install";
{ //ok
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/outt", F_OK), 0);
@ -504,21 +477,23 @@ HWTEST(HnpInstallerTest, Hnp_Install_006, TestSize.Level0)
GTEST_LOG_(INFO) << "Hnp_Install_006 start";
EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
HnpPackWithCfg();
char arg1[] = "hnp";
char arg2[] = "install";
{ //ok
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "test";
char arg6[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-i"; char arg8[] = HNP_BASE_PATH"/test";
char arg9[] = "-f";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/hnp/test/bin/outt", F_OK), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/hnp/test/bin/out2", F_OK), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/outt", F_OK), 0);
EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/out2", F_OK), 0);
}
HnpDeleteFolder(HNP_BASE_PATH);
@ -553,28 +528,34 @@ HWTEST(HnpInstallerTest, Hnp_Install_007, TestSize.Level0)
char arg2[] = "install";
{ // src dir path is invalid
char arg3[] = "10000";
char arg4[] = "./hnp_in";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_in/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_REALPATH_FAILED);
}
{ // dst dir path is invalid
char arg3[] = "10001";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10001";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_REALPATH_FAILED);
}
{ // install dir path is invalid
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char arg7[] = "-i"; char arg8[] = "/test";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_REALPATH_FAILED);
}
{ // ok
char arg3[] = "10000";
char arg4[] = "./hnp_out";
char arg5[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-p"; char arg6[] = "./hnp_out/sample.hnp";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
@ -609,24 +590,32 @@ HWTEST(HnpInstallerTest, Hnp_UnInstall_001, TestSize.Level0)
char* argv[] = {arg1, arg2};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_ARGV_NUM_INVALID);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_OPERATOR_ARGV_MISS);
}
{ // param uid is invalid
char arg3[] = "asd1231";
char arg4[] = "sample";
char arg5[] = "1.1";
char arg6[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "asd1231";
char arg5[] = "-n"; char arg6[] = "sample";
char arg7[] = "-v"; char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_INSTALLER_ARGV_UID_INVALID);
}
{ // param uninstall path is invalid
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-n"; char arg6[] = "sample";
char arg7[] = "-v"; char arg8[] = "1.1";
char arg9[] = "-i"; char arg10[] = "/test";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_HNP_PATH_NOT_EXIST);
}
{ // ok
char arg3[] = "10000";
char arg4[] = "sample";
char arg5[] = "1.1";
char arg6[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-n"; char arg6[] = "sample";
char arg7[] = "-v"; char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
@ -650,17 +639,18 @@ HWTEST(HnpInstallerTest, Hnp_UnInstall_002, TestSize.Level0)
GTEST_LOG_(INFO) << "Hnp_UnInstall_002 start";
EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
HnpPackWithCfg();
HnpInstallPrivate();
char arg1[] = "hnp";
char arg2[] = "uninstall";
{ // ok
char arg3[] = "10000";
char arg4[] = "sample";
char arg5[] = "1.1";
char arg6[] = "test";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-n"; char arg6[] = "sample";
char arg7[] = "-v"; char arg8[] = "1.1";
char arg9[] = "-i"; char arg10[] = HNP_BASE_PATH"/test";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
@ -691,31 +681,28 @@ HWTEST(HnpInstallerTest, Hnp_UnInstall_003, TestSize.Level0)
char arg2[] = "uninstall";
{ // param software name is invalid
char arg3[] = "10000";
char arg4[] = "sample2";
char arg5[] = "1.1";
char arg6[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-n"; char arg6[] = "sample2";
char arg7[] = "-v"; char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_HNP_PATH_NOT_EXIST);
}
{ // param software version is invalid
char arg3[] = "10001";
char arg4[] = "sample";
char arg5[] = "1.3";
char arg6[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10001";
char arg5[] = "-n"; char arg6[] = "sample";
char arg7[] = "-v"; char arg8[] = "1.3";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_HNP_PATH_NOT_EXIST);
}
{ // ok
char arg3[] = "10000";
char arg4[] = "sample";
char arg5[] = "1.1";
char arg6[] = "null";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
char arg3[] = "-u"; char arg4[] = "10000";
char arg5[] = "-n"; char arg6[] = "sample";
char arg7[] = "-v"; char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);