Replace libxml2 with tinyxml2 for use in test code
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 15 Feb 2016 10:21:38 +0000 (11:21 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 19 Apr 2016 14:54:12 +0000 (16:54 +0200)
commit2f00ac17824b13dbb128c67cf338ec9890f0d05f
treec620c4461d975b0588a82c96a71fd59f9c93e777
parent76d6c7303e950f2838b2764d06ff4ebee52658d0
Replace libxml2 with tinyxml2 for use in test code

Building libxml2 on complex machines has been problematic for users
and developers, and there is no pressing reason to need the full
capabilities of libxml2 for reading and writing data for test
cases. Support for detecting libxml2 is retained, because other code
in Gerrit might plan to use it, but it currently is not needed for
anything.

This is version 3.0.0 of tinyxml2, modified only so that
XMLPrinter::PrintSpace will write XML files with nesting indentation
of 2 spaces rather than 4, to match existing XML files in the GROMACS
repo. Also, a cppcheck suppression was added, and fix proposed
upstream that helps avoid it.

The resulting XML is identical in format to the current form in the
repo, except that empty text fields are rendered with
'<string></string>' rather than using the '<string/>'
shorthand. Those have been regenerated.

One known limitation is that '\r' is not handled correctly in text
nodes (string or text block), as it is converted to '\n'. libxml2 did
not handle it correctly in text block either, and we don't need this
behaviour to work, so it is no longer tested for either case.

Another limitation is that a non-CDATA text element that is not empty
and contains only whitespace is written correctly by TinyXML2, but is
parsed to an empty element upon reading. So GROMACS cannot rely on
refdata that wants to write a whitespace-only non-empty String (a
TextBlock is OK), which we might want to do some time. Attempting to
do so throws an exception, so we can't inadvertently run into trouble.

Some of the helper code that reports how strings in refdata do not
match has been slightly improved, so that the string that doesn't
match is wrapped in single quotes, so that the manner in which
whitespace is not matched can be more easily seen on the terminal.

Refs #1947

Change-Id: I6153136b67b41e7141fc3f1fc8ee4005a72c90f1
32 files changed:
CMakeLists.txt
cmake/gmxBuildTypeMSAN.cmake
docs/dev-manual/build-system.rst
docs/dev-manual/testutils.rst
docs/doxygen/lib/refdata.md
docs/install-guide/index.rst
src/external/tinyxml2/README [new file with mode: 0644]
src/external/tinyxml2/tinyxml2.cpp [new file with mode: 0755]
src/external/tinyxml2/tinyxml2.h [new file with mode: 0755]
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesInSolidAngleKeyword.xml
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesIndexGroupsInSelectionsDelayed.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesAllDistances.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesAllDistancesWithCutoff.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesGroupedMaxDistanceWithCutoff.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesGroupedMinDistanceWithCutoff.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesMaxDistance.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesMaxDistanceWithCutoff.xml
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_ComputesMinDistanceWithCutoff.xml
src/gromacs/trajectoryanalysis/tests/refdata/RdfModuleTest_BasicTest.xml
src/gromacs/trajectoryanalysis/tests/refdata/RdfModuleTest_CalculatesSurf.xml
src/gromacs/trajectoryanalysis/tests/refdata/RdfModuleTest_CalculatesXY.xml
src/gromacs/trajectoryanalysis/tests/refdata/SasaModuleTest_BasicTest.xml
src/gromacs/trajectoryanalysis/tests/refdata/SasaModuleTest_HandlesDynamicCalculationGroup.xml
src/gromacs/trajectoryanalysis/tests/refdata/SasaModuleTest_HandlesDynamicOutputGroup.xml
src/gromacs/trajectoryanalysis/tests/refdata/SasaModuleTest_HandlesSelectedResidues.xml
src/gromacs/trajectoryanalysis/tests/refdata/SasaModuleTest_WritesConnollySurfaceWithSolute.xml
src/testutils/CMakeLists.txt
src/testutils/refdata-checkers.h
src/testutils/refdata-xml.cpp
src/testutils/refdata-xml.h
src/testutils/refdata.cpp
src/testutils/tests/refdata_tests.cpp