1 /*
2  * Copyright (c) 2022 Meta
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "_common.h"
8 
9 #ifdef CONFIG_POSIX_API
10 #include <sched.h>
11 #else
12 #include <zephyr/posix/sched.h>
13 #endif
14 
15 /**
16  * @brief existence test for `<sched.h>`
17  *
18  * @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html">sched.h</a>
19  */
ZTEST(posix_headers,test_sched_h)20 ZTEST(posix_headers, test_sched_h)
21 {
22 	zassert_not_equal(-1, offsetof(struct sched_param, sched_priority));
23 
24 	zassert_not_equal(-1, SCHED_FIFO);
25 	zassert_not_equal(-1, SCHED_RR);
26 	/* zassert_not_equal(-1, SCHED_SPORADIC); */ /* not implemented */
27 	/* zassert_not_equal(-1, SCHED_OTHER); */ /* not implemented */
28 
29 	if (IS_ENABLED(CONFIG_POSIX_API)) {
30 		zassert_not_null(sched_get_priority_max);
31 		zassert_not_null(sched_get_priority_min);
32 
33 		/* zassert_not_null(sched_getparam); */ /* not implemented */
34 		/* zassert_not_null(sched_getscheduler); */ /* not implemented */
35 
36 		/* zassert_not_null(sched_rr_get_interval); */ /* not implemented */
37 
38 		/* zassert_not_null(sched_setparam); */ /* not implemented */
39 		/* zassert_not_null(sched_setscheduler); */ /* not implemented */
40 
41 		zassert_not_null(sched_yield);
42 	}
43 }
44