fix(test): misc09用例因依赖hosts文件而失败
【背景】 1.etc/hosts文件不存在,misc09依赖hosts文件而失败 【修改方案】 1.用例执行前检查是否存在这些配置文件,不存在就跳过该用例 re#I48IZ0 Change-Id: I193cb03770932c1f681cd726ceb383816aa2257a Signed-off-by: lnlan <lanleinan@163.com> Change-Id: I3fb7ca1ed5f8cc79a56cd1872f3b303ab325a7a9
This commit is contained in:
parent
0507b9e8ea
commit
f2f5c5fdc3
|
@ -30,14 +30,29 @@
|
|||
*/
|
||||
#include "It_test_misc.h"
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
STATIC UINT32 TestCase(VOID)
|
||||
{
|
||||
long ret;
|
||||
INT32 ret;
|
||||
CHAR *hostsFileStream = "127.0.0.1 localhost\n192.168.1.3 hisilicon\n::1 localhost\n";
|
||||
CHAR *pathList[] = {"/etc/hosts"};
|
||||
CHAR *streamList[] = {hostsFileStream};
|
||||
INT32 streamLen[] = {strlen(hostsFileStream)};
|
||||
|
||||
ret = PrepareFileEnv(pathList, streamList, streamLen, 1);
|
||||
if (ret != 0) {
|
||||
printf("error: need some env files, but prepare is not ok");
|
||||
(VOID)RecoveryFileEnv(pathList, 1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = gethostid();
|
||||
ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret);
|
||||
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROUT);
|
||||
(VOID)RecoveryFileEnv(pathList, 1);
|
||||
return 0;
|
||||
|
||||
ERROUT:
|
||||
(VOID)RecoveryFileEnv(pathList, 1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
VOID ItTestMisc009(VOID)
|
||||
|
|
Loading…
Reference in New Issue