summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/strerror
diff options
context:
space:
mode:
authorotto <>2005-05-13 07:06:20 +0000
committerotto <>2005-05-13 07:06:20 +0000
commit7a9523dcbcec5c3638509400789169fe50046cab (patch)
tree34ff24afdefacae163dc6d9b131995732ce89cea /src/regress/lib/libc/strerror
parentb446140f20db25670fa942363c63b4568ddfcbd5 (diff)
downloadopenbsd-7a9523dcbcec5c3638509400789169fe50046cab.tar.gz
openbsd-7a9523dcbcec5c3638509400789169fe50046cab.tar.bz2
openbsd-7a9523dcbcec5c3638509400789169fe50046cab.zip
Add tests for __strsignal(). Put here since the tests are very similar
to the strerror() test.
Diffstat (limited to 'src/regress/lib/libc/strerror')
-rw-r--r--src/regress/lib/libc/strerror/strerror_test.c24
-rw-r--r--src/regress/lib/libc/strerror/valid.ok9
2 files changed, 32 insertions, 1 deletions
diff --git a/src/regress/lib/libc/strerror/strerror_test.c b/src/regress/lib/libc/strerror/strerror_test.c
index 670f8c5616..700080cd3e 100644
--- a/src/regress/lib/libc/strerror/strerror_test.c
+++ b/src/regress/lib/libc/strerror/strerror_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strerror_test.c,v 1.3 2005/05/08 06:34:25 otto Exp $ */ 1/* $OpenBSD: strerror_test.c,v 1.4 2005/05/13 07:06:20 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> 3 * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
4 * 4 *
@@ -14,6 +14,7 @@
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17#include <signal.h>
17#include <string.h> 18#include <string.h>
18#include <stdio.h> 19#include <stdio.h>
19#include <limits.h> 20#include <limits.h>
@@ -34,6 +35,18 @@ check_strerror_r(int val)
34 } 35 }
35} 36}
36 37
38void
39check_strsignal(int val)
40{
41 char buffer[NL_TEXTMAX + 1];
42 int i, r;
43
44 memset(buffer, 'X', sizeof(buffer) - 1);
45 buffer[sizeof(buffer) - 1] = '\0';
46 (void)__strsignal(val, buffer);
47 printf("%s\n", buffer);
48}
49
37int 50int
38main() 51main()
39{ 52{
@@ -45,5 +58,14 @@ main()
45 printf("%s\n", strerror(EPERM)); 58 printf("%s\n", strerror(EPERM));
46 check_strerror_r(EPERM); 59 check_strerror_r(EPERM);
47 check_strerror_r(21345); 60 check_strerror_r(21345);
61 check_strsignal(-1);
62 check_strsignal(0);
63 check_strsignal(10);
64 check_strsignal(NSIG-1);
65 check_strsignal(NSIG);
66 check_strsignal(100);
67 check_strsignal(INT_MAX);
68 check_strsignal(INT_MIN);
69 check_strsignal(UINT_MAX);
48 return 0; 70 return 0;
49} 71}
diff --git a/src/regress/lib/libc/strerror/valid.ok b/src/regress/lib/libc/strerror/valid.ok
index d3061a1047..ee602a4b13 100644
--- a/src/regress/lib/libc/strerror/valid.ok
+++ b/src/regress/lib/libc/strerror/valid.ok
@@ -54,3 +54,12 @@ Operation not permitted
5422 22 20: Unknown error: 21345 5422 22 20: Unknown error: 21345
5523 22 20: Unknown error: 21345 5523 22 20: Unknown error: 21345
5624 22 20: Unknown error: 21345 5624 22 20: Unknown error: 21345
57Unknown signal: 4294967295
58Signal 0
59Bus error
60User defined signal 2
61Unknown signal: 32
62Unknown signal: 100
63Unknown signal: 2147483647
64Unknown signal: 2147483648
65Unknown signal: 4294967295