From 811ed960429948d7d130a95f1118d4f467fed959 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Thu, 23 Sep 2021 09:27:17 +0800 Subject: [PATCH] example: auto restart int the linux hello world example --- .gitlab/ci/host-test.yml | 3 ++- .../cmake/linux_host_app/main/linux_host_app.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index 9f31b9909a..3ed2cac064 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -369,4 +369,5 @@ test_linux_example: script: - cd ${IDF_PATH}/examples/build_system/cmake/linux_host_app - idf.py build - - build/linux_host_app.elf + - timeout 5 ./build/linux_host_app.elf >test.log || true + - grep "Restarting" test.log diff --git a/examples/build_system/cmake/linux_host_app/main/linux_host_app.cpp b/examples/build_system/cmake/linux_host_app/main/linux_host_app.cpp index c51a9fb764..7c646d1743 100644 --- a/examples/build_system/cmake/linux_host_app/main/linux_host_app.cpp +++ b/examples/build_system/cmake/linux_host_app/main/linux_host_app.cpp @@ -8,13 +8,23 @@ */ #include "stdio.h" +#include void app_main() { - printf("Hello, Host!\n"); + while(1) { + printf("Hello, Host!\n"); + + for (int i = 10; i >= 0; i--) { + printf("Restarting in %d seconds...\n", i); + sleep(1); + } + } } int main(int argc, char **argv) { + setbuf(stdout, NULL); app_main(); + return 0; }