ソースを参照

[utest] 更改线程栈的大小,避免栈异常

zhkag 1 年間 前
コミット
82debed3ae

+ 1 - 1
examples/utest/testcases/kernel/atomic_tc.c

@@ -16,7 +16,7 @@
 
 #define THREAD_PRIORITY         25
 #define THREAD_TIMESLICE        1
-#define THREAD_STACKSIZE        1024
+#define THREAD_STACKSIZE        UTEST_THR_STACK_SIZE
 
 /* convenience macro - return either 64-bit or 32-bit value */
 #define ATOMIC_WORD(val_if_64, val_if_32)                                           \

+ 4 - 4
examples/utest/testcases/kernel/event_tc.c

@@ -21,11 +21,11 @@ static rt_event_t dynamic_event = RT_NULL;
 static rt_uint32_t dynamic_event_recv_thread_finish = 0, dynamic_event_send_thread_finish = 0;
 
 rt_align(RT_ALIGN_SIZE)
-static char thread3_stack[1024];
+static char thread3_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread3;
 
 rt_align(RT_ALIGN_SIZE)
-static char thread4_stack[1024];
+static char thread4_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread4;
 #endif /* RT_USING_HEAP */
 
@@ -33,11 +33,11 @@ static rt_uint32_t recv_event_times1 = 0, recv_event_times2 = 0;
 static rt_uint32_t static_event_recv_thread_finish = 0, static_event_send_thread_finish = 0;
 
 rt_align(RT_ALIGN_SIZE)
-static char thread1_stack[1024];
+static char thread1_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread1;
 
 rt_align(RT_ALIGN_SIZE)
-static char thread2_stack[1024];
+static char thread2_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread2;
 
 #define THREAD_PRIORITY      9

+ 4 - 4
examples/utest/testcases/kernel/mailbox_tc.c

@@ -21,11 +21,11 @@ static uint8_t static_mb_recv_thread_finish, static_mb_send_thread_finish;
 static uint8_t dynamic_mb_recv_thread_finish, dynamic_mb_send_thread_finish;
 
 rt_align(RT_ALIGN_SIZE)
-static char thread1_stack[1024];
+static char thread1_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread1;
 
 rt_align(RT_ALIGN_SIZE)
-static char thread2_stack[1024];
+static char thread2_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread2;
 
 #define THREAD_PRIORITY      9
@@ -315,7 +315,7 @@ static void test_dynamic_mailbox_send_recv(void)
     mb_recv = rt_thread_create("mb_recv_thread",
                                 thread3_recv_dynamic_mb,
                                 RT_NULL,
-                                1024,
+                                UTEST_THR_STACK_SIZE,
                                 THREAD_PRIORITY - 1,
                                 THREAD_TIMESLICE);
     if (mb_recv == RT_NULL)
@@ -327,7 +327,7 @@ static void test_dynamic_mailbox_send_recv(void)
     mb_send = rt_thread_create("mb_send_thread",
                                 thread4_send_dynamic_mb,
                                 RT_NULL,
-                                1024,
+                                UTEST_THR_STACK_SIZE,
                                 THREAD_PRIORITY - 1,
                                 THREAD_TIMESLICE);
     if (mb_send == RT_NULL)

+ 2 - 2
examples/utest/testcases/kernel/messagequeue_tc.c

@@ -19,8 +19,8 @@ static rt_uint8_t mq_buf[RT_MQ_BUF_SIZE(MSG_SIZE, MAX_MSGS)];
 
 static struct rt_thread mq_send_thread;
 static struct rt_thread mq_recv_thread;
-static rt_uint8_t mq_send_stack[1024];
-static rt_uint8_t mq_recv_stack[1024];
+static rt_uint8_t mq_send_stack[UTEST_THR_STACK_SIZE];
+static rt_uint8_t mq_recv_stack[UTEST_THR_STACK_SIZE];
 
 static struct rt_event finish_e;
 #define MQSEND_FINISH   0x01

+ 6 - 6
examples/utest/testcases/kernel/mutex_tc.c

@@ -294,7 +294,7 @@ static void test_static_pri_reverse(void)
     tid1 = rt_thread_create("thread1",
                             static_thread1_entry,
                             &static_mutex,
-                            1024,
+                            UTEST_THR_STACK_SIZE,
                             10 - 1,
                             10);
     if (tid1 != RT_NULL)
@@ -304,7 +304,7 @@ static void test_static_pri_reverse(void)
     tid2 = rt_thread_create("thread2",
                             static_thread2_entry,
                             &static_mutex,
-                            1024,
+                            UTEST_THR_STACK_SIZE,
                             10,
                             10);
     if (tid2 != RT_NULL)
@@ -314,7 +314,7 @@ static void test_static_pri_reverse(void)
     tid3 = rt_thread_create("thread3",
                             static_thread3_entry,
                             &static_mutex,
-                            1024,
+                            UTEST_THR_STACK_SIZE,
                             10 + 1,
                             10);
     if (tid3 != RT_NULL)
@@ -603,7 +603,7 @@ static void test_dynamic_pri_reverse(void)
     tid1 = rt_thread_create("thread1",
                             dynamic_thread1_entry,
                             dynamic_mutex,
-                            1024,
+                            UTEST_THR_STACK_SIZE,
                             10 - 1,
                             10);
     if (tid1 != RT_NULL)
@@ -613,7 +613,7 @@ static void test_dynamic_pri_reverse(void)
     tid2 = rt_thread_create("thread2",
                             dynamic_thread2_entry,
                             dynamic_mutex,
-                            1024,
+                            UTEST_THR_STACK_SIZE,
                             10,
                             10);
     if (tid2 != RT_NULL)
@@ -623,7 +623,7 @@ static void test_dynamic_pri_reverse(void)
     tid3 = rt_thread_create("thread3",
                             dynamic_thread3_entry,
                             dynamic_mutex,
-                            1024,
+                            UTEST_THR_STACK_SIZE,
                             10 + 1,
                             10);
     if (tid3 != RT_NULL)

+ 1 - 1
examples/utest/testcases/kernel/thread_tc.c

@@ -17,7 +17,7 @@
 #define THREAD_TIMESLICE   10
 
 rt_align(RT_ALIGN_SIZE)
-static char thread2_stack[1024];
+static char thread2_stack[UTEST_THR_STACK_SIZE];
 static struct rt_thread thread2;
 #ifdef RT_USING_HEAP
     static rt_thread_t tid1 = RT_NULL;