From 5117364c13477eaa078f4f1ed64878dd807291dd Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 9 Nov 2017 14:45:08 +0800 Subject: [PATCH 1/3] unit-test-app: don't print the list of tests by default This reduces unit-test-app startup time when there are a lot of tests included, speeding up unit tests in CI. --- .../components/unity/unity_platform.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/unit-test-app/components/unity/unity_platform.c b/tools/unit-test-app/components/unity/unity_platform.c index 94549d42c1..069bd838dc 100644 --- a/tools/unit-test-app/components/unity/unity_platform.c +++ b/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 }; From 81f806e6760012e402bde20642594951b258789d Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Mon, 20 Nov 2017 13:32:01 +0800 Subject: [PATCH 2/3] test: change initial condition of unit test: now UT App will not print test menu by default. it will print a prompt to indicate it's ready. we can check this prompt instead of delay. --- .../idf_test/unit_test/InitialConditionAll.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/components/idf_test/unit_test/InitialConditionAll.yml b/components/idf_test/unit_test/InitialConditionAll.yml index 48045c286d..6e5d898e72 100644 --- a/components/idf_test/unit_test/InitialConditionAll.yml +++ b/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 From 2eae44064673f631f5cc948e65f8cd05941efc4b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 9 Nov 2017 17:26:43 +0800 Subject: [PATCH 3/3] unit-test-app: reduce startup delay, clean up --- tools/unit-test-app/components/unity/include/unity_config.h | 2 +- tools/unit-test-app/main/app_main.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/unit-test-app/components/unity/include/unity_config.h b/tools/unit-test-app/components/unity/include/unity_config.h index 90be3a90fd..2929eb6e39 100644 --- a/tools/unit-test-app/components/unity/include/unity_config.h +++ b/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); diff --git a/tools/unit-test-app/main/app_main.c b/tools/unit-test-app/main/app_main.c index bf54b03957..b3d249fc50 100644 --- a/tools/unit-test-app/main/app_main.c +++ b/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()