Skip to content

Commit 5eb0bbe

Browse files
Christopher Friedtcfriedt
authored andcommitted
tests: posix: pthread_attr: skip when large stack allocation fails
Rather than fail when attempting to set an extraordinarily large pthread stack size (much larger than most Zephyr platforms have) consider the test non-fatal and skip it. Signed-off-by: Christopher Friedt <[email protected]>
1 parent 3ef7f2a commit 5eb0bbe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/posix/common/src/pthread_attr.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,12 @@ ZTEST(pthread_attr, test_pthread_attr_large_stacksize)
444444
size_t actual_size;
445445
const size_t expect_size = BIT(CONFIG_POSIX_PTHREAD_ATTR_STACKSIZE_BITS);
446446

447-
zassert_ok(pthread_attr_setstacksize(&attr, expect_size));
447+
if (pthread_attr_setstacksize(&attr, expect_size) != 0) {
448+
TC_PRINT("Unable to allocate large stack of size %zu (skipping)\n", expect_size);
449+
ztest_test_skip();
450+
return;
451+
}
452+
448453
zassert_ok(pthread_attr_getstacksize(&attr, &actual_size));
449454
zassert_equal(actual_size, expect_size);
450455
}

0 commit comments

Comments
 (0)