<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/20030">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">test.c: Fix couting of tests and failures in XML output<br><br>The unit test XML output was counting all registered tests as "run"<br>even when only a subset were actually requested to be run and<br>the "failures" attribute was missing.<br><br>* The "tests" attribute of the "testsuite" element in the<br>  output XML now reflects only the tests actually requested<br>  to be executed instead of all the tests registered.<br><br>* The "failures" attribute was added to the "testsuite"<br>  element.<br><br>Change-Id: Ia137814b5aeb0e1a44c75034bd3615c26021da69<br>---<br>A doc/CHANGES-staging/test.txt<br>M main/test.c<br>2 files changed, 31 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/30/20030/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/CHANGES-staging/test.txt b/doc/CHANGES-staging/test.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..69cc8df</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/test.txt</span><br><span>@@ -0,0 +1,8 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: test.c</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The "tests" attribute of the "testsuite" element in the </span><br><span style="color: hsl(120, 100%, 40%);">+output XML now reflects only the tests actually requested</span><br><span style="color: hsl(120, 100%, 40%);">+to be executed instead of all the tests registered.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The "failures" attribute was added to the "testsuite"</span><br><span style="color: hsl(120, 100%, 40%);">+element.</span><br><span>diff --git a/main/test.c b/main/test.c</span><br><span>index 9eefbd0..7ec505b 100644</span><br><span>--- a/main/test.c</span><br><span>+++ b/main/test.c</span><br><span>@@ -715,8 +715,8 @@</span><br><span>          /* update total counts as well during this iteration</span><br><span>                  * even if the current test did not execute this time */</span><br><span>             last_results.total_time += test->time;</span><br><span style="color: hsl(0, 100%, 40%);">-               last_results.total_tests++;</span><br><span>          if (test->state != AST_TEST_NOT_RUN) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     last_results.total_tests++;</span><br><span>                  if (test->state == AST_TEST_PASS) {</span><br><span>                               last_results.total_passed++;</span><br><span>                         } else {</span><br><span>@@ -793,10 +793,10 @@</span><br><span>              */</span><br><span>          fprintf(f_xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");</span><br><span>          fprintf(f_xml, "<testsuites>\n");</span><br><span style="color: hsl(0, 100%, 40%);">-               fprintf(f_xml, "\t<testsuite errors=\"0\" time=\"%u.%u\" tests=\"%u\" "</span><br><span style="color: hsl(120, 100%, 40%);">+            fprintf(f_xml, "\t<testsuite errors=\"0\" time=\"%u.%u\" tests=\"%u\" failures=\"%u\" "</span><br><span>                                 "name=\"AsteriskUnitTests\">\n",</span><br><span>                              last_results.total_time / 1000, last_results.total_time % 1000,</span><br><span style="color: hsl(0, 100%, 40%);">-                         last_results.total_tests);</span><br><span style="color: hsl(120, 100%, 40%);">+                            last_results.total_tests, last_results.total_failed);</span><br><span>                fprintf(f_xml, "\t\t<properties>\n");</span><br><span>                fprintf(f_xml, "\t\t\t<property name=\"version\" value=\"%s\"/>\n", ast_get_version());</span><br><span>          fprintf(f_xml, "\t\t</properties>\n");</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/20030">change 20030</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/c/asterisk/+/20030"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Ia137814b5aeb0e1a44c75034bd3615c26021da69 </div>
<div style="display:none"> Gerrit-Change-Number: 20030 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>