diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h index 282810a1aac..660843e94df 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h @@ -137,9 +137,11 @@ extern void vPortCancelThread( void *pxTaskToDelete ); */ #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" ) -extern unsigned long ulPortGetRunTime( void ); #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() /* no-op */ -#define portGET_RUN_TIME_COUNTER_VALUE() ulPortGetRunTime() +#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS ) +configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void ); +#define portGET_RUN_TIME_COUNTER_VALUE() xPortGetRunTimeCounterValue() +#endif #ifdef __cplusplus } diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/port.c b/components/freertos/FreeRTOS-Kernel/portable/linux/port.c index f358a96e258..0ed7970f436 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/linux/port.c +++ b/components/freertos/FreeRTOS-Kernel/portable/linux/port.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "string.h" #include "FreeRTOS.h" #include "task.h" @@ -565,3 +566,15 @@ void vPortCancelThread(void *pxTaskToDelete) void vPortSetStackWatchpoint(void *pxStackStart) { } + +#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS ) +configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void ) +{ + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + + return ( configRUN_TIME_COUNTER_TYPE ) ( ( ( uint64_t ) ts.tv_sec * 1000000ULL ) + + ( ( uint64_t ) ts.tv_nsec / 1000ULL ) ); +} +#endif /* CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS */ diff --git a/examples/system/.build-test-rules.yml b/examples/system/.build-test-rules.yml index 10b33e3a617..b9c97abaacf 100644 --- a/examples/system/.build-test-rules.yml +++ b/examples/system/.build-test-rules.yml @@ -52,10 +52,14 @@ examples/system/efuse: - bootloader_support examples/system/esp_event/default_event_loop: + enable: + - if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux" depends_components: - esp_event examples/system/esp_event/user_event_loops: + enable: + - if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux" depends_components: - esp_event @@ -262,16 +266,14 @@ examples/system/perfmon: - xtensa examples/system/pthread: - disable: - - if: IDF_TARGET != "esp32" and (NIGHTLY_RUN != "1" or IDF_TARGET == "linux") - reason: no target specific functionality, testing on a single target is sufficient + enable: + - if: IDF_TARGET in ["esp32", "esp32c3", "linux"] depends_components: - pthread examples/system/rt_mqueue: - disable_test: - - if: IDF_TARGET != "esp32" and (NIGHTLY_RUN != "1" or IDF_TARGET == "linux") - reason: no target specific functionality, testing on a single target is sufficient + enable: + - if: IDF_TARGET in ["esp32", "esp32c3", "linux"] depends_components: - rt @@ -322,9 +324,8 @@ examples/system/task_watchdog: - esp_system examples/system/unit_test/: - disable: - - if: IDF_TARGET != "esp32" and (NIGHTLY_RUN != "1" or IDF_TARGET == "linux") - reason: no target specific functionality, testing on a single target is sufficient + enable: + - if: IDF_TARGET in ["esp32", "esp32c3", "linux"] depends_components: - unity diff --git a/examples/system/esp_event/default_event_loop/README.md b/examples/system/esp_event/default_event_loop/README.md index aebe833e8f1..bf57954d317 100644 --- a/examples/system/esp_event/default_event_loop/README.md +++ b/examples/system/esp_event/default_event_loop/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | Linux | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | ----- | # Default Event Loop Example diff --git a/examples/system/esp_event/default_event_loop/pytest_esp_event_default.py b/examples/system/esp_event/default_event_loop/pytest_esp_event_default.py index 196e6f4f46b..e84123abcf7 100644 --- a/examples/system/esp_event/default_event_loop/pytest_esp_event_default.py +++ b/examples/system/esp_event/default_event_loop/pytest_esp_event_default.py @@ -1,10 +1,11 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import logging import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize + # Timer events TIMER_EVENT_LIMIT = 3 @@ -23,8 +24,14 @@ TASK_ITERATION_POST = 'TASK_EVENTS:TASK_ITERATION_EVENT: posting to default loop TASK_ITERATION_HANDLING = 'TASK_EVENTS:TASK_ITERATION_EVENT: task_iteration_handler, executed {} times' -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('supported_targets', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_default_event_loop_example_iteration_events(dut: Dut) -> None: logging.info('Checking iteration events posting and handling') dut.expect_exact('setting up') @@ -33,7 +40,7 @@ def test_default_event_loop_example_iteration_events(dut: Dut) -> None: for iteration in range(1, TASK_ITERATION_LIMIT + 1): dut.expect_exact(TASK_ITERATION_POST.format(iteration)) - logging.info('Posted iteration {} out of {}'.format(iteration, TASK_ITERATION_LIMIT)) + logging.info(f'Posted iteration {iteration} out of {TASK_ITERATION_LIMIT}') if iteration < TASK_UNREGISTRATION_LIMIT: dut.expect_exact(TASK_ITERATION_HANDLING.format(iteration)) @@ -46,18 +53,24 @@ def test_default_event_loop_example_iteration_events(dut: Dut) -> None: ], expect_all=True, ) - logging.info('Unregistered handler at iteration {} out of {}'.format(iteration, TASK_ITERATION_LIMIT)) + logging.info(f'Unregistered handler at iteration {iteration} out of {TASK_ITERATION_LIMIT}') else: dut.expect_exact('TASK_EVENTS:TASK_ITERATION_EVENT: all_event_handler') - logging.info('Handled iteration {} out of {}'.format(iteration, TASK_ITERATION_LIMIT)) + logging.info(f'Handled iteration {iteration} out of {TASK_ITERATION_LIMIT}') dut.expect_exact('TASK_EVENTS:TASK_ITERATION_EVENT: deleting task event source') logging.info('Deleted task event source') -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('supported_targets', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_default_event_loop_example_timer_events(dut: Dut) -> None: logging.info('Checking timer events posting and handling') @@ -77,7 +90,7 @@ def test_default_event_loop_example_timer_events(dut: Dut) -> None: for expiries in range(1, TIMER_EVENT_LIMIT + 1): dut.expect_exact('TIMER_EVENTS:TIMER_EVENT_EXPIRY: posting to default loop') - logging.info('Posted timer expiry event {} out of {}'.format(expiries, TIMER_EVENT_LIMIT)) + logging.info(f'Posted timer expiry event {expiries} out of {TIMER_EVENT_LIMIT}') if expiries >= TIMER_EVENT_LIMIT: dut.expect_exact('TIMER_EVENTS:TIMER_EVENT_STOPPED: posting to default loop') @@ -87,7 +100,7 @@ def test_default_event_loop_example_timer_events(dut: Dut) -> None: dut.expect_exact('TIMER_EVENTS:TIMER_EVENT_EXPIRY: timer_any_handler') dut.expect_exact('TIMER_EVENTS:TIMER_EVENT_EXPIRY: all_event_handler') - logging.info('Handled timer expiry event {} out of {}'.format(expiries, TIMER_EVENT_LIMIT)) + logging.info(f'Handled timer expiry event {expiries} out of {TIMER_EVENT_LIMIT}') dut.expect_exact('TIMER_EVENTS:TIMER_EVENT_STOPPED: timer_stopped_handler') dut.expect_exact('TIMER_EVENTS:TIMER_EVENT_STOPPED: deleted timer event source') diff --git a/examples/system/esp_event/user_event_loops/README.md b/examples/system/esp_event/user_event_loops/README.md index e9b7ec140ab..7866b782433 100644 --- a/examples/system/esp_event/user_event_loops/README.md +++ b/examples/system/esp_event/user_event_loops/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | Linux | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | ----- | # User Event Loops Example diff --git a/examples/system/esp_event/user_event_loops/pytest_esp_event_user.py b/examples/system/esp_event/user_event_loops/pytest_esp_event_user.py index d9b022c45f1..96e47749108 100644 --- a/examples/system/esp_event/user_event_loops/pytest_esp_event_user.py +++ b/examples/system/esp_event/user_event_loops/pytest_esp_event_user.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import logging @@ -14,8 +14,14 @@ TASK_ITERATION_POSTING = 'posting TASK_EVENTS:TASK_ITERATION_EVENT to {}, iterat TASK_ITERATION_HANDLING = 'handling TASK_EVENTS:TASK_ITERATION_EVENT from {}, iteration {}' -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('supported_targets', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_esp_event_user_event_loops(dut: Dut) -> None: dut.expect_exact('setting up') dut.expect_exact('starting event source') @@ -30,9 +36,9 @@ def test_esp_event_user_event_loops(dut: Dut) -> None: loop = 'loop_without_task' dut.expect(TASK_ITERATION_POSTING.format(loop, iteration)) - logging.info('Posted iteration {} to {}'.format(iteration, loop)) + logging.info(f'Posted iteration {iteration} to {loop}') dut.expect(TASK_ITERATION_HANDLING.format(loop, iteration)) - logging.info('Handled iteration {} from {}'.format(iteration, loop)) + logging.info(f'Handled iteration {iteration} from {loop}') dut.expect('deleting task event source') logging.info('Deleted task event source') diff --git a/examples/system/freertos/.build-test-rules.yml b/examples/system/freertos/.build-test-rules.yml index 40b42f396ab..53ed4f114cd 100644 --- a/examples/system/freertos/.build-test-rules.yml +++ b/examples/system/freertos/.build-test-rules.yml @@ -1,9 +1,8 @@ examples/system/freertos/basic_freertos_smp_usage: enable: - - if: IDF_TARGET == "esp32c3" or IDF_TARGET == "esp32s3" + - if: IDF_TARGET in ["esp32c3", "esp32s3", "linux"] reason: no target specific functionality, testing on a single core target and a multiple core target is sufficient depends_components: - - *common_components - freertos examples/system/freertos/psram_stack: @@ -14,9 +13,7 @@ examples/system/freertos/psram_stack: - freertos examples/system/freertos/real_time_stats: - disable: - - if: IDF_TARGET != "esp32" and (NIGHTLY_RUN != "1" or IDF_TARGET == "linux") - reason: no target specific functionality, testing on a single target is sufficient + enable: + - if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux" depends_components: - - *common_components - freertos diff --git a/examples/system/freertos/basic_freertos_smp_usage/README.md b/examples/system/freertos/basic_freertos_smp_usage/README.md index 43c593aa431..69a345bf396 100644 --- a/examples/system/freertos/basic_freertos_smp_usage/README.md +++ b/examples/system/freertos/basic_freertos_smp_usage/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-C3 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-C3 | ESP32-S3 | Linux | +| ----------------- | -------- | -------- | ----- | # FreeRTOS basic API SMP usages Example diff --git a/examples/system/freertos/basic_freertos_smp_usage/pytest_smp_examples.py b/examples/system/freertos/basic_freertos_smp_usage/pytest_smp_examples.py index 84eb66927c6..9587c0e1a92 100644 --- a/examples/system/freertos/basic_freertos_smp_usage/pytest_smp_examples.py +++ b/examples/system/freertos/basic_freertos_smp_usage/pytest_smp_examples.py @@ -1,14 +1,20 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded_idf.dut import IdfDut from pytest_embedded_idf.utils import idf_parametrize +TARGETS = [ + ('esp32c3', pytest.mark.generic), + ('esp32s3', pytest.mark.generic), + ('linux', pytest.mark.host_test), +] +PROMPT = r'(?:esp32(?:[a-zA-Z]\d)?|linux)>' -@pytest.mark.generic -@idf_parametrize('target', ['esp32c3', 'esp32s3'], indirect=['target']) + +@idf_parametrize('target,markers', TARGETS, indirect=['target']) def test_creating_task(dut: IdfDut) -> None: - dut.expect(r'esp32(?:[a-zA-Z]\d)?>') + dut.expect(PROMPT) # test creating_task dut.write('create_task') expected_patterns = [ @@ -20,10 +26,9 @@ def test_creating_task(dut: IdfDut) -> None: dut.expect(expected_patterns, expect_all=True) -@pytest.mark.generic -@idf_parametrize('target', ['esp32c3', 'esp32s3'], indirect=['target']) +@idf_parametrize('target,markers', TARGETS, indirect=['target']) def test_queue(dut: IdfDut) -> None: - dut.expect(r'esp32(?:[a-zA-Z]\d)?>') + dut.expect(PROMPT) # test queue tasks verify_amount = 5 dut.write('queue') @@ -35,10 +40,9 @@ def test_queue(dut: IdfDut) -> None: dut.expect('queue example: received data = ' + str(data)) -@pytest.mark.generic -@idf_parametrize('target', ['esp32c3', 'esp32s3'], indirect=['target']) +@idf_parametrize('target,markers', TARGETS, indirect=['target']) def test_locks(dut: IdfDut) -> None: - dut.expect(r'esp32(?:[a-zA-Z]\d)?>') + dut.expect(PROMPT) # test locks dut.write('lock') expected_patterns = [ @@ -51,10 +55,9 @@ def test_locks(dut: IdfDut) -> None: dut.expect(expected_patterns, expect_all=True) -@pytest.mark.generic -@idf_parametrize('target', ['esp32c3', 'esp32s3'], indirect=['target']) +@idf_parametrize('target,markers', TARGETS, indirect=['target']) def test_task_notification(dut: IdfDut) -> None: - dut.expect(r'esp32(?:[a-zA-Z]\d)?>') + dut.expect(PROMPT) # test task notification dut.write('task_notification') dut.expect('task notify example: send_task sends a notification') @@ -62,10 +65,9 @@ def test_task_notification(dut: IdfDut) -> None: dut.expect('task notify example: rcv_task is processing this task notification') -@pytest.mark.generic -@idf_parametrize('target', ['esp32c3', 'esp32s3'], indirect=['target']) +@idf_parametrize('target,markers', TARGETS, indirect=['target']) def test_batch_proc_example(dut: IdfDut) -> None: - dut.expect(r'esp32(?:[a-zA-Z]\d)?>') + dut.expect(PROMPT) # test batch processing example dut.write('batch_processing') diff --git a/examples/system/freertos/real_time_stats/README.md b/examples/system/freertos/real_time_stats/README.md index adc73dcc3d4..cc3904d5735 100644 --- a/examples/system/freertos/real_time_stats/README.md +++ b/examples/system/freertos/real_time_stats/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | Linux | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | ----- | # FreeRTOS Real Time Stats Example diff --git a/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c b/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c index c785b1091f5..e2b8b17c850 100644 --- a/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c +++ b/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c @@ -157,7 +157,7 @@ static void stats_task(void *arg) //Print real time stats periodically while (1) { - printf("\n\nGetting real time stats over %"PRIu32" ticks\n", STATS_TICKS); + printf("\n\nGetting real time stats over %"PRIu32" ticks\n", (uint32_t)STATS_TICKS); if (print_real_time_stats(STATS_TICKS) == ESP_OK) { printf("Real time stats obtained\n"); } else { diff --git a/examples/system/freertos/real_time_stats/pytest_freertos_real_time_stats.py b/examples/system/freertos/real_time_stats/pytest_freertos_real_time_stats.py index f4d7745b82a..7d51655e370 100644 --- a/examples/system/freertos/real_time_stats/pytest_freertos_real_time_stats.py +++ b/examples/system/freertos/real_time_stats/pytest_freertos_real_time_stats.py @@ -1,12 +1,18 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('supported_targets', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_freertos_real_time_stats(dut: Dut) -> None: for _ in range(0, 3): dut.expect_exact('Real time stats obtained') diff --git a/examples/system/pthread/README.md b/examples/system/pthread/README.md index 9c114fe9864..dc68adcccaa 100644 --- a/examples/system/pthread/README.md +++ b/examples/system/pthread/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | +| Supported Targets | ESP32 | ESP32-C3 | Linux | +| ----------------- | ----- | -------- | ----- | # Pthread Example diff --git a/examples/system/pthread/main/CMakeLists.txt b/examples/system/pthread/main/CMakeLists.txt index 8e83aec55f3..62c12172afa 100644 --- a/examples/system/pthread/main/CMakeLists.txt +++ b/examples/system/pthread/main/CMakeLists.txt @@ -1,2 +1,3 @@ idf_component_register(SRCS "pthread_example.c" - INCLUDE_DIRS ".") + INCLUDE_DIRS "." + PRIV_REQUIRES pthread) diff --git a/examples/system/pthread/main/pthread_example.c b/examples/system/pthread/main/pthread_example.c index cb55bcc19c0..16f8bf74788 100644 --- a/examples/system/pthread/main/pthread_example.c +++ b/examples/system/pthread/main/pthread_example.c @@ -1,3 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ /* Pthread Example This example code is in the Public Domain (or CC0 licensed, at your option.) @@ -26,7 +31,7 @@ void app_main(void) // Create a pthread with the default parameters res = pthread_create(&thread1, NULL, example_thread, NULL); assert(res == 0); - printf("Created thread 0x%"PRIx32"\n", thread1); + printf("Created thread 0x%"PRIxPTR"\n", (uintptr_t)thread1); // Create a pthread with a larger stack size using the standard API res = pthread_attr_init(&attr); @@ -34,7 +39,7 @@ void app_main(void) pthread_attr_setstacksize(&attr, 16384); res = pthread_create(&thread2, &attr, example_thread, NULL); assert(res == 0); - printf("Created larger stack thread 0x%"PRIx32"\n", thread2); + printf("Created larger stack thread 0x%"PRIxPTR"\n", (uintptr_t)thread2); res = pthread_join(thread1, NULL); assert(res == 0); @@ -50,7 +55,7 @@ void app_main(void) res = pthread_create(&thread1, NULL, example_thread, NULL); assert(res == 0); - printf("Created thread 0x%"PRIx32" with new default config\n", thread1); + printf("Created thread 0x%"PRIxPTR" with new default config\n", (uintptr_t)thread1); res = pthread_join(thread1, NULL); assert(res == 0); printf("Thread has exited\n\n"); @@ -59,10 +64,11 @@ void app_main(void) static void *example_thread(void * arg) { usleep(250 * 1000); - printf("This thread has ID 0x%"PRIx32" and %u bytes free stack\n", pthread_self(), uxTaskGetStackHighWaterMark(NULL)); + printf("This thread has ID 0x%"PRIxPTR" and %lu bytes free stack\n", + (uintptr_t)pthread_self(), (unsigned long)uxTaskGetStackHighWaterMark(NULL)); sleep(1); - printf("Thread 0x%"PRIx32" exiting\n", pthread_self()); + printf("Thread 0x%"PRIxPTR" exiting\n", (uintptr_t)pthread_self()); return NULL; } diff --git a/examples/system/pthread/pytest_pthread.py b/examples/system/pthread/pytest_pthread.py index 9b533d8058a..0b29e1fa441 100644 --- a/examples/system/pthread/pytest_pthread.py +++ b/examples/system/pthread/pytest_pthread.py @@ -1,12 +1,19 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('esp32', pytest.mark.generic), + ('esp32c3', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_pthread(dut: Dut) -> None: # Note: this test doesn't really confirm anything, except that threads are created # and stdout is not being corrupted by multiple threads printing ot it. diff --git a/examples/system/rt_mqueue/README.md b/examples/system/rt_mqueue/README.md index 5ab64ca987b..9fb32739f8c 100644 --- a/examples/system/rt_mqueue/README.md +++ b/examples/system/rt_mqueue/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | +| Supported Targets | ESP32 | ESP32-C3 | Linux | +| ----------------- | ----- | -------- | ----- | # POSIX Message Queue Example diff --git a/examples/system/rt_mqueue/pytest_rt_mqueue.py b/examples/system/rt_mqueue/pytest_rt_mqueue.py index 0a1bfc909d1..b41b9865016 100644 --- a/examples/system/rt_mqueue/pytest_rt_mqueue.py +++ b/examples/system/rt_mqueue/pytest_rt_mqueue.py @@ -1,12 +1,19 @@ -# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('esp32', pytest.mark.generic), + ('esp32c3', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_rt_mqueue_example(dut: Dut) -> None: dut.expect_exact('sending: 0') dut.expect_exact('received: 0') diff --git a/examples/system/unit_test/README.md b/examples/system/unit_test/README.md index 3ead2ca7b87..f5a8783d0b7 100644 --- a/examples/system/unit_test/README.md +++ b/examples/system/unit_test/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- | +| Supported Targets | ESP32 | ESP32-C3 | Linux | +| ----------------- | ----- | -------- | ----- | # Unit Testing diff --git a/examples/system/unit_test/pytest_unittest.py b/examples/system/unit_test/pytest_unittest.py index 1360c14d97b..037b35cf791 100644 --- a/examples/system/unit_test/pytest_unittest.py +++ b/examples/system/unit_test/pytest_unittest.py @@ -1,12 +1,19 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -@pytest.mark.generic -@idf_parametrize('target', ['supported_targets'], indirect=['target']) +@idf_parametrize( + 'target,markers', + [ + ('esp32', pytest.mark.generic), + ('esp32c3', pytest.mark.generic), + ('linux', pytest.mark.host_test), + ], + indirect=['target'], +) def test_unit_test(dut: Dut) -> None: def get_reg_nums(number: int) -> str: return r'\d{1,2}\s+' * number