[libc-commits] [libc] [libc] Implement getrusage and corresponding unit tests. (PR #217684)
Vadim Kotov via libc-commits
libc-commits at lists.llvm.org
Tue Aug 25 13:45:59 PDT 2026
================
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Unittests for getrusage.
+///
+//===----------------------------------------------------------------------===//
+
+#include "hdr/sys_resource_macros.h"
+#include "hdr/types/struct_rusage.h"
+#include "src/sys/resource/getrusage.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibcGetrusageTest, BasicTest) {
+ struct rusage usage = {};
+ int res = LIBC_NAMESPACE::getrusage(RUSAGE_SELF, &usage);
+ EXPECT_EQ(res, 0);
----------------
vadimkotov wrote:
Done (31a72fdb56a11eaaf4d508561328364875eadfb2)
https://github.com/llvm/llvm-project/pull/217684
More information about the libc-commits
mailing list