Arseny Kapoulkine
8436f2a69b
tests: Fix PUGIXML_COMPACT build on some platforms
...
We need bad_alloc that lives in <new>, not <exception>.
2018-04-04 07:53:16 -07:00
Arseny Kapoulkine
474a4a3f73
tests: Fix PUGIXML_NO_XPATH,PUGIXML_COMPACT build
...
pugixml.hpp wasn't including the <exception> header in this build but
test code needed it.
2018-04-03 21:56:09 -07:00
Arseny Kapoulkine
5f4afe3bd2
tests: Fix PUGIXML_NO_XPATH build
2018-04-03 21:51:41 -07:00
Arseny Kapoulkine
62728d9c2e
tests: Fix PUGIXML_NO_EXCEPTIONS tests
2018-04-02 21:51:04 -07:00
Arseny Kapoulkine
0c74e117b8
Update version to 1.9
2018-04-02 21:46:14 -07:00
Arseny Kapoulkine
a32585286a
tests: Fix PUGIXML_NO_STL build
2018-04-02 21:33:03 -07:00
Arseny Kapoulkine
fe7b837868
tests: Fix PUGIXML_COMPACT+PUGIXML_WCHAR_MODE tests
...
Several tests got the buffer size wrong when sizeof(char_t)>1, and one
test didn't meet the carefully tuned allocation criteria under compact
mode due to the hash table usage and had to be changed a bit.
2018-03-16 21:33:26 -07:00
Arseny Kapoulkine
a55f575a03
tests: Fix OSX test failure
...
Apparently at some point OSX behavior when reading /dev/tty switched
from "can't open the file" to "the file can be opened and 0 bytes can be
read from it" which generates a wrong error and doesn't exercise the
code path we care about.
2017-12-22 11:30:15 -08:00
Arseny Kapoulkine
7c6d0010b3
Merge pull request #170 from zeux/move
...
This change implements move ctor and assign support for xml_document.
All node handles remain valid after the move and point to the new document; the only exception is the document node itself (that remains unmoved).
Move is O(document size) in theory because it needs to relocate immediate document children (there is just one in conformant documents) and all memory pages; in practice the memory pages only need the header adjusted, which is ~0.1% of the actual data size.
Move requires no allocations in general, except when using compact mode where some moves need to grow the hash table which can fail (throw).
Fixes #104
2017-11-13 13:24:43 -08:00
Arseny Kapoulkine
58611c8702
tests: Add compact move tests
...
This helps make sure our error handling logic works and is exercised.
2017-11-13 08:59:16 -08:00
Arseny Kapoulkine
492ebc22bc
tests: Fix expansion-to-defined warning
...
This warning is new as of GCC 7 and highlights undefined behavior in the
preprocessor that ASAN detection was relying on.
2017-11-10 21:35:59 -08:00
Arseny Kapoulkine
0504fa4e90
tests: Add more tests for document move
...
These tests currently fail for compact mode because of ->reserve()
failing.
2017-10-26 08:36:05 -07:00
Arseny Kapoulkine
b0fc587a7f
tests: Add more move tests
...
We now check that appending a child to a moved document performs no
allocations - this is already the case, but if we neglected to copy the
allocator state this test would fail.
2017-10-20 21:53:42 -07:00
Arseny Kapoulkine
50bc0d5a69
tests: Adjust move coverage tests
...
Large test wasn't testing shared parent condition properly - add one
more level of hierarchy so that it works as expected.
2017-09-25 22:54:42 -07:00
Arseny Kapoulkine
26ead385a7
tests: Add more move tests
...
Add a test that checks that static buffer pointer was moved correctly
by checking if offset_debug still works.
2017-09-25 22:52:26 -07:00
Arseny Kapoulkine
402b967fa9
tests: Add more move tests
...
Make sure we have coverage for empty documents and for large documents
that trigger compact_shared_parent != root for some pages.
2017-09-25 22:47:10 -07:00
Arseny Kapoulkine
faba4786c0
tests: Add more document move tests
...
Verify that move doesn't allocate and that it preserves structures
required for tree memory management and append_buffer in tact.
2017-09-25 22:38:30 -07:00
Arseny Kapoulkine
6eb7519dba
tests: Add basic move tests
...
These just verify that move ctor/assignment operator work as expected in
simple cases - there are a number of ways in which the internal
structure can be incorrect...
2017-09-25 21:37:56 -07:00
Arseny Kapoulkine
f3e0f4249c
tests: Add more stream coverage tests
...
These new tests test that tellg() can fail when being called the second
time, which leads to seekable implementation failing.
2017-06-23 08:44:52 -07:00
Arseny Kapoulkine
4564d31c76
tests: Add stream coverage tests
...
These tests simulate various error conditions when reading data from
streams - seeks failing in seekable streams, underflow throwing an
exception causing read to set badbit, etc.
This change also adjusts memory thresholds to cause a reliable out of
memory during construction of a final buffer for non-seekable streams.
2017-06-23 07:48:09 -07:00
Arseny Kapoulkine
20a8eced3b
tests: Fix PUGIXML_WCHAR_MODE build
2017-06-22 22:18:16 -07:00
Arseny Kapoulkine
3870217381
tests: Add more XPath out of memory tests
...
This fixes missing coverage in translate_table_generate and
xpath_node_set_raw::append.
2017-06-22 22:11:43 -07:00
Arseny Kapoulkine
5867aff943
tests: Make using namespace more explicit
...
Hiding using namespace in common.hpp is somewhat surprising so remove
common.hpp and move using namespace into all .cpp files that need it.
2017-06-22 20:41:08 -07:00
Arseny Kapoulkine
4b371e10ee
tests: Remove redundant pugi:: qualifier
...
Most tests have `using namespace pugi` which makes explicit
qualifications unnecessary.
2017-06-22 20:33:02 -07:00
Arseny Kapoulkine
2252927c04
Deprecate xml_document::load(const char*) and xml_node::select_single_node
...
These functions were deprecated via comments in 1.5 but never got the
deprecated attribute; now is the time!
Using deprecated functions produces a warning; to silence it, this
change moves the relevant tests to a separate translation unit that has
deprecation disabled.
2017-06-22 09:13:10 -07:00
Arseny Kapoulkine
9357837d2e
Add VS2017 to AppVeyor test run
...
This requires moving the list of VS versions out of
autotest-appveyor.ps1 and into appveyor.yml.
2017-06-18 22:20:13 -07:00
Arseny Kapoulkine
0027b6ac79
tests: Improve XPath coverage
...
Add memory allocation failure test for concact with a very large list
and make sure we have every single axis covered with and without a
predicate, with and without a previous step.
2017-06-16 22:45:42 -07:00
Arseny Kapoulkine
08f102f14c
tests: Add even more stream coverage tests
...
Apparently only narrow character streams had out of memory coverage -
fix that and also split this into a separate test.
2017-06-16 21:38:55 -07:00
Arseny Kapoulkine
86593c0999
tests: Add more stream coverage tests
...
Cover both char and wchar_t stream loading in a single run instead of
using pugi::char_t.
2017-06-16 17:08:00 -07:00
Arseny Kapoulkine
3aa2b40354
tests: Add more coverage tests for stream loading
...
Cover more failure cases and simplify the streambuf implementation a
bit.
2017-06-16 16:41:08 -07:00
Arseny Kapoulkine
b6995f06b9
Fix BorlandC compilation
...
Rename partition to partition3 to resolve conflicts with std::partition.
2017-06-16 00:32:01 -07:00
Arseny Kapoulkine
bd23216420
tests: Improve XPath test coverage
...
Add more memory allocation failure tests.
2017-06-16 00:29:14 -07:00
Arseny Kapoulkine
a3664ea971
tests: Expand write_flush coverage
...
Adjust the buffer size to be right on the edge of the overflow, make
sure we actually output " instead of ".
2017-06-16 00:09:32 -07:00
Arseny Kapoulkine
d2892be902
tests: Add xml_buffered_writer coverage test
...
This test triggers flush() condition for each optimized write() method.
2017-06-15 23:52:56 -07:00
Arseny Kapoulkine
c40fd364ce
tests: Add tests for loading special files
...
New tests try to load a folder as an XML document, and a device. Both
are intended to exercise some otherwise non-hittable error paths in
load_file implementation.
2017-06-15 07:23:49 -07:00
Arseny Kapoulkine
0fbc043183
tests: Increase compact_pointer coverage
...
This adds tests that complete branch coverage in compact pointer
encoding/decoding code (previously first_attribute was always encoded
using compact encoding in the entire test suite).
2017-06-14 23:50:21 -07:00
Arseny Kapoulkine
24d1a4562b
Move libFuzzer build to Makefile
...
Now the only thing fuzz_setup.sh does is installing new clang; if system
clang supports -fsanitize-coverage then fuzz_setup.sh is not required.
2017-04-03 21:09:37 -07:00
Arseny Kapoulkine
0eb1ddb975
tests: Fix fuzz_setup.sh
...
The script only worked if clang folder was already created.
2017-04-03 20:36:33 -07:00
Arseny Kapoulkine
acfe47ba52
tests: Do not use unsigned underflow in test code
...
This triggers a runtime error under integer sanitizer
2017-03-21 21:47:22 -07:00
Arseny Kapoulkine
c29940ca72
tests: Fix invalid buffer size
...
This was triggering an buffer read overflow with asan.
2017-03-21 10:33:20 -07:00
Arseny Kapoulkine
ec984370fb
tests: Fix fuzz_setup.sh
...
Make the file executable, fix Windows newlines and fix clang setup.
2017-02-11 13:17:27 -08:00
Arseny Kapoulkine
ea544eb48b
tests: Add fuzzing dictionaries
...
Hopefully this will allow for better fuzzing coverage
2017-02-11 13:17:02 -08:00
Arseny Kapoulkine
8c62fa9121
tests: Add XPath fuzzing
...
Only fuzz the parser for now.
2017-02-09 07:37:38 -08:00
Arseny Kapoulkine
8b15ae8015
tests: Add a script to set up fuzzing tools
...
This downloads a clang build that has support for instrumentation, and also
downloads and compiles libFuzzer.a.
2017-02-09 07:37:04 -08:00
Arseny Kapoulkine
00ef791078
fuzz: Use libFuzzer instead of afl-fuzz
...
This allows us to have faster fuzz cycles since the fuzzer is in-process.
2017-02-09 07:36:32 -08:00
Arseny Kapoulkine
e748f435e5
tests: Increase the number of translate calls
...
This should make the test fail on a 32-bit target.
2017-02-09 07:36:32 -08:00
Arseny Kapoulkine
4bab082a27
tests: Fix clang build
2017-02-09 07:36:32 -08:00
Arseny Kapoulkine
ba39838ab5
tests: Add more XPath out of memory tests
2017-02-09 07:36:31 -08:00
Arseny Kapoulkine
10676b6b85
tests: Add more XPath sorting tests
...
Cover empty node case - no XPath query can result in that but it's
possible to create a node set with empty nodes manually.
2017-02-05 21:12:55 -08:00
Arseny Kapoulkine
faadd460c4
tests: Add more out of memory tests for XPath evaluation
2017-02-02 08:57:02 -08:00