Hello kalantal, and welcome to the Monastery!
It looks to me as though the author of the script relied rather too heavily on cut-and-paste. For example, in this section:
foreach $testfailure ($test->findnodes('./failure')) {
$failure_type = $testfailure->getAttribute('type
+');
$failure_temp = $testfailure->getAttribute('mess
+age');
}
foreach $testpassed ($test->findnodes('./skip')) {
$failure_type = $testfailure->getAttribute('type
+');
$failure_temp = $testfailure->getAttribute('mess
+age');
}
the variable $testfailure first iterates over ‘failure’ nodes, but then — without being reinitialised — is accessed in the following foreach
loop to find the failure type and message for ‘skipped’ nodes. I assume this is what was meant:
foreach $testpassed ($test->findnodes('./skip')) {
$failure_type = $testpassed->getAttribute('type'
+);
# ^^^^^^^^^^^
$failure_temp = $testpassed->getAttribute('messa
+ge');
# ^^^^^^^^^^^
}
This is the sort of error that is easy to pick up if you have use strict; at the head of your code. You should always do this, and put use warnings; there as well.
(Actually, the logic of this whole section of code looks highly dubious to me. It iterates over ‘failure’ nodes and sets $failure_type and $failure_temp once only, then iterates over ‘skipped’ nodes and overwrites the values of these variabes, and so on.)
The problem you are seeing comes from a similar cut-and-paste error, but in this case it’s made harder to see by the way the code is formatted. Here is the skeleton of the problem section:
if ($error_type ne '')
{
...
}
elsif ($failure_type ne '')
{
($failure_message, $junk) = split(/^/, $failure_temp, 2);
chomp $failure_message;
$failure_message =~ s/,/|/g;
print OUTFILE "FAILED, $failure_type, $failure_message\n";
}
elsif ($failure_type ne '')
{
...
$failure_message =~ /skip/;
print OUTFILE "SKIPPED, $failure_type, $failure_message\n";
}
else
{
print OUTFILE "PASSED\n";
}
Can you see the problem now? The condition in the second elsif clause is identical to the condition in the first elsif clause, so the second one will never be true and the section dealing with skipped nodes will never be entered. You need to change the condition to catch the ‘skipped’ case. (I can’t tell you what the condition should be, as I don’t sufficiently understand how the script is supposed to be working.)
Hope that helps,
|