• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include <cerrno>
19 #include <climits>
20 #include <cstdlib>
21 #include <cstring>
22 #include <memory>
23 #include <string>
24 #include <sys/stat.h>
25 #include <sys/types.h>
26 #include <unistd.h>
27 #include <cstdio>
28 #include <cerrno>
29 
30 #include "appspawn_utils.h"
31 #include "hnp_base.h"
32 #include "hnp_pack.h"
33 #include "hnp_installer.h"
34 #include "hnp_api.h"
35 #include "securec.h"
36 
37 using namespace testing;
38 using namespace testing::ext;
39 
40 #define HNP_UID_PATH "/data/app/el1/bundle/10000"
41 #define HNP_BASE_PATH "/data/app/el1/bundle/10000/hnp"
42 
43 #ifdef __cplusplus
44     extern "C" {
45 #endif
46 
47 
48 #ifdef __cplusplus
49     }
50 #endif
51 
52 namespace OHOS {
53 class HnpInstallerTest : public testing::Test {
54 public:
55     static void SetUpTestCase();
56     static void TearDownTestCase();
57     void SetUp();
58     void TearDown();
59 };
60 
SetUpTestCase()61 void HnpInstallerTest::SetUpTestCase()
62 {
63     GTEST_LOG_(INFO) << "Hnp_Installer_TEST SetUpTestCase";
64 }
65 
TearDownTestCase()66 void HnpInstallerTest::TearDownTestCase()
67 {
68     GTEST_LOG_(INFO) << "Hnp_Installer_TEST TearDownTestCase";
69 }
70 
SetUp()71 void HnpInstallerTest::SetUp()
72 {
73     GTEST_LOG_(INFO) << "Hnp_Installer_TEST SetUp";
74 }
75 
TearDown()76 void HnpInstallerTest::TearDown()
77 {
78     GTEST_LOG_(INFO) << "Hnp_Installer_TEST TearDown";
79 }
80 
HnpPackWithoutBin(void)81 void HnpPackWithoutBin(void)
82 {
83     EXPECT_EQ(mkdir("./hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
84     EXPECT_EQ(mkdir("./hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
85     char arg1[] = "hnpcli";
86     char arg2[] = "pack";
87     char arg3[] = "-i";
88     char arg4[] = "./hnp_sample";
89     char arg5[] = "-o";
90     char arg6[] = "./hnp_out";
91     char arg7[] = "-n";
92     char arg8[] = "sample";
93     char arg9[] = "-v";
94     char arg10[] = "1.1";
95     char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
96     int argc = sizeof(argv) / sizeof(argv[0]);
97 
98     EXPECT_EQ(HnpCmdPack(argc, argv), 0);
99 }
100 
HnpPackWithoutBinDelete(void)101 void HnpPackWithoutBinDelete(void)
102 {
103     int ret;
104 
105     ret = remove("hnp_out/sample.hnp");
106     EXPECT_EQ(ret, 0);
107     EXPECT_EQ(rmdir("hnp_sample"), 0);
108     EXPECT_EQ(rmdir("hnp_out"), 0);
109 }
110 
HnpPackWithBin(void)111 void HnpPackWithBin(void)
112 {
113     EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
114     EXPECT_EQ(mkdir("hnp_sample/bin", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
115     FILE *fp = fopen("hnp_sample/bin/out", "wb");
116     EXPECT_NE(fp, nullptr);
117     (void)fclose(fp);
118     EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
119     char arg1[] = "hnpcli";
120     char arg2[] = "pack";
121     char arg3[] = "-i";
122     char arg4[] = "./hnp_sample";
123     char arg5[] = "-o";
124     char arg6[] = "./hnp_out";
125     char arg7[] = "-n";
126     char arg8[] = "sample";
127     char arg9[] = "-v";
128     char arg10[] = "1.1";
129     char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
130     int argc = sizeof(argv) / sizeof(argv[0]);
131 
132     EXPECT_EQ(HnpCmdPack(argc, argv), 0);
133 }
134 
HnpPackWithBinDelete(void)135 void HnpPackWithBinDelete(void)
136 {
137     int ret;
138 
139     ret = remove("hnp_out/sample.hnp");
140     EXPECT_EQ(ret, 0);
141     ret = remove("hnp_sample/bin/out");
142     EXPECT_EQ(ret, 0);
143     EXPECT_EQ(rmdir("hnp_sample/bin"), 0);
144     EXPECT_EQ(rmdir("hnp_sample"), 0);
145     EXPECT_EQ(rmdir("hnp_out"), 0);
146 }
147 
HnpPackWithSimple2Bin(void)148 void HnpPackWithSimple2Bin(void)
149 {
150     EXPECT_EQ(mkdir("hnp_sample2", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
151     EXPECT_EQ(mkdir("hnp_sample2/bin", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
152     FILE *fp = fopen("hnp_sample2/bin/out", "wb");
153     EXPECT_NE(fp, nullptr);
154     (void)fclose(fp);
155     EXPECT_EQ(mkdir("hnp_out2", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
156     char arg1[] = "hnpcli";
157     char arg2[] = "pack";
158     char arg3[] = "-i";
159     char arg4[] = "./hnp_sample2";
160     char arg5[] = "-o";
161     char arg6[] = "./hnp_out2";
162     char arg7[] = "-n";
163     char arg8[] = "sample2";
164     char arg9[] = "-v";
165     char arg10[] = "1.1";
166     char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
167     int argc = sizeof(argv) / sizeof(argv[0]);
168 
169     EXPECT_EQ(HnpCmdPack(argc, argv), 0);
170 }
171 
HnpPackWithBinSimple2Delete(void)172 void HnpPackWithBinSimple2Delete(void)
173 {
174     int ret;
175 
176     ret = remove("hnp_out2/sample2.hnp");
177     EXPECT_EQ(ret, 0);
178     ret = remove("hnp_sample2/bin/out");
179     EXPECT_EQ(ret, 0);
180     EXPECT_EQ(rmdir("hnp_sample2/bin"), 0);
181     EXPECT_EQ(rmdir("hnp_sample2"), 0);
182     EXPECT_EQ(rmdir("hnp_out2"), 0);
183 }
184 
HnpPackWithCfg(void)185 void HnpPackWithCfg(void)
186 {
187     FILE *fp;
188     int whitelen;
189 
190     EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
191     EXPECT_EQ(mkdir("hnp_sample/bin", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
192     EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
193     fp = fopen("hnp_sample/bin/out", "wb");
194     EXPECT_NE(fp, NULL);
195     (void)fclose(fp);
196     fp = fopen("hnp_sample/bin/out2", "wb");
197     EXPECT_NE(fp, NULL);
198     (void)fclose(fp);
199     fp = fopen("hnp_sample/hnp.json", "w");
200     EXPECT_NE(fp, nullptr);
201     (void)fclose(fp);
202 
203     char arg1[] = "hnp";
204     char arg2[] = "pack";
205     char arg3[] = "-i";
206     char arg4[] = "./hnp_sample";
207     char arg5[] = "-o";
208     char arg6[] = "./hnp_out";
209     char *argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
210     int argc = sizeof(argv) / sizeof(argv[0]);
211     char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
212         "{\"links\":[{\"source\":\"bin/out\",\"target\":\"outt\"},{\"source\":\"bin/out2\","
213         "\"target\":\"out2\"}]}}";
214     fp = fopen("hnp_sample/hnp.json", "w");
215     whitelen = fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp);
216     (void)fclose(fp);
217     EXPECT_EQ(whitelen, strlen(cfg) + 1);
218 
219     EXPECT_EQ(HnpCmdPack(argc, argv), 0);
220 }
221 
HnpPackWithCfgDelete(void)222 void HnpPackWithCfgDelete(void)
223 {
224     int ret;
225 
226     ret = remove("hnp_out/sample.hnp");
227     EXPECT_EQ(ret, 0);
228     ret = remove("hnp_sample/bin/out");
229     EXPECT_EQ(ret, 0);
230     ret = remove("hnp_sample/bin/out2");
231     EXPECT_EQ(ret, 0);
232     ret = remove("hnp_sample/hnp.json");
233     EXPECT_EQ(ret, 0);
234     EXPECT_EQ(rmdir("hnp_sample/bin"), 0);
235     EXPECT_EQ(rmdir("hnp_sample"), 0);
236     EXPECT_EQ(rmdir("hnp_out"), 0);
237 }
238 
HnpInstall(void)239 void HnpInstall(void)
240 {
241     char arg1[] = "hnp";
242     char arg2[] = "install";
243     char arg3[] = "-u";
244     char arg4[] = "10000";
245     char arg5[] = "-p";
246     char arg6[] = "./hnp_out/sample.hnp";
247     char arg7[] = "-f";
248     char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
249     int argc = sizeof(argv) / sizeof(argv[0]);
250 
251     EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
252 }
253 
HnpUnInstall(void)254 void HnpUnInstall(void)
255 {
256     char arg1[] = "hnp";
257     char arg2[] = "uninstall";
258     char arg3[] = "-u";
259     char arg4[] = "10000";
260     char arg5[] = "-n";
261     char arg6[] = "hnp_sample";
262     char arg7[] = "-v";
263     char arg8[] = "1.1";
264     char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
265     int argc = sizeof(argv) / sizeof(argv[0]);
266 
267     EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
268 }
269 
HnpInstallPrivate(void)270 void HnpInstallPrivate(void)
271 {
272     char arg1[] = "hnp";
273     char arg2[] = "install";
274     char arg3[] = "-u";
275     char arg4[] = "10000";
276     char arg5[] = "-p";
277     char arg6[] = "./hnp_out/sample.hnp";
278     char arg7[] = "-i";
279     char arg8[] = HNP_BASE_PATH"/test";
280     char arg9[] = "-f";
281     char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9};
282     int argc = sizeof(argv) / sizeof(argv[0]);
283 
284     EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
285 }
286 
HnpUnInstallPrivate(void)287 void HnpUnInstallPrivate(void)
288 {
289     char arg1[] = "hnp";
290     char arg2[] = "uninstall";
291     char arg3[] = "-u";
292     char arg4[] = "10000";
293     char arg5[] = "-n";
294     char arg6[] = "hnp_sample";
295     char arg7[] = "-v";
296     char arg8[] = "1.1";
297     char arg9[] = "-i";
298     char arg10[] = "test";
299     char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
300     int argc = sizeof(argv) / sizeof(argv[0]);
301 
302     EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
303 }
304 
305 /**
306 * @tc.name: Hnp_Install_001
307 * @tc.desc:  Verify set Arg if HnpCmdInstall succeed.
308 * @tc.type: FUNC
309 * @tc.require:issueI9BU5F
310 * @tc.author:
311 */
312 HWTEST(HnpInstallerTest, Hnp_Install_001, TestSize.Level0)
313 {
314     GTEST_LOG_(INFO) << "Hnp_Installer_001 start";
315 
316     // clear resource before test
317     remove("hnp_out/sample.hnp");
318     remove("hnp_sample/bin/out");
319     rmdir("hnp_sample/bin");
320     rmdir("hnp_sample");
321     rmdir("hnp_out");
322     HnpDeleteFolder(HNP_BASE_PATH);
323 
324     HnpCreateFolder(HNP_UID_PATH);
325     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
326     HnpPackWithBin();
327 
328     char arg1[] = "hnp";
329     char arg2[] = "install";
330 
331     { // param num not enough
332         char* argv[] = {arg1, arg2};
333         int argc = sizeof(argv) / sizeof(argv[0]);
334 
335         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_OPERATOR_ARGV_MISS);
336     }
337     { // param uid is invalid
338         char arg3[] = "-u";
339         char arg4[] = "asd1231";
340         char arg5[] = "-p";
341         char arg6[] = "./hnp_out/sample.hnp";
342         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
343         int argc = sizeof(argv) / sizeof(argv[0]);
344 
345         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_ARGV_UID_INVALID);
346     }
347     { // ok
348         char arg3[] = "-u";
349         char arg4[] = "10000";
350         char arg5[] = "-p";
351         char arg6[] = "./hnp_out/sample.hnp";
352         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
353         int argc = sizeof(argv) / sizeof(argv[0]);
354 
355         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
356         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
357     }
358 
359     HnpDeleteFolder(HNP_BASE_PATH);
360     HnpDeleteFolder(HNP_UID_PATH);
361     HnpPackWithBinDelete();
362 
363     GTEST_LOG_(INFO) << "Hnp_Installer_001 end";
364 }
365 
366 /**
367 * @tc.name: Hnp_Install_002
368 * @tc.desc:  Verify install path get if HnpCmdInstall succeed.
369 * @tc.type: FUNC
370 * @tc.require:issueI9BU5F
371 * @tc.author:
372 */
373 HWTEST(HnpInstallerTest, Hnp_Install_002, TestSize.Level0)
374 {
375     GTEST_LOG_(INFO) << "Hnp_Installer_002 start";
376 
377     HnpCreateFolder(HNP_UID_PATH);
378     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
379     HnpPackWithBin();
380 
381     char arg1[] = "hnp";
382     char arg2[] = "install";
383 
384     { // dir exist but force is false
385         char arg3[] = "-u";
386         char arg4[] = "10000";
387         char arg5[] = "-p";
388         char arg6[] = "./hnp_out/sample.hnp";
389         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
390         int argc = sizeof(argv) / sizeof(argv[0]);
391 
392         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
393         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_PATH_IS_EXIST);
394     }
395     { //ok
396         char arg3[] = "-u";
397         char arg4[] = "10000";
398         char arg5[] = "-p";
399         char arg6[] = "./hnp_out/sample.hnp";
400         char arg7[] = "-f";
401         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
402         int argc = sizeof(argv) / sizeof(argv[0]);
403         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
404         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
405     }
406 
407     HnpDeleteFolder(HNP_BASE_PATH);
408     HnpDeleteFolder(HNP_UID_PATH);
409     HnpPackWithBinDelete();
410 
411     GTEST_LOG_(INFO) << "Hnp_Installer_002 end";
412 }
413 
414 /**
415 * @tc.name: Hnp_Install_003
416 * @tc.desc:  Verify scr path bin not exist HnpCmdInstall succeed.
417 * @tc.type: FUNC
418 * @tc.require:issueI9BU5F
419 * @tc.author:
420 */
421 HWTEST(HnpInstallerTest, Hnp_Install_003, TestSize.Level0)
422 {
423     GTEST_LOG_(INFO) << "Hnp_Installer_003 start";
424 
425     char arg1[] = "hnp";
426     char arg2[] = "install";
427     HnpCreateFolder(HNP_UID_PATH);
428 
429     { // scr path bin not exist
430         EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
431         HnpPackWithoutBin();
432         char arg3[] = "-u";
433         char arg4[] = "10000";
434         char arg5[] = "-p";
435         char arg6[] = "./hnp_out/sample.hnp";
436         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
437         int argc = sizeof(argv) / sizeof(argv[0]);
438 
439         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
440         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), -1);
441         HnpPackWithoutBinDelete();
442         HnpDeleteFolder(HNP_BASE_PATH);
443     }
444     { //ok
445         EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
446         HnpPackWithBin();
447         char arg3[] = "-u";
448         char arg4[] = "10000";
449         char arg5[] = "-p";
450         char arg6[] = "./hnp_out/sample.hnp";
451         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
452         int argc = sizeof(argv) / sizeof(argv[0]);
453 
454         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
455         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
456         HnpPackWithBinDelete();
457     }
458     HnpDeleteFolder(HNP_BASE_PATH);
459     HnpDeleteFolder(HNP_UID_PATH);
460 
461     GTEST_LOG_(INFO) << "Hnp_Installer_003 end";
462 }
463 
464 /**
465 * @tc.name: Hnp_Install_004
466 * @tc.desc:  Verify src path file is not hnp cli generate if HnpCmdInstall succeed.
467 * @tc.type: FUNC
468 * @tc.require:issueI9BU5F
469 * @tc.author:
470 */
471 HWTEST(HnpInstallerTest, Hnp_Install_004, TestSize.Level0)
472 {
473     GTEST_LOG_(INFO) << "Hnp_Installer_004 start";
474 
475     HnpCreateFolder(HNP_UID_PATH);
476     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
477     HnpPackWithBin();
478 
479     char arg1[] = "hnp";
480     char arg2[] = "install";
481 
482     { //src path file is not hnp
483         FILE *fp = fopen("./hnp_out/example.zip", "wb");
484         int data[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
485         EXPECT_NE(fp, NULL);
486         fwrite(data, sizeof(int), 15, fp);
487         (void)fclose(fp);
488         char arg3[] = "-u";
489         char arg4[] = "10000";
490         char arg5[] = "-p";
491         char arg6[] = "./hnp_out/example.zip";
492         char arg7[] = "-f";
493         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
494         int argc = sizeof(argv) / sizeof(argv[0]);
495         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_HNP_NAME_FAILED);
496         remove("./hnp_out/example.zip");
497     }
498     { // install dir path is invalid
499         char arg3[] = "-u";
500         char arg4[] = "10000";
501         char arg5[] = "-p";
502         char arg6[] = "./hnp_out/sample.hnp";
503         char arg7[] = "-i";
504         char arg8[] = "/test";
505         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
506         int argc = sizeof(argv) / sizeof(argv[0]);
507 
508         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_REALPATH_FAILED);
509     }
510     { //ok
511         char arg3[] = "-u";
512         char arg4[] = "10000";
513         char arg5[] = "-p";
514         char arg6[] = "./hnp_out/sample.hnp";
515         char arg7[] = "-f";
516         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
517         int argc = sizeof(argv) / sizeof(argv[0]);
518         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
519         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
520     }
521 
522     HnpDeleteFolder(HNP_BASE_PATH);
523     HnpDeleteFolder(HNP_UID_PATH);
524     HnpPackWithBinDelete();
525 
526     GTEST_LOG_(INFO) << "Hnp_Installer_004 end";
527 }
528 
529 /**
530 * @tc.name: Hnp_Install_005
531 * @tc.desc:  Verify more than 2 link if HnpCmdInstall succeed.
532 * @tc.type: FUNC
533 * @tc.require:issueI9BU5F
534 * @tc.author:
535 */
536 HWTEST(HnpInstallerTest, Hnp_Install_005, TestSize.Level0)
537 {
538     GTEST_LOG_(INFO) << "Hnp_Installer_005 start";
539 
540     HnpCreateFolder(HNP_UID_PATH);
541     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
542     HnpPackWithCfg();
543 
544     char arg1[] = "hnp";
545     char arg2[] = "install";
546 
547     { //ok
548         char arg3[] = "-u";
549         char arg4[] = "10000";
550         char arg5[] = "-p";
551         char arg6[] = "./hnp_out/sample.hnp";
552         char arg7[] = "-f";
553         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
554         int argc = sizeof(argv) / sizeof(argv[0]);
555         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
556         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/outt", F_OK), 0);
557         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out2", F_OK), 0);
558     }
559 
560     HnpDeleteFolder(HNP_BASE_PATH);
561     HnpDeleteFolder(HNP_UID_PATH);
562     HnpPackWithCfgDelete();
563 
564     GTEST_LOG_(INFO) << "Hnp_Installer_005 end";
565 }
566 
567 /**
568 * @tc.name: Hnp_Install_006
569 * @tc.desc:  Verify private HnpCmdInstall succeed.
570 * @tc.type: FUNC
571 * @tc.require:issueI9BU5F
572 * @tc.author:
573 */
574 HWTEST(HnpInstallerTest, Hnp_Install_006, TestSize.Level0)
575 {
576     GTEST_LOG_(INFO) << "Hnp_Install_006 start";
577 
578     HnpCreateFolder(HNP_UID_PATH);
579     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
580     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
581 
582     HnpPackWithCfg();
583 
584     char arg1[] = "hnp";
585     char arg2[] = "install";
586 
587     { //ok
588         char arg3[] = "-u";
589         char arg4[] = "10000";
590         char arg5[] = "-p";
591         char arg6[] = "./hnp_out/sample.hnp";
592         char arg7[] = "-i";
593         char arg8[] = HNP_BASE_PATH"/test";
594         char arg9[] = "-f";
595         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9};
596         int argc = sizeof(argv) / sizeof(argv[0]);
597         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
598         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/outt", F_OK), 0);
599         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/out2", F_OK), 0);
600     }
601 
602     HnpDeleteFolder(HNP_BASE_PATH);
603     HnpDeleteFolder(HNP_UID_PATH);
604     HnpPackWithCfgDelete();
605 
606     GTEST_LOG_(INFO) << "Hnp_Install_006 end";
607 }
608 
609 /**
610 * @tc.name: Hnp_Install_007
611 * @tc.desc:  Verify set Arg if HnpCmdInstall succeed.
612 * @tc.type: FUNC
613 * @tc.require:issueI9BU5F
614 * @tc.author:
615 */
616 HWTEST(HnpInstallerTest, Hnp_Install_007, TestSize.Level0)
617 {
618     GTEST_LOG_(INFO) << "Hnp_Install_007 start";
619 
620     // clear resource before test
621     remove("hnp_out/sample.hnp");
622     remove("hnp_sample/bin/out");
623     rmdir("hnp_sample/bin");
624     rmdir("hnp_sample");
625     rmdir("hnp_out");
626     HnpDeleteFolder(HNP_BASE_PATH);
627 
628     HnpCreateFolder(HNP_UID_PATH);
629     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
630     HnpPackWithBin();
631 
632     char arg1[] = "hnp";
633     char arg2[] = "install";
634 
635     { // src dir path is invalid
636         char arg3[] = "-u";
637         char arg4[] = "10000";
638         char arg5[] = "-p";
639         char arg6[] = "./hnp_in/sample.hnp";
640         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
641         int argc = sizeof(argv) / sizeof(argv[0]);
642 
643         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_REALPATH_FAILED);
644     }
645     { // dst dir path is invalid
646         char arg3[] = "-u";
647         char arg4[] = "10001";
648         char arg5[] = "-p";
649         char arg6[] = "./hnp_out/sample.hnp";
650         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
651         int argc = sizeof(argv) / sizeof(argv[0]);
652 
653         EXPECT_EQ(HnpCmdInstall(argc, argv), HNP_ERRNO_INSTALLER_GET_REALPATH_FAILED);
654     }
655     { // ok
656         char arg3[] = "-u";
657         char arg4[] = "10000";
658         char arg5[] = "-p";
659         char arg6[] = "./hnp_out/sample.hnp";
660         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
661         int argc = sizeof(argv) / sizeof(argv[0]);
662 
663         EXPECT_EQ(HnpCmdInstall(argc, argv), 0);
664         EXPECT_EQ(access(HNP_BASE_PATH"/hnppublic/bin/out", F_OK), 0);
665     }
666 
667     HnpDeleteFolder(HNP_BASE_PATH);
668     HnpDeleteFolder(HNP_UID_PATH);
669     HnpPackWithBinDelete();
670 
671     GTEST_LOG_(INFO) << "Hnp_Install_007 end";
672 }
673 
674 /**
675 * @tc.name: Hnp_Install_API_001
676 * @tc.desc:  Verify set Arg if NativeInstallHnp succeed.
677 * @tc.type: FUNC
678 * @tc.require:issueI9DQSE
679 * @tc.author:
680 */
681 HWTEST(HnpInstallerTest, Hnp_Install_API_001, TestSize.Level0)
682 {
683     GTEST_LOG_(INFO) << "Hnp_Install_API_001 start";
684 
685     int ret;
686     const char *packages[1] = {"./hnp_out/sample.hnp"};
687 
688     HnpCreateFolder(HNP_UID_PATH);
689     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
690     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
691 
692     HnpPackWithCfg();
693 
694     { //param is invalid
695         ret = NativeInstallHnpEx(NULL, packages, 1, HNP_BASE_PATH"/test", 1);
696         EXPECT_EQ(ret, HNP_API_ERRNO_PARAM_INVALID);
697     }
698     { //ok
699         ret = NativeInstallHnpEx("10000", packages, 1, HNP_BASE_PATH"/test", 1);
700         EXPECT_EQ(ret, 0);
701         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/outt", F_OK), 0);
702         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/out2", F_OK), 0);
703     }
704 
705     HnpDeleteFolder(HNP_BASE_PATH);
706     HnpDeleteFolder(HNP_UID_PATH);
707     HnpPackWithCfgDelete();
708 
709     GTEST_LOG_(INFO) << "Hnp_Install_API_001 end";
710 }
711 
712 /**
713 * @tc.name: Hnp_Install_API_002
714 * @tc.desc:  Verify set Arg if NativeInstallHnp succeed.
715 * @tc.type: FUNC
716 * @tc.require:issueI9DQSE
717 * @tc.author:
718 */
719 HWTEST(HnpInstallerTest, Hnp_Install_API_002, TestSize.Level0)
720 {
721     GTEST_LOG_(INFO) << "Hnp_Install_API_002 start";
722 
723     int ret;
724     const char *packages[1] = {"./hnp_out/sample.hnp"};
725 
726     HnpCreateFolder(HNP_UID_PATH);
727     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
728     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
729 
730     HnpPackWithCfg();
731 
732     { //st dir path is invalid
733         ret = NativeInstallHnpEx("10001", packages, 1, NULL, 1);
734         EXPECT_NE(ret, 0);
735     }
736 
737     HnpDeleteFolder(HNP_BASE_PATH);
738     HnpDeleteFolder(HNP_UID_PATH);
739     HnpPackWithCfgDelete();
740 
741     GTEST_LOG_(INFO) << "Hnp_Install_API_002 end";
742 }
743 
744 /**
745 * @tc.name: Hnp_Install_API_003
746 * @tc.desc:  Verify more than 1 hnp package if NativeInstallHnp succeed.
747 * @tc.type: FUNC
748 * @tc.require:issueI9DQSE
749 * @tc.author:
750 */
751 HWTEST(HnpInstallerTest, Hnp_Install_API_003, TestSize.Level0)
752 {
753     GTEST_LOG_(INFO) << "Hnp_Install_API_003 start";
754 
755     int ret;
756     const char *packages[2] = {"./hnp_out/sample.hnp", "./hnp_out2/sample2.hnp"};
757 
758     HnpCreateFolder(HNP_UID_PATH);
759     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
760     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
761 
762     HnpPackWithCfg();
763     HnpPackWithSimple2Bin();
764 
765     { //ok
766         ret = NativeInstallHnpEx("10000", packages, 2, HNP_BASE_PATH"/test", 1);
767         EXPECT_EQ(ret, 0);
768         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/outt", F_OK), 0);
769         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/out2", F_OK), 0);
770         EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/out", F_OK), 0);
771     }
772 
773     HnpDeleteFolder(HNP_BASE_PATH);
774     HnpDeleteFolder(HNP_UID_PATH);
775     HnpPackWithCfgDelete();
776     HnpPackWithBinSimple2Delete();
777 
778     GTEST_LOG_(INFO) << "Hnp_Install_API_003 end";
779 }
780 
781 /**
782 * @tc.name: Hnp_Install_API_004
783 * @tc.desc:  Verify develop mode NativeInstallHnp succeed.
784 * @tc.type: FUNC
785 * @tc.require:issueI9JCQ1
786 * @tc.author:
787 */
788 HWTEST(HnpInstallerTest, Hnp_Install_API_004, TestSize.Level0)
789 {
790     GTEST_LOG_(INFO) << "Hnp_Install_API_004 start";
791 
792     int ret;
793     const char *packages[1] = {"./hnp_out/sample.hnp"};
794 
795     HnpCreateFolder(HNP_UID_PATH);
796     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
797     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
798 
799     HnpPackWithCfg();
800 
801     { //ok
802         ret = NativeInstallHnpEx("10000", packages, 1, HNP_BASE_PATH"/test", 1);
803         if (IsDeveloperModeOpen()) {
804             GTEST_LOG_(INFO) << "this is developer mode";
805             EXPECT_EQ(ret, 0);
806             EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/outt", F_OK), 0);
807             EXPECT_EQ(access(HNP_BASE_PATH"/test/bin/out2", F_OK), 0);
808         } else {
809             GTEST_LOG_(INFO) << "this is not developer mode";
810             EXPECT_EQ(ret, HNP_API_NOT_IN_DEVELOPER_MODE);
811         }
812     }
813 
814     HnpDeleteFolder(HNP_BASE_PATH);
815     HnpDeleteFolder(HNP_UID_PATH);
816     HnpPackWithCfgDelete();
817 
818     GTEST_LOG_(INFO) << "Hnp_Install_API_004 end";
819 }
820 
821 /**
822 * @tc.name: Hnp_UnInstall_001
823 * @tc.desc:  Verify set Arg if HnpCmdUnInstall succeed.
824 * @tc.type: FUNC
825 * @tc.require:issueI9BU5F
826 * @tc.author:
827 */
828 HWTEST(HnpInstallerTest, Hnp_UnInstall_001, TestSize.Level0)
829 {
830     GTEST_LOG_(INFO) << "Hnp_UnInstall_001 start";
831 
832     HnpCreateFolder(HNP_UID_PATH);
833     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
834     HnpPackWithBin();
835     HnpInstall();
836 
837     char arg1[] = "hnp";
838     char arg2[] = "uninstall";
839 
840     { // param num not enough
841         char* argv[] = {arg1, arg2};
842         int argc = sizeof(argv) / sizeof(argv[0]);
843 
844         EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_OPERATOR_ARGV_MISS);
845     }
846     { // param uid is invalid
847         char arg3[] = "-u";
848         char arg4[] = "asd1231";
849         char arg5[] = "-n";
850         char arg6[] = "sample";
851         char arg7[] = "-v";
852         char arg8[] = "1.1";
853         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
854         int argc = sizeof(argv) / sizeof(argv[0]);
855 
856         EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_INSTALLER_ARGV_UID_INVALID);
857     }
858     { // ok
859         char arg3[] = "-u";
860         char arg4[] = "10000";
861         char arg5[] = "-n";
862         char arg6[] = "sample";
863         char arg7[] = "-v";
864         char arg8[] = "1.1";
865         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
866         int argc = sizeof(argv) / sizeof(argv[0]);
867 
868         EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
869     }
870 
871     HnpDeleteFolder(HNP_BASE_PATH);
872     HnpDeleteFolder(HNP_UID_PATH);
873     HnpPackWithBinDelete();
874 
875     GTEST_LOG_(INFO) << "Hnp_UnInstall_001 end";
876 }
877 
878 /**
879 * @tc.name: Hnp_UnInstall_002
880 * @tc.desc:  Verify cfg pack HnpCmdUnInstall succeed.
881 * @tc.type: FUNC
882 * @tc.require:issueI9BU5F
883 * @tc.author:
884 */
885 HWTEST(HnpInstallerTest, Hnp_UnInstall_002, TestSize.Level0)
886 {
887     GTEST_LOG_(INFO) << "Hnp_UnInstall_002 start";
888 
889     HnpCreateFolder(HNP_UID_PATH);
890     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
891     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
892     HnpPackWithCfg();
893     HnpInstallPrivate();
894 
895     char arg1[] = "hnp";
896     char arg2[] = "uninstall";
897     { // param uninstall path is invalid
898         char arg3[] = "-u";
899         char arg4[] = "10000";
900         char arg5[] = "-n";
901         char arg6[] = "sample";
902         char arg7[] = "-v";
903         char arg8[] = "1.1";
904         char arg9[] = "-i";
905         char arg10[] = "/test";
906         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
907         int argc = sizeof(argv) / sizeof(argv[0]);
908 
909         EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_HNP_PATH_NOT_EXIST);
910     }
911     { // ok
912         char arg3[] = "-u";
913         char arg4[] = "10000";
914         char arg5[] = "-n";
915         char arg6[] = "sample";
916         char arg7[] = "-v";
917         char arg8[] = "1.1";
918         char arg9[] = "-i";
919         char arg10[] = HNP_BASE_PATH"/test";
920         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10};
921         int argc = sizeof(argv) / sizeof(argv[0]);
922 
923         EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
924     }
925 
926     HnpDeleteFolder(HNP_BASE_PATH);
927     HnpDeleteFolder(HNP_UID_PATH);
928     HnpPackWithCfgDelete();
929 
930     GTEST_LOG_(INFO) << "Hnp_UnInstall_002 end";
931 }
932 
933 /**
934 * @tc.name: Hnp_UnInstall_003
935 * @tc.desc:  Verify set Arg if HnpCmdUnInstall succeed.
936 * @tc.type: FUNC
937 * @tc.require:issueI9BU5F
938 * @tc.author:
939 */
940 HWTEST(HnpInstallerTest, Hnp_UnInstall_003, TestSize.Level0)
941 {
942     GTEST_LOG_(INFO) << "Hnp_UnInstall_003 start";
943 
944     HnpCreateFolder(HNP_UID_PATH);
945     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
946     HnpPackWithBin();
947     HnpInstall();
948 
949     char arg1[] = "hnp";
950     char arg2[] = "uninstall";
951 
952     { // param software name is invalid
953         char arg3[] = "-u";
954         char arg4[] = "10000";
955         char arg5[] = "-n";
956         char arg6[] = "sample2";
957         char arg7[] = "-v";
958         char arg8[] = "1.1";
959         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
960         int argc = sizeof(argv) / sizeof(argv[0]);
961 
962         EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_HNP_PATH_NOT_EXIST);
963     }
964     { // param software version is invalid
965         char arg3[] = "-u";
966         char arg4[] = "10001";
967         char arg5[] = "-n";
968         char arg6[] = "sample";
969         char arg7[] = "-v";
970         char arg8[] = "1.3";
971         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
972         int argc = sizeof(argv) / sizeof(argv[0]);
973 
974         EXPECT_EQ(HnpCmdUnInstall(argc, argv), HNP_ERRNO_UNINSTALLER_HNP_PATH_NOT_EXIST);
975     }
976     { // ok
977         char arg3[] = "-u";
978         char arg4[] = "10000";
979         char arg5[] = "-n";
980         char arg6[] = "sample";
981         char arg7[] = "-v";
982         char arg8[] = "1.1";
983         char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
984         int argc = sizeof(argv) / sizeof(argv[0]);
985 
986         EXPECT_EQ(HnpCmdUnInstall(argc, argv), 0);
987     }
988 
989     HnpDeleteFolder(HNP_BASE_PATH);
990     HnpDeleteFolder(HNP_UID_PATH);
991     HnpPackWithBinDelete();
992 
993     GTEST_LOG_(INFO) << "Hnp_UnInstall_003 end";
994 }
995 
996 /**
997 * @tc.name: Hnp_UnInstall_API_001
998 * @tc.desc:  Verify param invalid API NativeUnInstallHnp succeed.
999 * @tc.type: FUNC
1000 * @tc.require:issueI9DQSE
1001 * @tc.author:
1002 */
1003 HWTEST(HnpInstallerTest, Hnp_UnInstall_API_001, TestSize.Level0)
1004 {
1005     GTEST_LOG_(INFO) << "Hnp_UnInstall_API_001 start";
1006 
1007     int ret;
1008 
1009     HnpCreateFolder(HNP_UID_PATH);
1010     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
1011     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
1012     HnpPackWithCfg();
1013     HnpInstallPrivate();
1014 
1015     { // param is invalid
1016         ret = NativeUnInstallHnpEx(NULL, "sample", "1.1", "/test");
1017         EXPECT_EQ(ret, HNP_API_ERRNO_PARAM_INVALID);
1018     }
1019     { // ok
1020         ret = NativeUnInstallHnpEx("10000", "sample", "1.1", HNP_BASE_PATH"/test");
1021         EXPECT_EQ(ret, 0);
1022     }
1023 
1024     HnpDeleteFolder(HNP_BASE_PATH);
1025     HnpDeleteFolder(HNP_UID_PATH);
1026     HnpPackWithCfgDelete();
1027 
1028     GTEST_LOG_(INFO) << "Hnp_UnInstall_API_001 end";
1029 }
1030 
1031 /**
1032 * @tc.name: Hnp_UnInstall_API_002
1033 * @tc.desc:  Verify path invalid API NativeUnInstallHnp succeed.
1034 * @tc.type: FUNC
1035 * @tc.require:issueI9DQSE
1036 * @tc.author:
1037 */
1038 HWTEST(HnpInstallerTest, Hnp_UnInstall_API_002, TestSize.Level0)
1039 {
1040     GTEST_LOG_(INFO) << "Hnp_UnInstall_API_002 start";
1041 
1042     int ret;
1043 
1044     HnpCreateFolder(HNP_UID_PATH);
1045     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
1046     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
1047     HnpPackWithCfg();
1048     HnpInstallPrivate();
1049 
1050     { // param uninstall path is invalid
1051         ret = NativeUnInstallHnpEx("10000", "sample", "1.1", "/test");
1052         EXPECT_NE(ret, 0);
1053     }
1054 
1055     HnpDeleteFolder(HNP_BASE_PATH);
1056     HnpDeleteFolder(HNP_UID_PATH);
1057     HnpPackWithCfgDelete();
1058 
1059     GTEST_LOG_(INFO) << "Hnp_UnInstall_API_002 end";
1060 }
1061 
1062 /**
1063 * @tc.name: Hnp_UnInstall_API_003
1064 * @tc.desc:  Verify develop mode NativeUnInstallHnp succeed.
1065 * @tc.type: FUNC
1066 * @tc.require:issueI9JCQ1
1067 * @tc.author:
1068 */
1069 HWTEST(HnpInstallerTest, Hnp_UnInstall_API_003, TestSize.Level0)
1070 {
1071     GTEST_LOG_(INFO) << "Hnp_UnInstall_API_003 start";
1072 
1073     int ret;
1074 
1075     HnpCreateFolder(HNP_UID_PATH);
1076     EXPECT_EQ(mkdir(HNP_BASE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
1077     EXPECT_EQ(mkdir(HNP_BASE_PATH"/test", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
1078     HnpPackWithCfg();
1079     HnpInstallPrivate();
1080 
1081     {
1082         ret = NativeUnInstallHnpEx("10000", "sample", "1.1", HNP_BASE_PATH"/test");
1083         if (IsDeveloperModeOpen()) {
1084             GTEST_LOG_(INFO) << "this is developer mode";
1085             EXPECT_EQ(ret, 0);
1086         } else {
1087             GTEST_LOG_(INFO) << "this is not developer mode";
1088             EXPECT_EQ(ret, HNP_API_NOT_IN_DEVELOPER_MODE);
1089         }
1090     }
1091 
1092     HnpDeleteFolder(HNP_BASE_PATH);
1093     HnpDeleteFolder(HNP_UID_PATH);
1094     HnpPackWithCfgDelete();
1095 
1096     GTEST_LOG_(INFO) << "Hnp_UnInstall_API_003 end";
1097 }
1098 
1099 }