From 7ac7ad63d881c9da37c4e52ec7396698a84a0b6d Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 17 Aug 2010 09:42:50 +0000 Subject: Add simple test to check the functioning of retrieval of pagesize()/pagesizes() after change to use aux vector. Note that public function getosreldate() is different from libc-internal __getosreldate() and does not use aux to fetch osreldate value. MFC after: 1 month --- tools/test/auxinfo/auxinfo.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tools/test/auxinfo/auxinfo.c (limited to 'tools/test/auxinfo/auxinfo.c') diff --git a/tools/test/auxinfo/auxinfo.c b/tools/test/auxinfo/auxinfo.c new file mode 100644 index 000000000000..374bed8b4299 --- /dev/null +++ b/tools/test/auxinfo/auxinfo.c @@ -0,0 +1,58 @@ +/* + * This file is in public domain. + * Written by Konstantin Belousov + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include + +static void +test_pagesizes(void) +{ + size_t *ps; + int i, nelem; + + nelem = getpagesizes(NULL, 0); + if (nelem == -1) + err(1, "getpagesizes(NULL, 0)"); + ps = malloc(nelem * sizeof(size_t)); + if (ps == NULL) + err(1, "malloc"); + nelem = getpagesizes(ps, nelem); + if (nelem == -1) + err(1, "getpagesizes"); + printf("Supported page sizes:"); + for (i = 0; i < nelem; i++) + printf(" %jd", (intmax_t)ps[i]); + printf("\n"); +} + +static void +test_pagesize(void) +{ + + printf("Pagesize: %d\n", getpagesize()); +} + +static void +test_osreldate(void) +{ + + printf("OSRELDATE: %d\n", getosreldate()); +} + +int +main(int argc __unused, char *argv[] __unused) +{ + + test_pagesizes(); + test_pagesize(); + test_osreldate(); + return (0); +} -- cgit v1.2.3