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

Indexes created Thu Nov 07 10:32:03 CST 2024