This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 3bd8506ae83deae4b41d1255b33503c8f81b6562 Author: buxiasen <[email protected]> AuthorDate: Thu Sep 11 15:12:26 2025 +0800 testing/ostest/roundrobin: add compatible for SMP Fix if SMP cause calculation run in multi-core cause case break. Signed-off-by: buxiasen <[email protected]> --- testing/ostest/roundrobin.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/testing/ostest/roundrobin.c b/testing/ostest/roundrobin.c index 2735ba028..ed2f98ddb 100644 --- a/testing/ostest/roundrobin.c +++ b/testing/ostest/roundrobin.c @@ -160,6 +160,9 @@ void rr_test(void) bool test_passed = false; pthread_attr_t attr; pthread_addr_t result; +#ifdef CONFIG_SMP + cpu_set_t cpuset; +#endif int status; int i; @@ -199,6 +202,20 @@ void rr_test(void) printf("rr_test: Set thread policy to SCHED_RR\n"); } +#ifdef CONFIG_SMP + /* RR case on SMP only run on core0 */ + + CPU_ZERO(&cpuset); + CPU_SET(0, &cpuset); + status = pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset); + if (status != OK) + { + printf("rr_test: ERROR: pthread_attr_setaffinity_np failed," + " status=%d\n", status); + ASSERT(false); + } +#endif + /* This semaphore will prevent anything from running until we are ready */ sched_lock();
