Bug 957

Summary: Issue with test.py
Product: ns-3 Reporter: Lalith Suresh <suresh.lalith>
Component: test frameworkAssignee: Mitch Watrous <watrous>
Severity: normal CC: ns-bugs, tomh
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   
Attachments: Patch

Description Lalith Suresh 2010-07-20 06:55:47 EDT
Created attachment 939 [details]

I'm getting this message when test.py runs a test suite of mine that fails, and tries to write the output to a text file:

$ ./test.py -s igmp-header -t results.txt -v

---------- end standard err ----------
FAIL: TestSuite igmp-header
0 of 1 tests passed (0 passed, 0 skipped, 1 failed, 0 crashed, 0 valgrind errors)
Traceback (most recent call last):
  File "./test.py", line 1657, in <module>
  File "./test.py", line 1654, in main
    return run_tests()
  File "./test.py", line 1580, in run_tests
    translate_to_text(xml_results_file, options.text)
  File "./test.py", line 223, in translate_to_text
    dom = xml.dom.minidom.parse(results_file)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 14, column 14

Upon investigation, I found that the following was being entered into the XML file that test.py was generating:


This happened because the data type of the variable I was verifying was being used incorrectly (a variable being tested which was being serialised/deserialised as 2 bytes was incorrectly declared as uint8_t).

So it would be good if test.py caught this kind of error properly. Patch attached. I'm not sure if this is the _only_ error that the XML parser can encounter here. If it is, then the error message as per the attached patch can be made more specific.
Comment 1 Mitch Watrous 2011-05-13 16:10:01 EDT
Bug closed.

ns-3-dev changeset: eae56a101979