summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-04-01 15:10:13 -0700
committerElliott Hughes <enh@google.com>2021-04-02 10:11:32 -0700
commitf648a2959a57425ab6618bf0466fda194815db8e (patch)
treef4fe842cbe105849052ce8e3e3e64fb5bf4c3349 /tests
parentf28db35a313803cfc89d10c89f28070aba6fa551 (diff)
downloadexpat-f648a2959a57425ab6618bf0466fda194815db8e.tar.gz
Upgrade expat to R_2_3_0
Test: make Change-Id: I59fc27b318cf832555ce17d7c3747924901f5f1b
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.in17
-rw-r--r--tests/benchmark/Makefile.in14
-rw-r--r--tests/minicheck.c29
-rw-r--r--tests/runtests.c35
4 files changed, 58 insertions, 37 deletions
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 8b9b38ea..90cc4f70 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.16.2 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
@@ -443,6 +443,7 @@ am__set_TESTS_bases = \
bases='$(TEST_LOGS)'; \
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
bases=`echo $$bases`
+AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
RECHECK_LOGS = $(TEST_LOGS)
TEST_SUITE_LOG = test-suite.log
TEST_EXTENSIONS = @EXEEXT@ .test
@@ -509,7 +510,6 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
-CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -527,6 +527,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+EXPAT_ATTR_INFO = @EXPAT_ATTR_INFO@
+EXPAT_CHAR_TYPE = @EXPAT_CHAR_TYPE@
+EXPAT_CONTEXT_BYTES = @EXPAT_CONTEXT_BYTES@
+EXPAT_DTD = @EXPAT_DTD@
+EXPAT_LARGE_SIZE = @EXPAT_LARGE_SIZE@
+EXPAT_MIN_SIZE = @EXPAT_MIN_SIZE@
+EXPAT_NS = @EXPAT_NS@
FGREP = @FGREP@
FILEMAP = @FILEMAP@
GREP = @GREP@
@@ -539,6 +546,7 @@ LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAGE = @LIBAGE@
LIBCURRENT = @LIBCURRENT@
+LIBDIR_BASENAME = @LIBDIR_BASENAME@
LIBOBJS = @LIBOBJS@
LIBREVISION = @LIBREVISION@
LIBS = @LIBS@
@@ -568,6 +576,9 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SO_MAJOR = @SO_MAJOR@
+SO_MINOR = @SO_MINOR@
+SO_PATCH = @SO_PATCH@
STRIP = @STRIP@
VERSION = @VERSION@
_EXPAT_OUTPUT_NAME = @_EXPAT_OUTPUT_NAME@
@@ -986,7 +997,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
fi; \
echo "$${col}$$br$${std}"; \
- echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
echo "$${col}$$br$${std}"; \
create_testsuite_report --maybe-color; \
echo "$$col$$br$$std"; \
diff --git a/tests/benchmark/Makefile.in b/tests/benchmark/Makefile.in
index 665bca31..5882f7d0 100644
--- a/tests/benchmark/Makefile.in
+++ b/tests/benchmark/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.16.2 from Makefile.am.
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
@@ -228,7 +228,6 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
-CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -246,6 +245,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+EXPAT_ATTR_INFO = @EXPAT_ATTR_INFO@
+EXPAT_CHAR_TYPE = @EXPAT_CHAR_TYPE@
+EXPAT_CONTEXT_BYTES = @EXPAT_CONTEXT_BYTES@
+EXPAT_DTD = @EXPAT_DTD@
+EXPAT_LARGE_SIZE = @EXPAT_LARGE_SIZE@
+EXPAT_MIN_SIZE = @EXPAT_MIN_SIZE@
+EXPAT_NS = @EXPAT_NS@
FGREP = @FGREP@
FILEMAP = @FILEMAP@
GREP = @GREP@
@@ -258,6 +264,7 @@ LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAGE = @LIBAGE@
LIBCURRENT = @LIBCURRENT@
+LIBDIR_BASENAME = @LIBDIR_BASENAME@
LIBOBJS = @LIBOBJS@
LIBREVISION = @LIBREVISION@
LIBS = @LIBS@
@@ -287,6 +294,9 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SO_MAJOR = @SO_MAJOR@
+SO_MINOR = @SO_MINOR@
+SO_PATCH = @SO_PATCH@
STRIP = @STRIP@
VERSION = @VERSION@
_EXPAT_OUTPUT_NAME = @_EXPAT_OUTPUT_NAME@
diff --git a/tests/minicheck.c b/tests/minicheck.c
index a5a1efb1..ab0c35fd 100644
--- a/tests/minicheck.c
+++ b/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/tests/runtests.c b/tests/runtests.c
index 2490d86b..91ab4f21 100644
--- a/tests/runtests.c
+++ b/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");