| 1 |
#!/usr/bin/perl |
| 2 |
#/* |
| 3 |
# * This file is part of buteo-sync-plugins package |
| 4 |
# * |
| 5 |
# * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 6 |
# * |
| 7 |
# * Contact: Sateesh Kavuri <[email protected]> |
| 8 |
# * |
| 9 |
# * This library is free software; you can redistribute it and/or |
| 10 |
# * modify it under the terms of the GNU Lesser General Public License |
| 11 |
# * version 2.1 as published by the Free Software Foundation. |
| 12 |
# * |
| 13 |
# * This library is distributed in the hope that it will be useful, but |
| 14 |
# * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
# * Lesser General Public License for more details. |
| 17 |
# * |
| 18 |
# * You should have received a copy of the GNU Lesser General Public |
| 19 |
# * License along with this library; if not, write to the Free Software |
| 20 |
# * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 |
# * 02110-1301 USA |
| 22 |
# * |
| 23 |
# */ |
| 24 |
# Author : Srikanth Kavoori |
| 25 |
# Not Tested fully yet. There could be some issues. |
| 26 |
# If you see any issues Let me know and i shall fix it :) |
| 27 |
open(INPUTFILE, "<$ARGV[0]"); |
| 28 |
# Totals: 0 passed, 2 failed, 0 skipped |
| 29 |
$tests_string = "Totals:"; |
| 30 |
$pass_count = 0; |
| 31 |
$fail_count = 0; |
| 32 |
$skip_count = 0; |
| 33 |
$total_count = 0; |
| 34 |
|
| 35 |
while(<INPUTFILE>) { |
| 36 |
my($line) = $_; |
| 37 |
if(/$tests_string/) { |
| 38 |
|
| 39 |
#print $line; |
| 40 |
#print "Found usr_include or header file on line $. \n" ; |
| 41 |
$pass_start_index = rindex($line,':') + 1; |
| 42 |
$passed_index = rindex($line,"passed") - 1; |
| 43 |
$length = $passed_index - $start_index; |
| 44 |
$pass_count += substr($line,$pass_start_index,$length); |
| 45 |
|
| 46 |
#print "pass_count $pass_count "; |
| 47 |
$fail_start_index = rindex($line,'passed,') + 8; |
| 48 |
$failed_index = rindex($line,"failed") - 1; |
| 49 |
$length = $failed_index - $fail_start_index; |
| 50 |
$fail_count += substr($line,$fail_start_index,$length); |
| 51 |
#print "fail_count $fail_count "; |
| 52 |
|
| 53 |
$skip_start_index = rindex($line,'failed,') + 8; |
| 54 |
$skipped_index = rindex($line,"skipped") - 1; |
| 55 |
$length = $failed_index - $skip_start_index; |
| 56 |
$skip_count += substr($line,$skip_start_index,$length); |
| 57 |
#print "skip_count $skip_count \n"; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
#if($filecount != 0 ) { |
| 62 |
# $coverage_percent=sprintf("%.2f",$coverage_percent/$filecount); |
| 63 |
#} |
| 64 |
$total_count += $pass_count + $fail_count + $skip_count; |
| 65 |
print "Total No. TESTS: $total_count \n"; |
| 66 |
print "Passed: $pass_count \n"; |
| 67 |
print "Failed: $fail_count \n"; |
| 68 |
print "Skipped: $skip_count \n"; |
| 69 |
|
| 70 |
open(SUMMARY_FILE,">$ARGV[1]"); |
| 71 |
print SUMMARY_FILE "" ; |
| 72 |
print SUMMARY_FILE "Total TESTS: $total_count \n"; |
| 73 |
print SUMMARY_FILE "Passed: $pass_count \n"; |
| 74 |
print SUMMARY_FILE "Failed: $fail_count \n"; |
| 75 |
print SUMMARY_FILE "Skipped: $skip_count \n"; |
| 76 |
close(SUMMARY_FILE); |
| 77 |
close(INPUTFILE); |