commit f10db9d467c19b671989d03f3dc0af105b20b784
parent c3e16c112ab5c52986db7a90dddf8b20b78436a8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 21 Sep 2018 19:02:07 +0100
[tests/libc] Add test for errno.h
Diffstat:
3 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/lib/crt/amd64-sysv-netbsd/crt.s b/lib/crt/amd64-sysv-netbsd/crt.s
@@ -16,6 +16,8 @@ environ:
.align 8
.global _start
_start:
+ movq %rsp,%rbp
+ andq $-16,%rsp
movq 16(%rbp),%rbx
movq %rbx,environ
call main
diff --git a/tests/libc/execute/0034-errno.c b/tests/libc/execute/0034-errno.c
@@ -0,0 +1,23 @@
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+
+/*
+output:
+testing
+done
+end:
+*/
+
+int
+main()
+{
+ puts("testing");
+ assert(errno == 0);
+ assert(ERANGE != EDOM);
+ assert(ERANGE > 0);
+ assert(EDOM > 0);
+ puts("done");
+
+ return 0;
+}
diff --git a/tests/libc/execute/libc-tests.lst b/tests/libc/execute/libc-tests.lst
@@ -31,3 +31,4 @@
0031-memmove
0032-memset
0033-memcmp
+0034-errno