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
In reply to grep all matches by noviceuser
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |