ref: 2d390f87f239823f51aa811504980688c24813cf
parent: aa62db1b2f210ffaa3fbc4a9a2f30b116b0240ee
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Sep 21 15:02:07 EDT 2018
[tests/libc] Add test for errno.h
--- a/lib/crt/amd64-sysv-netbsd/crt.s
+++ b/lib/crt/amd64-sysv-netbsd/crt.s
@@ -16,6 +16,8 @@
.align 8
.global _start
_start:
+ movq %rsp,%rbp
+ andq $-16,%rsp
movq 16(%rbp),%rbx
movq %rbx,environ
call main
--- /dev/null
+++ b/tests/libc/execute/0034-errno.c
@@ -1,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;
+}
--- 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