xref: /aosp_15_r20/external/ltp/lib/newlib_tests/test_runtime02.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2021, Linux Test Project
4  */
5 /*
6  * This test is set up so that the timeout is not long enough to guarantee
7  * enough runtime for two iterations, i.e. the timeout without offset and after
8  * scaling is too small and the tests ends up with TBROK.
9  *
10  * The default timeout in the test library is set to 30 seconds. The test
11  * runtime is set to 5 so the test should timeout after 35 seconds.
12  */
13 
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include "tst_test.h"
17 
run(void)18 static void run(void)
19 {
20 	tst_res(TINFO, "Sleeping for 40 seconds");
21 	sleep(40);
22 	tst_res(TFAIL, "Still alive");
23 }
24 
25 static struct tst_test test = {
26 	.test_all = run,
27 	.max_runtime = 5,
28 };
29