[klibc] [klibc:master] tests: Add a trivial test for sysconf()

klibc-bot for Ben Hutchings ben at decadent.org.uk
Sat Jul 25 14:54:02 PDT 2020


Commit-ID:  3df6e74ab78fc63aa025d07fb849ec9508cbf1c2
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=3df6e74ab78fc63aa025d07fb849ec9508cbf1c2
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Sat, 25 Jul 2020 22:46:16 +0100
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 25 Jul 2020 22:51:45 +0100

[klibc] tests: Add a trivial test for sysconf()

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/klibc/tests/Kbuild    |  1 +
 usr/klibc/tests/sysconf.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/usr/klibc/tests/Kbuild b/usr/klibc/tests/Kbuild
index c7ca531f..00b701fc 100644
--- a/usr/klibc/tests/Kbuild
+++ b/usr/klibc/tests/Kbuild
@@ -45,6 +45,7 @@ stdio.shared-y		:= stdio.o
 strlcpycat.shared-y	:= strlcpycat.o
 strtoimax.shared-y	:= strtoimax.o
 strtotime.shared-y	:= strtotime.o
+sysconf.shared-y	:= sysconf.o
 testrand48.shared-y	:= testrand48.o
 testvsnp.shared-y	:= testvsnp.o
 vfork.shared-y		:= vfork.o
diff --git a/usr/klibc/tests/sysconf.c b/usr/klibc/tests/sysconf.c
new file mode 100644
index 00000000..e32c1383
--- /dev/null
+++ b/usr/klibc/tests/sysconf.c
@@ -0,0 +1,14 @@
+#include <assert.h>
+#include <stdio.h>
+#include <sys/sysconf.h>
+
+int main(void)
+{
+	long rc;
+
+	rc = sysconf(_SC_PAGESIZE);
+	assert(rc > 0);
+	printf("sysconf(_SC_PAGESIZE) = %ld\n", rc);
+
+	return 0;
+}


More information about the klibc mailing list