]> granicus.if.org Git - esp-idf/commitdiff
esp32 tests: TLS test: use same size stack for static & non-static task
authorAngus Gratton <angus@espressif.com>
Tue, 17 Jul 2018 05:39:40 +0000 (15:39 +1000)
committerbot <bot@espressif.com>
Mon, 23 Jul 2018 03:54:44 +0000 (03:54 +0000)
Use constant instead of magic number of task priorities.

components/freertos/test/test_thread_local.c

index 912edf9664280abd8874452e5970c65eb1d71ce0..b80c960fc3fb47578e3f29edfcb1760e80d03064 100644 (file)
@@ -87,7 +87,8 @@ static void task_test_tls(void *arg)
 
 TEST_CASE("TLS test", "[freertos]")
 {
-    static StackType_t s_stack[2048];
+    const size_t stack_size = 3072;
+    StackType_t s_stack[stack_size]; /* with 8KB test task stack (default) this test still has ~3KB headroom */
     StaticTask_t s_task;
     bool running[2] = {true, true};
 #if CONFIG_FREERTOS_UNICORE == 0
@@ -96,9 +97,10 @@ TEST_CASE("TLS test", "[freertos]")
     int other_core = 0;
 #endif
 
-    xTaskCreatePinnedToCore((TaskFunction_t)&task_test_tls, "task_test_tls", 3072, &running[0], 5, NULL, 0);
-    xTaskCreateStaticPinnedToCore((TaskFunction_t)&task_test_tls, "task_test_tls", sizeof(s_stack), &running[1],
-        5, s_stack, &s_task, other_core);
+    xTaskCreatePinnedToCore((TaskFunction_t)&task_test_tls, "task_test_tls", stack_size, &running[0],
+                            UNITY_FREERTOS_PRIORITY, NULL, 0);
+    xTaskCreateStaticPinnedToCore((TaskFunction_t)&task_test_tls, "task_test_tls", stack_size, &running[1],
+        UNITY_FREERTOS_PRIORITY, s_stack, &s_task, other_core);
     while (running[0] || running[1]) {
         vTaskDelay(10);
     }