noviceuser has asked for the wisdom of the Perl Monks concerning the following question:
Below is code snippet where i am reading a log file and grepping the failed testcase, then if the failed testcase is also mentioned in the reference file (/icd/eps2/kaakash_p4/readSyntechScript/failedTest) then need to ignore testcase. But, i want to modify this code for more than 1 testcase, kindly help as i am new to perl
Note: utils commands are in-house package, please ignore
my $results = ''; my $cmd = "ls /icd/eps2/kaakash_p4/readSyntechScript/testsuites_re +port* | tail -1"; utils::execCommand(Command => $cmd, Results => \$results); chomp($results); my @reportContents = utils::getFileContents("$results"); my ($failedTest) = grep { /FAIL/ } @reportContents; $failedTest =~ /\|\s+(\w+)/g; my $failedTestsuite= $1; chomp ($failedTestsuite); print "Failed Testsuite = $failedTestsuite\n"; my $ignoreTestFile = "/icd/eps2/kaakash_p4/readSyntechScript/faile +dTest"; my @ignoreContents = utils::getFileContents("$ignoreTestFile"); my $referenceFailedTest = $ignoreContents[0]; chomp($referenceFailedTest); print "Reference Failed Testsuite = $referenceFailedTest\n"; if ("$failedTestsuite" eq "$referenceFailedTest") { print "ignore testcase"; }
2021-04-18 Retitled by Discipulus, as per Monastery guidelines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
grep all matches
by hippo (Archbishop) on Apr 17, 2021 at 19:26 UTC | |
|
Re: grep all matches
by haukex (Archbishop) on Apr 17, 2021 at 19:41 UTC | |
|
Re: grep all matches
by perlfan (Parson) on Apr 17, 2021 at 22:40 UTC |