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