Opened 5 years ago

Closed 5 years ago

#13398 closed Bugs (fixed)

Log format JUNIT generates invalid XML files

Reported by: gallien@… Owned by: Raffi Enficiaud
Milestone: Boost 1.67.0 Component: test
Version: Boost 1.66.0 Severity: Problem
Keywords: Cc: gallien@…

Description

The generated XML attributes 'property' are not closed in JUNIT log output (see http://www.boost.org/doc/libs/1_66_0/libs/test/doc/html/boost_test/test_output/log_formats.html).

Example output with log format JUNIT:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="0" skipped="0" errors="1" failures="2" id="0" name="Master_Test_Suite" time="44.222">
<properties>
<property name="platform" value="Win32"
<property name="compiler" value="Microsoft Visual C++ version 12.0"
<property name="stl" value="Dinkumware standard library version 610"
<property name="boost" value="1.66.0"
</properties>

Look at 'bool test_suite_start( test_suite const& ts )' in 'boost/test/impl/junit_log_formatter.ipp'. There are no closing tags.

if(m_display_build_info)
            {
                m_stream  << "<properties>" << std::endl;
                m_stream  << "<property name=\"platform\" value" << utils::attr_value() << BOOST_PLATFORM << std::endl;
                m_stream  << "<property name=\"compiler\" value" << utils::attr_value() << BOOST_COMPILER << std::endl;
                m_stream  << "<property name=\"stl\" value" << utils::attr_value() << BOOST_STDLIB << std::endl;

                std::ostringstream o;
                o << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
                m_stream  << "<property name=\"boost\" value" << utils::attr_value() << o.str() << std::endl;
                m_stream  << "</properties>" << std::endl;
            }

Change History (5)

comment:1 by Raffi Enficiaud, 5 years ago

Milestone: To Be DeterminedBoost 1.67.0
Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: newassigned

comment:2 by Andreas Gallien <gallien@…>, 5 years ago

Cc: gallien@… added

comment:3 by Raffi Enficiaud, 5 years ago

Is this only when you are including the build info to the output, or is there any other missing tag?

comment:4 by Andreas Gallien <gallien@…>, 5 years ago

I don't see any other problems in the XML structure.

Currently we are using a workaround with 'sed' to add the missing closing tags to the log:

sed -i -e "s/\(<property.*\)/\1\/>/" TestLog.xml

Then the generated XML could be read by our test reporting tool.

comment:5 by Raffi Enficiaud, 5 years ago

Resolution: fixed
Status: assignedclosed

In master.

Note: See TracTickets for help on using tickets.