test: 修复llvm升级导致tdd用例部分失败问题
方案描述: 1、llvm升级之后对while(1)死循环和给空指针赋值的场景有错误优化的情况; 用例中在相关函数之前添加__attribute__((optnone))禁止编译器进行错误优化。 Close:#I6V2LN Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com> Change-Id: Ic7150909c12a599aeeb0a55b983dfad7a0631cdc
This commit is contained in:
parent
5fb9165c08
commit
577d29aaba
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
#include "it_test_exc.h"
|
||||
|
||||
static int TestCase(void)
|
||||
__attribute__((optnone)) static int TestCase(void)
|
||||
{
|
||||
int ret;
|
||||
int status = 0;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "it_test_exc.h"
|
||||
#include "pthread.h"
|
||||
|
||||
static void *ThreadFunc2(void *arg)
|
||||
__attribute__((optnone)) static void *ThreadFunc2(void *arg)
|
||||
{
|
||||
while (1) {
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ static void *ThreadFunc2(void *arg)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static void *ThreadFunc1(void *arg)
|
||||
__attribute__((optnone)) static void *ThreadFunc1(void *arg)
|
||||
{
|
||||
int *test = nullptr;
|
||||
*test = 0x1;
|
||||
|
@ -77,7 +77,8 @@ static int TestThread(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int TestCase(void)
|
||||
|
||||
__attribute__((optnone)) static int TestCase(void)
|
||||
{
|
||||
int *test = nullptr;
|
||||
int count = 5;
|
||||
|
|
|
@ -34,14 +34,15 @@
|
|||
#define TEST_THREAD_COUNT 5
|
||||
static volatile int g_testCondFlag;
|
||||
static int g_count[TEST_THREAD_COUNT];
|
||||
static void *ThreadFunc2(void *arg)
|
||||
|
||||
__attribute__((optnone)) static void *ThreadFunc2(void *arg)
|
||||
{
|
||||
int count = *(int *)arg;
|
||||
int *test = nullptr;
|
||||
|
||||
g_testCondFlag++;
|
||||
|
||||
while (g_testCondFlag < 2) {
|
||||
while (g_testCondFlag < 2) { /* 2, no special meaning */
|
||||
}
|
||||
|
||||
*test = 0x1;
|
||||
|
@ -83,7 +84,7 @@ static int TestThread(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int TestCase(void)
|
||||
__attribute__((optnone)) static int TestCase(void)
|
||||
{
|
||||
int *test = nullptr;
|
||||
int count = 5;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#define TEST_THREAD_COUNT 5
|
||||
|
||||
static int TestThread(void)
|
||||
__attribute__((optnone)) static int TestThread(void)
|
||||
{
|
||||
int ret;
|
||||
int *test = nullptr; // For triggering an exceptioin
|
||||
|
@ -53,7 +53,7 @@ static int TestThread(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int TestCase(void)
|
||||
__attribute__((optnone)) static int TestCase(void)
|
||||
{
|
||||
int count = 5;
|
||||
int status = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
#include "it_test_exc.h"
|
||||
|
||||
static void Child(void)
|
||||
__attribute__((optnone)) static void Child(void)
|
||||
{
|
||||
while (1) {
|
||||
printf("@@@@@@@@@@@@@ pid : %d getppid : %d @@@@@@@@@@@@@@@@\n", getpid(), getppid());
|
||||
|
@ -41,7 +41,7 @@ static void TestKill(int sig)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
static int TestCase(void)
|
||||
__attribute__((optnone)) static int TestCase(void)
|
||||
{
|
||||
int ret;
|
||||
void (*retptr)(int) = NULL;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
#include "It_posix_queue.h"
|
||||
|
||||
static VOID *PthreadF01(VOID *argument)
|
||||
__attribute__((optnone)) static VOID *PthreadF01(VOID *argument)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 ret;
|
||||
|
@ -54,7 +54,7 @@ EXIT:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static VOID *PthreadF02(VOID *argument)
|
||||
__attribute__((optnone)) static VOID *PthreadF02(VOID *argument)
|
||||
{
|
||||
INT32 j, ret;
|
||||
|
||||
|
@ -79,7 +79,7 @@ EXIT:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
__attribute__((optnone)) static UINT32 Testcase(VOID)
|
||||
{
|
||||
pthread_t newTh1, newTh2;
|
||||
UINT32 ret;
|
||||
|
|
|
@ -53,7 +53,6 @@ EXIT:
|
|||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
INT32 ret;
|
||||
UINT32 uret;
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
const CHAR *msgptr = MQUEUE_SEND_STRING_TEST;
|
||||
pthread_t pthread1;
|
||||
|
@ -92,7 +91,6 @@ static UINT32 Testcase(VOID)
|
|||
ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2);
|
||||
|
||||
usleep(0);
|
||||
ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2);
|
||||
|
||||
ret = pthread_join(pthread1, NULL);
|
||||
ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2);
|
||||
|
|
|
@ -32,19 +32,19 @@
|
|||
|
||||
static const int TEST_COUNT = 10;
|
||||
|
||||
static void *ThreadFunc2(void *arg)
|
||||
__attribute__((optnone)) static void *ThreadFunc2(void *arg)
|
||||
{
|
||||
printf("111111111111111: exit\n");
|
||||
exit(254); // 254, exit args
|
||||
}
|
||||
|
||||
static void *ThreadFunc3(void *arg)
|
||||
__attribute__((optnone)) static void *ThreadFunc3(void *arg)
|
||||
{
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
static int ProcessTest001(void)
|
||||
__attribute__((optnone)) static int ProcessTest001(void)
|
||||
{
|
||||
int ret;
|
||||
int status;
|
||||
|
@ -81,7 +81,7 @@ static int ProcessTest001(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int Testcase(void)
|
||||
__attribute__((optnone)) static int Testcase(void)
|
||||
{
|
||||
int ret;
|
||||
int status;
|
||||
|
|
Loading…
Reference in New Issue