MantisBT - CMake
View Issue Details
0010656CMakeCTestpublic2010-05-02 05:282011-01-12 07:27
XU Liang 
Brad King 
normalmajoralways
closedfixed 
CMake-2-8 
CMake 2.8.4CMake 2.8.4 
0010656: The utf-8 output of failed test was cut wrongly at 'Measurement' element of Test.xml
My program write UTF-8 Chinese output. I can get right content at 'Testing/Temporary/LastTest_20100502-0448.log'. But the content of 'Testing/20100502-0448/Test.xml' was cut wrongly. I know CustomMaximumFailedTestOutputSize is 300k, but I got the content length of Measurement is 2.2k. After add 'CTEST_FULL_OUTPUT' string at my output, I got right content at 'Test.xml'. So I think the root cause is the 'cmCTestTestHandler::CleanTestOutput' can't process UTF-8 string rightly.

In attachment you can find failed test at Test.xml:255 and LastTest_20100502-0448.log:1471.
No tags attached.
related to 0009944closed David Cole Wrong umlaut handling for Update.xml 
7z Testing.7z (19,336) 2010-05-02 05:28
https://public.kitware.com/Bug/file/3081/Testing.7z
Issue History
2010-05-02 05:28XU LiangNew Issue
2010-05-02 05:28XU LiangFile Added: Testing.7z
2010-05-02 05:56XU LiangNote Added: 0020508
2010-05-02 05:57XU LiangNote Edited: 0020508
2010-10-27 12:02trsystranNote Added: 0022716
2010-12-03 01:36XU LiangNote Added: 0023688
2010-12-14 16:39David ColeRelationship addedrelated to 0009944
2010-12-14 16:41David ColeAssigned To => David Cole
2010-12-14 16:41David ColeStatusnew => assigned
2010-12-17 07:41David ColeTarget Version => CMake 2.8.4
2011-01-03 18:32David ColeAssigned ToDavid Cole => Brad King
2011-01-03 18:32David ColeNote Added: 0024375
2011-01-04 09:33Brad KingNote Added: 0024390
2011-01-04 13:32Brad KingNote Added: 0024400
2011-01-04 13:32Brad KingStatusassigned => closed
2011-01-04 13:32Brad KingResolutionopen => fixed
2011-01-12 07:27David ColeFixed in Version => CMake 2.8.4

Notes
(0020508)
XU Liang   
2010-05-02 05:56   
(edited on: 2010-05-02 05:57)
After add some debug log at ctest, I found there is root-cause at cmCTestTestHandler.cxx:1996. The UTF-8 string that contains non-ascii char has signed-bit, so it always break.

1975 bool cmCTestTestHandler::CleanTestOutput(std::string& output,
1976 size_t remove_threshold)
...
1993 int ch = output[cc];
1994 if ( ch < 0 || ch > 255 )
1995 {
1996 break;
1997 }

(0022716)
trsystran   
2010-10-27 12:02   
This is a blocking issue:
all xml tests outputs containing utf8 are cut when encountering the first non-ascii char that has signed-bit.
(0023688)
XU Liang   
2010-12-03 01:36   
trsystran:
  You can just comment the line 1994 ~ 1997 of cmCTestTestHandler.cxx before you build the CMAKE 2.8.3.
(0024375)
David Cole   
2011-01-03 18:32   
Brad: if you have time to take a look, great... If not, just assign back to me.

Thanks.
(0024390)
Brad King   
2011-01-04 09:33   
This commit:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4beefeb [^]

addressed encoding of data in *.xml files like Test.xml, but I didn't know about this separate processing loop that occurs before even getting to that point. Any loop over test output needs to perform utf-8 decoding.
(0024400)
Brad King   
2011-01-04 13:32   
Fixed:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e73bf1c3 [^]