From d189b05f11634dc99eeb96771f1db3361bc08697 Mon Sep 17 00:00:00 2001 From: Peter Limkilde Svendsen Date: Tue, 12 Mar 2024 20:40:55 +0000 Subject: [PATCH] Add tests for further sys/resource.h constants --- tests/Makefile | 2 +- tests/resource/prio_process.c | 8 ------ tests/sys_resource/constants.c | 27 ++++++++++++++++++++ tests/{resource => sys_resource}/getrusage.c | 0 4 files changed, 28 insertions(+), 9 deletions(-) delete mode 100644 tests/resource/prio_process.c create mode 100644 tests/sys_resource/constants.c rename tests/{resource => sys_resource}/getrusage.c (100%) diff --git a/tests/Makefile b/tests/Makefile index 22e89214e2..15e6cee70e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -162,6 +162,7 @@ NAMES=\ stdlib/mktemp \ stdlib/realpath \ sys_epoll/epoll \ + sys_resource/constants \ sys_utsname/uname \ time/gettimeofday \ unistd/chdir \ @@ -188,7 +189,6 @@ NAMES=\ grp/getgrgid_r \ grp/getgrnam_r \ grp/gr_iter \ - resource/prio_process \ # resource/getrusage # time/times diff --git a/tests/resource/prio_process.c b/tests/resource/prio_process.c deleted file mode 100644 index 748b8a18c5..0000000000 --- a/tests/resource/prio_process.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main(void) { - printf("PRIO_PROCESS: %d", PRIO_PROCESS); - return 0; -} - diff --git a/tests/sys_resource/constants.c b/tests/sys_resource/constants.c new file mode 100644 index 0000000000..3513ac8008 --- /dev/null +++ b/tests/sys_resource/constants.c @@ -0,0 +1,27 @@ +#include +#include + +int main(void) { + // Checks availability of constants specified in + // https://pubs.opengroup.org/onlinepubs/7908799/xsh/sysresource.h.html + printf("PRIO_PROCESS: %d\n", PRIO_PROCESS); + printf("PRIO_PGRP: %d\n", PRIO_PGRP); + printf("PRIO_USER: %d\n", PRIO_USER); + + printf("RLIM_INFINITY: %lld\n", RLIM_INFINITY); + printf("RLIM_SAVED_MAX: %lld\n", RLIM_SAVED_MAX); + printf("RLIM_SAVED_CUR: %lld\n", RLIM_SAVED_CUR); + + printf("RUSAGE_SELF: %lld\n", RUSAGE_SELF); + printf("RUSAGE_CHILDREN: %lld\n", RUSAGE_CHILDREN); + + printf("RLIMIT_CORE: %lld\n", RLIMIT_CORE); + printf("RLIMIT_CPU: %lld\n", RLIMIT_CPU); + printf("RLIMIT_DATA: %lld\n", RLIMIT_DATA); + printf("RLIMIT_FSIZE: %lld\n", RLIMIT_FSIZE); + printf("RLIMIT_NOFILE: %lld\n", RLIMIT_NOFILE); + printf("RLIMIT_STACK: %lld\n", RLIMIT_STACK); + printf("RLIMIT_AS: %lld\n", RLIMIT_AS); + + return 0; +} diff --git a/tests/resource/getrusage.c b/tests/sys_resource/getrusage.c similarity index 100% rename from tests/resource/getrusage.c rename to tests/sys_resource/getrusage.c