diff options
author | espie <> | 2004-04-30 17:15:12 +0000 |
---|---|---|
committer | espie <> | 2004-04-30 17:15:12 +0000 |
commit | a4f10b37035e781770724661a37a45a83b65c25f (patch) | |
tree | 6a61d7d91122d65d5385f9cc2fabd4ad8758be91 /src | |
parent | 0a296eded866d7ff51a920ebce2ab8399cf97cf3 (diff) | |
download | openbsd-a4f10b37035e781770724661a37a45a83b65c25f.tar.gz openbsd-a4f10b37035e781770724661a37a45a83b65c25f.tar.bz2 openbsd-a4f10b37035e781770724661a37a45a83b65c25f.zip |
Add tests for strerror.
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libc/Makefile | 4 | ||||
-rw-r--r-- | src/regress/lib/libc/strerror/Makefile | 12 | ||||
-rw-r--r-- | src/regress/lib/libc/strerror/strerror_test.c | 28 | ||||
-rw-r--r-- | src/regress/lib/libc/strerror/valid.ok | 5 |
4 files changed, 47 insertions, 2 deletions
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile index 86c2e4b59a..935ca659d7 100644 --- a/src/regress/lib/libc/Makefile +++ b/src/regress/lib/libc/Makefile | |||
@@ -1,8 +1,8 @@ | |||
1 | # $OpenBSD: Makefile,v 1.13 2004/02/11 23:38:11 deraadt Exp $ | 1 | # $OpenBSD: Makefile,v 1.14 2004/04/30 17:15:12 espie Exp $ |
2 | 2 | ||
3 | SUBDIR+= _setjmp alloca atexit db getaddrinfo longjmp malloc | 3 | SUBDIR+= _setjmp alloca atexit db getaddrinfo longjmp malloc |
4 | SUBDIR+= popen regex setjmp setjmp-signal sigreturn sigsetjmp | 4 | SUBDIR+= popen regex setjmp setjmp-signal sigreturn sigsetjmp |
5 | SUBDIR+= sprintf time | 5 | SUBDIR+= sprintf strerror time |
6 | 6 | ||
7 | .if (${MACHINE_ARCH} != "vax") | 7 | .if (${MACHINE_ARCH} != "vax") |
8 | SUBDIR+= ieeefp | 8 | SUBDIR+= ieeefp |
diff --git a/src/regress/lib/libc/strerror/Makefile b/src/regress/lib/libc/strerror/Makefile new file mode 100644 index 0000000000..448b6da903 --- /dev/null +++ b/src/regress/lib/libc/strerror/Makefile | |||
@@ -0,0 +1,12 @@ | |||
1 | # $OpenBSD: Makefile,v 1.1 2004/04/30 17:15:12 espie Exp $ | ||
2 | |||
3 | NOMAN= | ||
4 | PROG=strerror_test | ||
5 | CPPFLAGS+=-I${.CURDIR}/../../../../lib/libc | ||
6 | CLEANFILES+= invalid.out valid.out | ||
7 | |||
8 | run-regress-strerror_test: ${PROG} | ||
9 | ./${PROG} >${.OBJDIR}/valid.out | ||
10 | cmp -s ${.OBJDIR}/valid.out ${.CURDIR}/valid.ok | ||
11 | |||
12 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/strerror/strerror_test.c b/src/regress/lib/libc/strerror/strerror_test.c new file mode 100644 index 0000000000..5b74df3a6a --- /dev/null +++ b/src/regress/lib/libc/strerror/strerror_test.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /* $OpenBSD: strerror_test.c,v 1.1 2004/04/30 17:15:12 espie Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | #include <string.h> | ||
18 | #include <stdio.h> | ||
19 | #include <limits.h> | ||
20 | int main() | ||
21 | { | ||
22 | printf("%s\n", strerror(21345)); | ||
23 | printf("%s\n", strerror(-21345)); | ||
24 | printf("%s\n", strerror(0)); | ||
25 | printf("%s\n", strerror(INT_MAX)); | ||
26 | printf("%s\n", strerror(INT_MIN)); | ||
27 | return 0; | ||
28 | } | ||
diff --git a/src/regress/lib/libc/strerror/valid.ok b/src/regress/lib/libc/strerror/valid.ok new file mode 100644 index 0000000000..25b39d3afb --- /dev/null +++ b/src/regress/lib/libc/strerror/valid.ok | |||
@@ -0,0 +1,5 @@ | |||
1 | Unknown error: 21345 | ||
2 | Unknown error: -21345 | ||
3 | Undefined error: 0 | ||
4 | Unknown error: 2147483647 | ||
5 | Unknown error: -2147483648 | ||