summaryrefslogtreecommitdiff
path: root/lib/libexpat/tests
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-05-10 17:36:49 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-05-10 17:36:49 +0000
commitcc4e1e0440f1af1adb7fbcae5d0762ecd3c2114a (patch)
tree5bd941129776e08e4df16e51799d46ab6bfedd74 /lib/libexpat/tests
parentc3fc5670031608bfcb0f970330e3bc119ab48333 (diff)
Update libexpat to 2.3.0. Relevant for OpenBSD are only bug fix
#438 and other change #443. A new error constant has been added to a public header file. According to guenther@ this is an ABI break that requires a major bump. OK tb@; tested by matthieu@
Diffstat (limited to 'lib/libexpat/tests')
-rw-r--r--lib/libexpat/tests/minicheck.c29
-rw-r--r--lib/libexpat/tests/runtests.c35
2 files changed, 32 insertions, 32 deletions
diff --git a/lib/libexpat/tests/minicheck.c b/lib/libexpat/tests/minicheck.c
index a5a1efb159f..ab0c35fd609 100644
--- a/lib/libexpat/tests/minicheck.c
+++ b/lib/libexpat/tests/minicheck.c
@@ -141,11 +141,18 @@ _check_set_test_info(char const *function, char const *filename, int lineno) {
}
static void
-add_failure(SRunner *runner, int verbosity) {
- runner->nfailures++;
+handle_success(int verbosity) {
if (verbosity >= CK_VERBOSE) {
- printf("%s:%d: %s\n", _check_current_filename, _check_current_lineno,
- _check_current_function);
+ printf("PASS: %s\n", _check_current_function);
+ }
+}
+
+static void
+handle_failure(SRunner *runner, int verbosity, const char *phase_info) {
+ runner->nfailures++;
+ if (verbosity != CK_SILENT) {
+ printf("FAIL: %s (%s at %s:%d)\n", _check_current_function, phase_info,
+ _check_current_filename, _check_current_lineno);
}
}
@@ -164,14 +171,14 @@ srunner_run_all(SRunner *runner, int verbosity) {
if (tc->setup != NULL) {
/* setup */
if (setjmp(env)) {
- add_failure(runner, verbosity);
+ handle_failure(runner, verbosity, "during setup");
continue;
}
tc->setup();
}
/* test */
if (setjmp(env)) {
- add_failure(runner, verbosity);
+ handle_failure(runner, verbosity, "during actual test");
continue;
}
(tc->tests[i])();
@@ -179,15 +186,17 @@ srunner_run_all(SRunner *runner, int verbosity) {
/* teardown */
if (tc->teardown != NULL) {
if (setjmp(env)) {
- add_failure(runner, verbosity);
+ handle_failure(runner, verbosity, "during teardown");
continue;
}
tc->teardown();
}
+
+ handle_success(verbosity);
}
tc = tc->next_tcase;
}
- if (verbosity) {
+ if (verbosity != CK_SILENT) {
int passed = runner->nchecks - runner->nfailures;
double percentage = ((double)passed) / runner->nchecks;
int display = (int)(percentage * 100);
@@ -203,8 +212,8 @@ _fail_unless(int condition, const char *file, int line, const char *msg) {
it is.
*/
UNUSED_P(condition);
- UNUSED_P(file);
- UNUSED_P(line);
+ _check_current_filename = file;
+ _check_current_lineno = line;
if (msg != NULL) {
const int has_newline = (msg[strlen(msg) - 1] == '\n');
fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n");
diff --git a/lib/libexpat/tests/runtests.c b/lib/libexpat/tests/runtests.c
index 2490d86b9ab..91ab4f211b5 100644
--- a/lib/libexpat/tests/runtests.c
+++ b/lib/libexpat/tests/runtests.c
@@ -45,28 +45,10 @@
#include <stddef.h> /* ptrdiff_t */
#include <ctype.h>
#include <limits.h>
-
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)
-/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
-# if defined(_WIN64)
-typedef __int64 intptr_t;
-# else
-typedef __int32 intptr_t;
-# endif
-typedef unsigned __int64 uint64_t;
-#else
-# include <stdint.h> /* intptr_t uint64_t */
-#endif
+#include <stdint.h> /* intptr_t uint64_t */
#if ! defined(__cplusplus)
-# if defined(_MSC_VER) && (_MSC_VER <= 1700)
-/* for vs2012/11.0/1700 and earlier Visual Studio compilers */
-# define bool int
-# define false 0
-# define true 1
-# else
-# include <stdbool.h>
-# endif
+# include <stdbool.h>
#endif
#include "expat.h"
@@ -1779,7 +1761,7 @@ START_TEST(test_not_standalone_handler_accept) {
XML_SetNotStandaloneHandler(g_parser, accept_not_standalone_handler);
run_ext_character_check(text, &test_data, XCS(""));
- /* Repeat wtihout the external entity handler */
+ /* Repeat without the external entity handler */
XML_ParserReset(g_parser, NULL);
XML_SetNotStandaloneHandler(g_parser, accept_not_standalone_handler);
run_character_check(text, XCS(""));
@@ -7365,7 +7347,7 @@ START_TEST(test_misc_version) {
fail("Version mismatch");
#if ! defined(XML_UNICODE) || defined(XML_UNICODE_WCHAR_T)
- if (xcstrcmp(version_text, XCS("expat_2.2.10"))) /* needs bump on releases */
+ if (xcstrcmp(version_text, XCS("expat_2.3.0"))) /* needs bump on releases */
fail("XML_*_VERSION in expat.h out of sync?\n");
#else
/* If we have XML_UNICODE defined but not XML_UNICODE_WCHAR_T
@@ -9851,6 +9833,15 @@ START_TEST(test_nsalloc_parse_buffer) {
/* Try a parse before the start of the world */
/* (Exercises new code path) */
+ if (XML_ParseBuffer(g_parser, 0, XML_FALSE) != XML_STATUS_ERROR)
+ fail("Pre-init XML_ParseBuffer not faulted");
+ if (XML_GetErrorCode(g_parser) != XML_ERROR_NO_BUFFER)
+ fail("Pre-init XML_ParseBuffer faulted for wrong reason");
+
+ buffer = XML_GetBuffer(g_parser, 1 /* any small number greater than 0 */);
+ if (buffer == NULL)
+ fail("Could not acquire parse buffer");
+
allocation_count = 0;
if (XML_ParseBuffer(g_parser, 0, XML_FALSE) != XML_STATUS_ERROR)
fail("Pre-init XML_ParseBuffer not faulted");