!838 fix: 测试用例修复

Merge pull request !838 from Zhaotianyu/20220925iccarm_test_fix
This commit is contained in:
openharmony_ci
2022-10-13 12:58:17 +00:00
committed by Gitee
12 changed files with 44 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
@@ -27,6 +27,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
import("//test/xts/tools/lite/build/suite_lite.gni")
static_library("posix_test") {
@@ -65,6 +66,11 @@ static_library("posix_test") {
"src",
]
cflags = [ "-Wno-error" ]
if (!defined(LOSCFG_COMPILER_ICCARM)) {
cflags = [ "-Wno-error" ]
} else {
cflags = [ "--no_warnings" ]
}
configs += [ "//kernel/liteos_m/testsuites:include" ]
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -43,7 +43,8 @@
#include "log.h"
#include <fcntl.h>
#include <dirent.h>
#include "sys/stat.h"
#include <sys/stat.h>
#include <unistd.h>
/* *
* @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency
@@ -1074,7 +1075,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFreadFwrite003, Function | MediumTest
fp = fopen(TEST_FILE_PTAH_RIGHT, "r");
TEST_ASSERT_NOT_NULL(fp);
ret = fread(chr1, strlen(chr1) + 1, 1, fp);
ret = fread((void *)chr1, strlen(chr1) + 1, 1, fp);
TEST_ASSERT_TRUE(ret != -1);
ret = fclose(fp);

View File

@@ -44,7 +44,9 @@
#define Function 0
#define MediumTest 0
#define Level1 0
#define LITE_TEST_SUIT(subsystem, module, testsuit)
#define LITE_TEST_CASE(module, function, flag) static int function(void)
#define RUN_TEST_SUITE(testsuit)
#define TEST_ASSERT_EQUAL(expected, actual) ICUNIT_ASSERT_EQUAL(expected, actual, actual)
#define TEST_ASSERT_EQUAL_INT(expected, actual) TEST_ASSERT_EQUAL(expected, actual)

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -211,6 +211,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrcspn002, Function | MediumTes
return 0;
};
#ifndef LOSCFG_COMPILER_ICCARM
/* *
* @tc.number : SUB_KERNEL_POSIX_strptime_OPERATION_001
* @tc.name : Memony operation for strptime test
@@ -229,6 +230,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrptime001, Function | MediumTe
TEST_ASSERT_EQUAL_INT(tmData.tm_min, 24);
return 0;
}
#endif
RUN_TEST_SUITE(PosixStringFuncTestSuite);
@@ -243,7 +245,9 @@ void PosixStringFuncTest03()
RUN_ONE_TESTCASE(testStrStrdup002);
RUN_ONE_TESTCASE(testStrStrcspn001);
RUN_ONE_TESTCASE(testStrStrcspn002);
#ifndef LOSCFG_COMPILER_ICCARM
RUN_ONE_TESTCASE(testStrStrptime001);
#endif
return;
}