Compare commits

...

4 Commits

Author SHA1 Message Date
openharmony_ci
e268ef95a9 !851 清除一些静态检查工具发现的问题
Merge pull request !851 from Far/master
2022-10-17 01:38:58 +00:00
Far
296a546bcd fix: 修复一些静态扫描工具发现的问题
Change-Id: I4890de0066f33bf44e913b550edfa3639bce7caf
Signed-off-by: Far <yesiyuan2@huawei.com>
2022-10-15 17:36:26 +08:00
openharmony_ci
a7135e252d !838 fix: 测试用例修复
Merge pull request !838 from Zhaotianyu/20220925iccarm_test_fix
2022-10-13 12:58:17 +00:00
arvinzzz
0f952132c0 fix: iccarm test's problem fix
close: #I5T02Y

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I29385bb25f487adafa2dbc064310817790d831bb
2022-09-25 18:54:03 +08:00
17 changed files with 48 additions and 38 deletions

View File

@@ -39,7 +39,7 @@
static struct File g_files[NR_OPEN_DEFAULT];
int FileToFd(struct File *file)
int FileToFd(const struct File *file)
{
if (file == NULL) {
return (int)LOS_NOK;

View File

@@ -89,7 +89,7 @@ struct Dir {
void *dData;
};
int FileToFd(struct File *file);
int FileToFd(const struct File *file);
struct File *FdToFile(int fd);
struct File *VfsFileGet(void);
struct File *VfsFileGetSpec(int fd);

View File

@@ -251,7 +251,7 @@ errout:
return (int)LOS_NOK;
}
static void CloseFdsInMp(struct MountPoint *mp)
static void CloseFdsInMp(const struct MountPoint *mp)
{
for (int fd = 0; fd < NR_OPEN_DEFAULT; fd++) {
struct File *f = FdToFile(fd);

View File

@@ -86,10 +86,6 @@ optimize_config_cflags = []
optimize_config_asmflags = []
if (defined(LOSCFG_COMPILE_DEBUG)) {
optimize_config_cflags += [
"-g",
"-gdwarf-2",
]
optimize_config_cflags += [ "-On" ]
} else {
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
@@ -118,12 +114,14 @@ kconfig_config_cflags += [
warn_config_cflags = []
warn_config_asmflags = []
warn_config_cflags += [
"--warnings_affect_exit_code",
"--warnings_are_errors",
"--warn_about_c_style_casts",
"--warn_about_incomplete_constructors",
]
if (!defined(LOSCFG_TEST)) {
warn_config_cflags += [
"--warnings_affect_exit_code",
"--warnings_are_errors",
"--warn_about_c_style_casts",
"--warn_about_incomplete_constructors",
]
}
#
# dialect_config

View File

@@ -175,7 +175,7 @@ STATIC INLINE INT32 PollTimedWait(struct pollfd *fds, nfds_t nfds, struct PollTa
}
} else if (left <= 0) {
break;
} else if (left > 0) {
} else {
clock_gettime(CLOCK_REALTIME, &curTime);
last = (INT32)((curTime.tv_sec - startTime.tv_sec) * OS_SYS_MS_PER_SECOND +
(curTime.tv_nsec - startTime.tv_nsec) / (OS_SYS_NS_PER_SECOND / OS_SYS_MS_PER_SECOND));

View File

@@ -42,12 +42,6 @@
#include "los_event.h"
#include "los_mux.h"
typedef struct {
volatile INT32 *realValue;
INT32 value;
UINT32 clearEvent;
} EventCond;
#define INLINE inline
#define BROADCAST_EVENT 1

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:
@@ -340,6 +340,7 @@ typedef struct tagHwiHandleForm {
#define TEST_HwiCreate(ID, prio, mode, Func, irqParam) LOS_HwiCreate(ID, prio, mode, Func, irqParam)
#define uart_printf_func printf
extern VOID ItSuiteLosAtomic(void);
extern VOID ItSuiteLosTask(void);
extern VOID ItSuiteLosQueue(void);
extern VOID ItSuiteLosMux(void);

View File

@@ -101,14 +101,14 @@ LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis007, Function | MediumTest | Level1)
msgQueueId = osMessageQueueNew(1, strlen(strbuff), &attr);
ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId);
name = osMessageQueueGetName(msgQueueId);
name = (CHAR *)osMessageQueueGetName(msgQueueId);
ret = strcmp(name, "q1");
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = osMessageQueueDelete(msgQueueId);
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
name = osMessageQueueGetName(msgQueueId);
name = (CHAR *)osMessageQueueGetName(msgQueueId);
ICUNIT_ASSERT_EQUAL(name, NULL, name);
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)

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:
@@ -56,6 +56,8 @@ extern VOID ItLosAtomic006(VOID);
extern VOID ItLosAtomic007(VOID);
extern VOID ItLosAtomic008(VOID);
extern VOID ItLosAtomic009(VOID);
extern VOID ItLosAtomic010(VOID);
extern VOID ItLosAtomic011(VOID);
#ifdef __cplusplus
#if __cplusplus

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:

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:
@@ -69,7 +69,7 @@ static UINT32 Testcase(VOID)
g_testCount1 = 0;
// 1, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, &irqParam
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, (UINT32)&irqParam
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif

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:
@@ -71,7 +71,7 @@ static VOID TaskF01(VOID)
#ifdef __RISC_V__
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0);
#else
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 1);
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, (HwiIrqParam *)1);
#endif
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);

View File

@@ -31,7 +31,9 @@
#include <securec.h>
#include "osTest.h"
#include "pthread.h"
#include "time.h"
#undef TASK_PRIO_TEST
#define TASK_PRIO_TEST LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO
#define OS_TSK_TEST_STACK_SIZE 0x1000
#define PTHREAD_TASK_DELAY 10
@@ -582,10 +584,10 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread008, Function | MediumTest | Lev
int result = 0;
UINT32 ret;
ret = pthread_key_create(&g_pthreadKey1, pthreadKeyFree);
ret = pthread_key_create((pthread_key_t *)&g_pthreadKey1, pthreadKeyFree);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = pthread_key_create(&g_pthreadKey2, pthreadKeyFree);
ret = pthread_key_create((pthread_key_t *)&g_pthreadKey2, pthreadKeyFree);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = pthread_attr_init(&attr);
@@ -657,7 +659,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread009, Function | MediumTest | Lev
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
for (i = 0; i < TEST_THREAD_COUNT; i++) {
ret = pthread_create(&thread[i], &attr, PthreadPrioFunc01, TEST_THREAD_COUNT - i);
ret = pthread_create(&thread[i], &attr, PthreadPrioFunc01, (void *)(TEST_THREAD_COUNT - i));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
}

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;
}