<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9366">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">runtests.py: Make xml output more jUnit compatible<br><br>Separate "name" into "classname" and "name".<br>Use '.' for classname separator instead of '/'.<br>Prefix reserved words with '_'.<br><br>Also modified the '-t' option processing to allow test specification<br>by "classname". I.E. -t channels.pjsip.ami<br><br>Change-Id: Ia532c0fa20e9ebb62adc93081e0cb52791e80edb<br>---<br>M runtests.py<br>1 file changed, 28 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/66/9366/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/runtests.py b/runtests.py</span><br><span>index 1351a3c..9477ed7 100755</span><br><span>--- a/runtests.py</span><br><span>+++ b/runtests.py</span><br><span>@@ -676,6 +676,18 @@</span><br><span> return data.translate(None, ''.join(char_list))</span><br><span> </span><br><span> def write_results_xml(self, doc, root):</span><br><span style="color: hsl(120, 100%, 40%);">+ reserved = {'abstract':1, 'arguments':1, 'as':1, 'assert':1, 'await':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'boolean':1, 'break':1, 'byte':1, 'case':1, 'catch':1, 'char':1, 'class':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'const':1, 'continue':1, 'debugger':1, 'def':1, 'default':1, 'delete':1, 'do':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'double':1, 'else':1, 'enum':1, 'eval':1, 'export':1, 'extends':1, 'false':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'final':1, 'finally':1, 'float':1, 'for':1, 'function':1, 'goto':1, 'if':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'implements':1, 'import':1, 'in':1, 'instanceof':1, 'int':1, 'interface':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'let':1, 'long':1, 'native':1, 'new':1, 'null':1, 'package':1, 'private':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'protected':1, 'public':1, 'return':1, 'short':1, 'static':1, 'strictfp':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'string': 1, 'super':1, 'switch':1, 'synchronized':1, 'this':1, 'throw':1, 'throws':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'trait':1, 'transient':1, 'true':1, 'try':1, 'typeof':1, 'var':1, 'void':1,</span><br><span style="color: hsl(120, 100%, 40%);">+ 'volatile':1, 'while':1, 'with':1, 'yield':1</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> ts = doc.createElement("testsuite")</span><br><span> root.appendChild(ts)</span><br><span>@@ -694,7 +706,19 @@</span><br><span> tc = doc.createElement("testcase")</span><br><span> ts.appendChild(tc)</span><br><span> tc.setAttribute("time", "%.2f" % t.time)</span><br><span style="color: hsl(0, 100%, 40%);">- tc.setAttribute("name", t.test_name)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ name = re.sub('[^A-Za-z0-9_/]', '_', t.test_name)</span><br><span style="color: hsl(120, 100%, 40%);">+ names = name.split('/')</span><br><span style="color: hsl(120, 100%, 40%);">+ for i, n in enumerate(names):</span><br><span style="color: hsl(120, 100%, 40%);">+ if reserved.get(n) is not None:</span><br><span style="color: hsl(120, 100%, 40%);">+ names[i] = "_" + n</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ name_count = len(names)</span><br><span style="color: hsl(120, 100%, 40%);">+ classname = '.'.join(names[1:(name_count - 1)])</span><br><span style="color: hsl(120, 100%, 40%);">+ name = names[(name_count - 1)]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ tc.setAttribute("classname", classname)</span><br><span style="color: hsl(120, 100%, 40%);">+ tc.setAttribute("name", name)</span><br><span> </span><br><span> if t.did_run is False:</span><br><span> tskip = doc.createElement("skipped")</span><br><span>@@ -872,7 +896,9 @@</span><br><span> </span><br><span> # Ensure that there's a trailing '/' in the tests specified with -t</span><br><span> for i, test in enumerate(options.tests):</span><br><span style="color: hsl(0, 100%, 40%);">- if not test.endswith('/'):</span><br><span style="color: hsl(120, 100%, 40%);">+ if "/" not in test and "." in test:</span><br><span style="color: hsl(120, 100%, 40%);">+ options.tests[i] = "tests/" + test.replace(".", "/") + "/"</span><br><span style="color: hsl(120, 100%, 40%);">+ elif not test.endswith('/'):</span><br><span> options.tests[i] = test + '/'</span><br><span> </span><br><span> if options.valgrind:</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9366">change 9366</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9366"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia532c0fa20e9ebb62adc93081e0cb52791e80edb </div>
<div style="display:none"> Gerrit-Change-Number: 9366 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>