From f61f9c29d8cd4a1213108b456e99e131375b680d Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Tue, 25 Feb 2025 13:22:10 -0500 Subject: [PATCH] test: handle UV_ENOTSUP in platform_output (#4714) Fixes: https://github.com/libuv/libuv/issues/4713 --- test/test-platform-output.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/test/test-platform-output.c b/test/test-platform-output.c index d9b39c74..06a8e484 100644 --- a/test/test-platform-output.c +++ b/test/test-platform-output.c @@ -236,21 +236,24 @@ TEST_IMPL(platform_output) { printf(" version: %s\n", uname.version); printf(" machine: %s\n", uname.machine); - ASSERT_OK(uv_getrusage_thread(&rusage)); - ASSERT_UINT64_GE(rusage.ru_utime.tv_sec, 0); - ASSERT_UINT64_GE(rusage.ru_utime.tv_usec, 0); - ASSERT_UINT64_GE(rusage.ru_stime.tv_sec, 0); - ASSERT_UINT64_GE(rusage.ru_stime.tv_usec, 0); - printf("uv_getrusage_thread:\n"); - printf(" user: %llu sec %llu microsec\n", - (unsigned long long) rusage.ru_utime.tv_sec, - (unsigned long long) rusage.ru_utime.tv_usec); - printf(" system: %llu sec %llu microsec\n", - (unsigned long long) rusage.ru_stime.tv_sec, - (unsigned long long) rusage.ru_stime.tv_usec); - printf(" page faults: %llu\n", (unsigned long long) rusage.ru_majflt); - printf(" maximum resident set size: %llu\n", - (unsigned long long) rusage.ru_maxrss); + err = uv_getrusage_thread(&rusage); + if (err != UV_ENOTSUP) { + ASSERT_OK(err); + ASSERT_UINT64_GE(rusage.ru_utime.tv_sec, 0); + ASSERT_UINT64_GE(rusage.ru_utime.tv_usec, 0); + ASSERT_UINT64_GE(rusage.ru_stime.tv_sec, 0); + ASSERT_UINT64_GE(rusage.ru_stime.tv_usec, 0); + printf("uv_getrusage_thread:\n"); + printf(" user: %llu sec %llu microsec\n", + (unsigned long long) rusage.ru_utime.tv_sec, + (unsigned long long) rusage.ru_utime.tv_usec); + printf(" system: %llu sec %llu microsec\n", + (unsigned long long) rusage.ru_stime.tv_sec, + (unsigned long long) rusage.ru_stime.tv_usec); + printf(" page faults: %llu\n", (unsigned long long) rusage.ru_majflt); + printf(" maximum resident set size: %llu\n", + (unsigned long long) rusage.ru_maxrss); + } return 0; }