diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2024-10-11 07:54:23 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2024-10-11 07:54:23 +0000 |
commit | 791cfab5be6aa51dffb220cafdd76980e914a499 (patch) | |
tree | 5264168e2bc242851016fb854effe8f597f7c282 /regress/lib/libcrypto | |
parent | 4a5ae4e3577ee4a4e23809ab99e058590bb209d0 (diff) |
Add error regress coverage for ERR_LIB_SYS.
These are dynamically populated based on strerror() values.
Diffstat (limited to 'regress/lib/libcrypto')
-rw-r--r-- | regress/lib/libcrypto/err/err_test.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/regress/lib/libcrypto/err/err_test.c b/regress/lib/libcrypto/err/err_test.c index 16fd675e113..d31c61fa1c4 100644 --- a/regress/lib/libcrypto/err/err_test.c +++ b/regress/lib/libcrypto/err/err_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err_test.c,v 1.1 2024/10/02 14:41:46 jsing Exp $ */ +/* $OpenBSD: err_test.c,v 1.2 2024/10/11 07:54:22 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> * @@ -130,6 +130,24 @@ err_test(void) ERR_clear_error(); + /* + * Check SYSerror() reasons, which are dynamically populated from + * strerror(). + */ + ERR_put_error(ERR_LIB_SYS, 0xfff, 1, "err.c", 300); + + if ((err = ERR_get_error()) != 0x2fff001UL) { + fprintf(stderr, "FAIL: ERR_get_error() = %lx, want " + "0x2fff001UL\n", err); + goto failure; + } + s = ERR_reason_error_string(err); + if (strcmp(s, strerror(ERR_GET_REASON(err))) != 0) { + fprintf(stderr, "FAIL: ERR_reason_error_string() = '%s', " + "want '%s'\n", s, strerror(ERR_GET_REASON(err))); + goto failure; + } + s = ERR_lib_error_string(0x3fff067UL); if (strcmp(s, "bignum routines") != 0) { fprintf(stderr, "FAIL: ERR_lib_error_string() = '%s', " |