• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
4  */
5 
6 /*
7  * Test for expiration timer the test should run for roughly 5 seconds
8  * when executed as time ./tst_expiration_timer
9  */
10 
11 #include "tst_test.h"
12 #include "tst_timer.h"
13 
do_test(void)14 static void do_test(void)
15 {
16 	tst_timer_start(CLOCK_MONOTONIC);
17 
18 	while (!tst_timer_expired_ms(5000))
19 		usleep(1);
20 
21 	tst_res(TPASS, "All done!");
22 }
23 
setup(void)24 static void setup(void)
25 {
26 	tst_timer_check(CLOCK_MONOTONIC);
27 }
28 
29 static struct tst_test test = {
30 	.setup = setup,
31 	.test_all = do_test,
32 };
33