Bugzilla – Bug 2829
test.py produces malformed XML results
Last modified: 2018-01-05 00:30:16 EST
Created attachment 2964 [details] Updated file with the fix There is one test condition where test.py produces malformed XML results. It also contains dead code that can never be reached.
Patch uploaded as http://codereview.appspot.com/337120043
(In reply to Robert Ammon from comment #0) > Created attachment 2964 [details] > Updated file with the fix > > There is one test condition where test.py produces malformed XML results. > It also contains dead code that can never be reached. I agree with the patch for malformed XML. Regarding the dead code, I agree it is dead as it stands currently, but please look at the preceding comment in the code. It seems to me that the 'if job.returncode == 2' branch belongs instead at the end of the 'if returncode == 0,1,or 2' branch, based on the preceding comment. What do you think?
The code associated with the if job.returncode == 0 or job.returncode == 1 or job.returncode == 2: copies the results entry from the job output file to the XML results file. If the removed code is at the same indentation level as if job.returncode == 0 or job.returncode == 1 or job.returncode == 2:, then there would be two VALGR entries in the XML results file for a single test execution which is the reason I removed it rather than changed the indentation level.
Fixed in changeset 13237:e06b75ea96cc
I'm puzzled by removing the valgrind stanza. The comment is pretty clear there should be two entries: one for the test itself completing and passing, a second for the associated valgrind error. Is the additional entry creating problems for you elsewhere? Not obvious to me how to test this case (a test which deliberately fails valgrind). Perhaps remove a suppression?
reopening for Peter's question
Regardless of what the comment says, its impossible for the following code block in the current code to be executed: 1781 if job.returncode == 2: 1782 f = open(xml_results_file, 'a') 1783 f.write("<Test>\n") 1784 f.write(" <Name>%s</Name>\n" % job.display_name) 1785 f.write(' <Result>VALGR</Result>\n') 1786 f.write("</Test>\n") 1787 f.close()
Agreed. But if outdented one level it would execute... Tom's suggestion is equivalent.