Преглед на файлове

Merge branch 'bugfix/ut_startup_time' into 'master'

By default, don't print test menu in unit-test-app

See merge request !1565

Ivan Grokhotkov преди 8 години
родител
ревизия
d135a017f4

+ 3 - 15
components/idf_test/unit_test/InitialConditionAll.yml

@@ -2936,28 +2936,16 @@ initial condition:
 - check cmd set:
   - ''
   - - FREBOOT UT1
-    - ['']
-  - - DELAY 3
-    - ['']
-  - - UT UT1 -
-    - [R UT1 C Tests C Failures C Ignored]
+    - ['R UT1 C Press%20ENTER%20to%20see%20the%20list%20of%20tests']
   force restore cmd set:
   - ''
   - - FREBOOT UT1
-    - ['']
-  - - DELAY 3
-    - ['']
-  - - UT UT1 -
-    - [R UT1 C Tests C Failures C Ignored]
+    - ['R UT1 C Press%20ENTER%20to%20see%20the%20list%20of%20tests']
   initial condition detail: At UT menu page
   restore cmd set:
   - ''
   - - FREBOOT UT1
-    - ['']
-  - - DELAY 3
-    - ['']
-  - - UT UT1 -
-    - [R UT1 C Tests C Failures C Ignored]
+    - ['R UT1 C Press%20ENTER%20to%20see%20the%20list%20of%20tests']
   restore post cmd set:
   - ''
   - - DELAY 0.1

+ 1 - 1
tools/unit-test-app/components/unity/include/unity_config.h

@@ -39,7 +39,7 @@ struct test_desc_t
 
 void unity_testcase_register(struct test_desc_t* desc);
 
-void unity_run_menu();
+void unity_run_menu() __attribute__((noreturn));
 
 void unity_run_tests_with_filter(const char* filter);
 

+ 14 - 1
tools/unit-test-app/components/unity/unity_platform.c

@@ -257,9 +257,22 @@ static int print_test_menu(void)
     return test_counter;
 }
 
+static int get_test_count(void)
+{
+    int test_counter = 0;
+    for (const struct test_desc_t* test = s_unity_tests_first;
+         test != NULL;
+         test = test->next)
+    {
+        ++test_counter;
+    }
+    return test_counter;
+}
+
 void unity_run_menu()
 {
-    int test_count = print_test_menu();
+    unity_printf("\n\nPress ENTER to see the list of tests.\n");
+    int test_count = get_test_count();
     while (true)
     {
         char cmdline[256] = { 0 };

+ 2 - 3
tools/unit-test-app/main/app_main.c

@@ -6,9 +6,8 @@
 
 void unityTask(void *pvParameters)
 {
-    vTaskDelay(1000 / portTICK_PERIOD_MS);
-    unity_run_menu();
-    while(1);
+    vTaskDelay(30); /* Delay a bit to let the main task be deleted */
+    unity_run_menu(); /* Doesn't return */
 }
 
 void app_main()