Skip to content

Commit 254c671

Browse files
Christopher Friedtcfriedt
authored andcommitted
tests: posix: common: init check for stdin, stdout, and stderr
Add a test to help ensure stdin, stdout, and stderr are initialized statically. Signed-off-by: Christopher Friedt <[email protected]>
1 parent 12ea06c commit 254c671

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/posix/common/src/_main.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <pthread.h>
8-
97
#include <zephyr/ztest.h>
108

11-
ZTEST_SUITE(posix_apis, NULL, NULL, NULL, NULL, NULL);
9+
extern bool fdtable_fd_is_initialized(int fd);
10+
11+
static void *setup(void)
12+
{
13+
/* ensure that the the stdin, stdout, and stderr fdtable entries are initialized */
14+
zassert_true(fdtable_fd_is_initialized(0));
15+
zassert_true(fdtable_fd_is_initialized(1));
16+
zassert_true(fdtable_fd_is_initialized(2));
17+
18+
return NULL;
19+
}
20+
21+
ZTEST_SUITE(posix_apis, NULL, setup, NULL, NULL, NULL);

0 commit comments

Comments
 (0)