summaryrefslogtreecommitdiffstats
path: root/test/errtest.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2019-06-18 12:06:17 -0400
committerRichard Levitte <levitte@openssl.org>2019-06-18 23:21:38 +0200
commit8908d18cb1020f225170dd9090206842dbb6bbe6 (patch)
tree461d6e6e12596998c90804ff7487eec4aed56139 /test/errtest.c
parent7f02a0932c8c182bc2f6320748d81e86d650c1a6 (diff)
Change ERR_add_error_[v]data to append
The "add error data" functions now append to the current error. Add a test for this. Cleanup some of the ERR_put functions. In the FIPS module, always append "(in the FIPS module)" to any errors. Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9181)
Diffstat (limited to 'test/errtest.c')
-rw-r--r--test/errtest.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/errtest.c b/test/errtest.c
index 39017da8e4..df222da6f6 100644
--- a/test/errtest.c
+++ b/test/errtest.c
@@ -32,8 +32,21 @@ static int preserves_system_error(void)
#endif
}
+/* Test that calls to ERR_add_error_[v]data append */
+static int vdata_appends(void)
+{
+ const char *data;
+
+ CRYPTOerr(0, ERR_R_MALLOC_FAILURE);
+ ERR_add_error_data(1, "hello ");
+ ERR_add_error_data(1, "world");
+ ERR_get_error_line_data(NULL, NULL, &data, NULL);
+ return TEST_str_eq(data, "hello world");
+}
+
int setup_tests(void)
{
ADD_TEST(preserves_system_error);
+ ADD_TEST(vdata_appends);
return 1;
}