Bug 957 - Issue with test.py
Issue with test.py
Product: ns-3
Classification: Unclassified
Component: test framework
All All
: P5 normal
Assigned To: Mitch Watrous
Depends on:
  Show dependency treegraph
Reported: 2010-07-20 06:55 EDT by Lalith Suresh
Modified: 2011-05-13 16:10 EDT (History)
2 users (show)

See Also:

Patch (685 bytes, patch)
2010-07-20 06:55 EDT, Lalith Suresh
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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