#!/bin/bash # # Check the build output from an rcutorture run for goodness. # The "file" is a pathname on the local system, and "title" is # a text string for error-message purposes. # # The file must contain kernel build output. # # Usage: parse-build.sh file title # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # # Copyright (C) IBM Corporation, 2011 # # Authors: Paul E. McKenney global F := $1 global title := $2 global T := "/tmp/parse-build.sh.$Pid" trap 'rm -rf $T' 0 mkdir $T source functions.sh if grep -q CC < $F { : } else { print_bug $title no build exit 1 } if grep -q "error:" < $F { print_bug $title build errors: grep "error:" < $F exit 2 } grep warning: < $F > $T/warnings grep "include/linux/*rcu*\.h:" $T/warnings > $T/hwarnings grep "kernel/rcu/[^/]*:" $T/warnings > $T/cwarnings cat $T/hwarnings $T/cwarnings > $T/rcuwarnings if test -s $T/rcuwarnings { print_warning $title build errors: cat $T/rcuwarnings exit 2 } exit 0 (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:F) op:Equal rhs:{($ VSub_Number "$1")} spids:[82])] spids: [82] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:title) op:Equal rhs:{($ VSub_Number "$2")} spids:[85])] spids: [85] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:T) op: Equal rhs: {(/tmp/parse-build.sh.) ($ VSub_Dollar "$$")} spids: [88] ) ] spids: [88] ) (C {(trap)} {(SQ <"rm -rf $T">)} {(0)}) (C {(mkdir)} {($ VSub_Name "$T")}) (C {(.)} {(functions.sh)}) (If arms: [ (if_arm cond: [ (SimpleCommand words: [{(grep)} {(-q)} {(CC)}] redirects: [(Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Name "$F")} spids:[118])] ) ] action: [(C {(Lit_Other ":")})] spids: [-1 122] ) ] else_action: [(C {(print_bug)} {($ VSub_Name "$title")} {(no)} {(build)}) (C {(exit)} {(1)})] spids: [127 143] ) (If arms: [ (if_arm cond: [ (SimpleCommand words: [{(grep)} {(-q)} {(DQ ("error:"))}] redirects: [(Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Name "$F")} spids:[156])] ) ] action: [ (C {(print_bug)} {($ VSub_Name "$title")} {(build)} {(errors) (Lit_Other ":")}) (SimpleCommand words: [{(grep)} {(DQ ("error:"))}] redirects: [(Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Name "$F")} spids:[179])] ) (C {(exit)} {(2)}) ] spids: [-1 160] ) ] spids: [-1 188] ) (SimpleCommand words: [{(grep)} {(warning) (Lit_Other ":")}] redirects: [ (Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Name "$F")} spids:[196]) (Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$T") (/warnings)} spids:[200]) ] ) (SimpleCommand words: [ {(grep)} {(DQ ("include/linux/*rcu*") (EscapedLiteralPart token:) ("h:"))} {($ VSub_Name "$T") (/warnings)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$T") (/hwarnings)} spids: [216] ) ] ) (SimpleCommand words: [{(grep)} {(DQ ("kernel/rcu/[^/]*:"))} {($ VSub_Name "$T") (/warnings)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$T") (/cwarnings)} spids: [230] ) ] ) (SimpleCommand words: [{(cat)} {($ VSub_Name "$T") (/hwarnings)} {($ VSub_Name "$T") (/cwarnings)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$T") (/rcuwarnings)} spids: [243] ) ] ) (If arms: [ (if_arm cond: [(C {(test)} {(-s)} {($ VSub_Name "$T") (/rcuwarnings)})] action: [ (C {(print_warning)} {($ VSub_Name "$title")} {(build)} {(errors) (Lit_Other ":")}) (C {(cat)} {($ VSub_Name "$T") (/rcuwarnings)}) (C {(exit)} {(2)}) ] spids: [-1 257] ) ] spids: [-1 280] ) (C {(exit)} {(0)}) ] )