summaryrefslogtreecommitdiff
path: root/regress/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-05-13 07:06:21 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-05-13 07:06:21 +0000
commit81f22f2232a4227a0010b884d1567c4b065df260 (patch)
tree12873b54d0e21464a4d10027dfa0fc6d2dcdeb75 /regress/lib/libc
parente11776711108a35d66d8c57b077134bed3e1acfb (diff)
Add tests for __strsignal(). Put here since the tests are very similar
to the strerror() test.
Diffstat (limited to 'regress/lib/libc')
-rw-r--r--regress/lib/libc/strerror/strerror_test.c24
-rw-r--r--regress/lib/libc/strerror/valid.ok9
2 files changed, 32 insertions, 1 deletions
diff --git a/regress/lib/libc/strerror/strerror_test.c b/regress/lib/libc/strerror/strerror_test.c
index 670f8c5616d..700080cd3ec 100644
--- a/regress/lib/libc/strerror/strerror_test.c
+++ b/regress/lib/libc/strerror/strerror_test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strerror_test.c,v 1.3 2005/05/08 06:34:25 otto Exp $ */
+/* $OpenBSD: strerror_test.c,v 1.4 2005/05/13 07:06:20 otto Exp $ */
/*
* Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
*
@@ -14,6 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
@@ -34,6 +35,18 @@ check_strerror_r(int val)
}
}
+void
+check_strsignal(int val)
+{
+ char buffer[NL_TEXTMAX + 1];
+ int i, r;
+
+ memset(buffer, 'X', sizeof(buffer) - 1);
+ buffer[sizeof(buffer) - 1] = '\0';
+ (void)__strsignal(val, buffer);
+ printf("%s\n", buffer);
+}
+
int
main()
{
@@ -45,5 +58,14 @@ main()
printf("%s\n", strerror(EPERM));
check_strerror_r(EPERM);
check_strerror_r(21345);
+ check_strsignal(-1);
+ check_strsignal(0);
+ check_strsignal(10);
+ check_strsignal(NSIG-1);
+ check_strsignal(NSIG);
+ check_strsignal(100);
+ check_strsignal(INT_MAX);
+ check_strsignal(INT_MIN);
+ check_strsignal(UINT_MAX);
return 0;
}
diff --git a/regress/lib/libc/strerror/valid.ok b/regress/lib/libc/strerror/valid.ok
index d3061a10472..ee602a4b132 100644
--- a/regress/lib/libc/strerror/valid.ok
+++ b/regress/lib/libc/strerror/valid.ok
@@ -54,3 +54,12 @@ Operation not permitted
22 22 20: Unknown error: 21345
23 22 20: Unknown error: 21345
24 22 20: Unknown error: 21345
+Unknown signal: 4294967295
+Signal 0
+Bus error
+User defined signal 2
+Unknown signal: 32
+Unknown signal: 100
+Unknown signal: 2147483647
+Unknown signal: 2147483648
+Unknown signal: 4294967295