blob: 8e068af6724bdbc657ccced9e01d02fc89c36f52 [file] [log] [blame]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +01001#!/bin/bash
2#-------------------------------------------------------------------------------
3# Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8
9##
10##@file
11##@brief This script is to make a summary of run-checkpatch.sh generated output
12##files.
13##
14##The generated summary will hold the number of error and warning messages for
15##each file.
16##
17##The first parameter of the script must be the location of input file.
18##
19
20#Check parameter
21if [ -z ${1+x} ]
22then
23 echo "Checkpatch output file not specified!"
24 exit 1
25fi
26
27infile="$1"
28
29#Find the summary line for each file. Cut the summary line plus the file name
30#the previous line.
31#Concatenate the current line to the previos one,
32#Print the two lines match the following regexp:
33# remember anything any number of non : characters (this is the file path)
34# followed by a :
35# match any nuber of following characters till "total:" is found
36# remember all characters after "total:" (this is the summary)
37# replace the matched string with first and and the second match concatenated
38# with new line and a tab character in between.
39# we use s: single line and m: multi line modificators for the regexp match
40res=$(perl -ne '$l=$l.$_; print "$l" if $l=~s/.*?([^:]+):.*\ntotal:(.*)/$1:\n\t$2/sm;$l=$_;' "$infile")
41
42#Print the result to standard output.
43cat <<EOM
44Checkpatch result summary:
45$res
46EOM