1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. 4 * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com> 5 * Copyright (c) 2021 Xie Ziyao <xieziyao@huawei.com> 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 16static struct rusage *usage; 17 18struct test_case_t { 19 int who; 20 char *desc; 21} tc[] = { 22 {RUSAGE_SELF, "RUSAGE_SELF"}, 23 {RUSAGE_CHILDREN, "RUSAGE_CHILDREN"}, 24}; 25 26static 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 32static 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