summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2024-10-11 07:54:22 +0000
committerjsing <>2024-10-11 07:54:22 +0000
commitdfaf47c51a7fa1f113185ca620cb5c7e29183a37 (patch)
treef94db0febba9fc6db8227638af95ce251df3c75d
parent26c4ae05cadee4d742c2f47d99ddb52c615f3863 (diff)
downloadopenbsd-dfaf47c51a7fa1f113185ca620cb5c7e29183a37.tar.gz
openbsd-dfaf47c51a7fa1f113185ca620cb5c7e29183a37.tar.bz2
openbsd-dfaf47c51a7fa1f113185ca620cb5c7e29183a37.zip
Add error regress coverage for ERR_LIB_SYS.
These are dynamically populated based on strerror() values.
-rw-r--r--src/regress/lib/libcrypto/err/err_test.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/err/err_test.c b/src/regress/lib/libcrypto/err/err_test.c
index 16fd675e11..d31c61fa1c 100644
--- a/src/regress/lib/libcrypto/err/err_test.c
+++ b/src/regress/lib/libcrypto/err/err_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err_test.c,v 1.1 2024/10/02 14:41:46 jsing Exp $ */ 1/* $OpenBSD: err_test.c,v 1.2 2024/10/11 07:54:22 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -130,6 +130,24 @@ err_test(void)
130 130
131 ERR_clear_error(); 131 ERR_clear_error();
132 132
133 /*
134 * Check SYSerror() reasons, which are dynamically populated from
135 * strerror().
136 */
137 ERR_put_error(ERR_LIB_SYS, 0xfff, 1, "err.c", 300);
138
139 if ((err = ERR_get_error()) != 0x2fff001UL) {
140 fprintf(stderr, "FAIL: ERR_get_error() = %lx, want "
141 "0x2fff001UL\n", err);
142 goto failure;
143 }
144 s = ERR_reason_error_string(err);
145 if (strcmp(s, strerror(ERR_GET_REASON(err))) != 0) {
146 fprintf(stderr, "FAIL: ERR_reason_error_string() = '%s', "
147 "want '%s'\n", s, strerror(ERR_GET_REASON(err)));
148 goto failure;
149 }
150
133 s = ERR_lib_error_string(0x3fff067UL); 151 s = ERR_lib_error_string(0x3fff067UL);
134 if (strcmp(s, "bignum routines") != 0) { 152 if (strcmp(s, "bignum routines") != 0) {
135 fprintf(stderr, "FAIL: ERR_lib_error_string() = '%s', " 153 fprintf(stderr, "FAIL: ERR_lib_error_string() = '%s', "