1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
4 * AUTHOR: Saji Kumar.V.R <[email protected]>
5 * Copyright (c) 2021 Xie Ziyao <[email protected]>
6 */
7
8 /*\
9 * [Description]
10 *
11 * Test that getrusage() with RUSAGE_SELF and RUSAGE_CHILDREN succeeds.
12 */
13
14 #include "tst_test.h"
15
16 static struct rusage *usage;
17
18 struct test_case_t {
19 int who;
20 char *desc;
21 } tc[] = {
22 {RUSAGE_SELF, "RUSAGE_SELF"},
23 {RUSAGE_CHILDREN, "RUSAGE_CHILDREN"},
24 };
25
run(unsigned int i)26 static void run(unsigned int i)
27 {
28
29 TST_EXP_PASS(getrusage(tc[i].who, usage), "getrusage(%s, %p)", tc[i].desc, usage);
30 }
31
32 static struct tst_test test = {
33 .tcnt = ARRAY_SIZE(tc),
34 .test = run,
35 .bufs = (struct tst_buffers[]) {
36 {&usage, .size = sizeof(struct rusage)},
37 {}
38 }
39 };
40