xref: /aosp_15_r20/external/ltp/lib/newlib_tests/test_runtime01.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2018, Linux Test Project
4  *
5  * Runs for 4 seconds for each test iteration.
6  */
7 #include <stdlib.h>
8 #include <unistd.h>
9 #include "tst_test.h"
10 
run(void)11 static void run(void)
12 {
13 	int runtime;
14 
15 	tst_res(TINFO, "Running variant %i", tst_variant);
16 
17 	do {
18 		runtime = tst_remaining_runtime();
19 		tst_res(TINFO, "Remaining runtime %d", runtime);
20 		sleep(1);
21 	} while (runtime);
22 
23 	tst_res(TPASS, "Finished loop!");
24 }
25 
26 static struct tst_test test = {
27 	.test_all = run,
28 	.max_runtime = 4,
29 	.test_variants = 2,
30 };
31