| 166 | } |
| 167 | |
| 168 | static int |
| 169 | test_thread_attributes_affinity(void) |
| 170 | { |
| 171 | rte_thread_t thread_id; |
| 172 | rte_thread_attr_t attr; |
| 173 | rte_cpuset_t cpuset0; |
| 174 | rte_cpuset_t cpuset1; |
| 175 | |
| 176 | RTE_TEST_ASSERT(rte_thread_attr_init(&attr) == 0, |
| 177 | "Failed to initialize thread attributes"); |
| 178 | |
| 179 | CPU_ZERO(&cpuset0); |
| 180 | RTE_TEST_ASSERT(rte_thread_get_affinity_by_id(rte_thread_self(), &cpuset0) == 0, |
| 181 | "Failed to get thread affinity"); |
| 182 | RTE_TEST_ASSERT(rte_thread_attr_set_affinity(&attr, &cpuset0) == 0, |
| 183 | "Failed to set thread attributes affinity"); |
| 184 | RTE_TEST_ASSERT(rte_thread_attr_get_affinity(&attr, &cpuset1) == 0, |
| 185 | "Failed to get thread attributes affinity"); |
| 186 | RTE_TEST_ASSERT(memcmp(&cpuset0, &cpuset1, sizeof(rte_cpuset_t)) == 0, |
| 187 | "Affinity should be stable"); |
| 188 | |
| 189 | thread_id_ready = 0; |
| 190 | RTE_TEST_ASSERT(rte_thread_create(&thread_id, &attr, thread_main, NULL) == 0, |
| 191 | "Failed to create attributes affinity thread."); |
| 192 | |
| 193 | while (__atomic_load_n(&thread_id_ready, __ATOMIC_ACQUIRE) == 0) |
| 194 | ; |
| 195 | |
| 196 | RTE_TEST_ASSERT(rte_thread_get_affinity_by_id(thread_id, &cpuset1) == 0, |
| 197 | "Failed to get attributes thread affinity"); |
| 198 | RTE_TEST_ASSERT(memcmp(&cpuset0, &cpuset1, sizeof(rte_cpuset_t)) == 0, |
| 199 | "Failed to apply affinity attributes"); |
| 200 | |
| 201 | __atomic_store_n(&thread_id_ready, 2, __ATOMIC_RELEASE); |
| 202 | |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | static int |
| 207 | test_thread_attributes_priority(void) |
nothing calls this directly
no test coverage detected