1*49cdfc7eSAndroid Build Coastguard Worker#!/usr/bin/env python3 2*49cdfc7eSAndroid Build Coastguard Worker# -*- coding: utf-8 -*- 3*49cdfc7eSAndroid Build Coastguard Worker 4*49cdfc7eSAndroid Build Coastguard Worker################################################################################ 5*49cdfc7eSAndroid Build Coastguard Worker## ## 6*49cdfc7eSAndroid Build Coastguard Worker## Copyright © International Business Machines Corp., 2007, 2008 ## 7*49cdfc7eSAndroid Build Coastguard Worker## ## 8*49cdfc7eSAndroid Build Coastguard Worker## This program is free software; you can redistribute it and#or modify ## 9*49cdfc7eSAndroid Build Coastguard Worker## it under the terms of the GNU General Public License as published by ## 10*49cdfc7eSAndroid Build Coastguard Worker## the Free Software Foundation; either version 2 of the License, or ## 11*49cdfc7eSAndroid Build Coastguard Worker## (at your option) any later version. ## 12*49cdfc7eSAndroid Build Coastguard Worker## ## 13*49cdfc7eSAndroid Build Coastguard Worker## This program is distributed in the hope that it will be useful, but ## 14*49cdfc7eSAndroid Build Coastguard Worker## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## 15*49cdfc7eSAndroid Build Coastguard Worker## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## 16*49cdfc7eSAndroid Build Coastguard Worker## for more details. ## 17*49cdfc7eSAndroid Build Coastguard Worker## ## 18*49cdfc7eSAndroid Build Coastguard Worker## You should have received a copy of the GNU General Public License ## 19*49cdfc7eSAndroid Build Coastguard Worker## along with this program; if not, write to the Free Software ## 20*49cdfc7eSAndroid Build Coastguard Worker## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 21*49cdfc7eSAndroid Build Coastguard Worker## ## 22*49cdfc7eSAndroid Build Coastguard Worker## NAME: parse-testpi1.py ## 23*49cdfc7eSAndroid Build Coastguard Worker## ## 24*49cdfc7eSAndroid Build Coastguard Worker## DESCRIPTION: Log Parser for the testpi-1.c test ## 25*49cdfc7eSAndroid Build Coastguard Worker## ## 26*49cdfc7eSAndroid Build Coastguard Worker## AUTHOR: Chirag <[email protected] ## 27*49cdfc7eSAndroid Build Coastguard Worker## ## 28*49cdfc7eSAndroid Build Coastguard Worker################################################################################ 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Workerfrom scripts.parser import * 31*49cdfc7eSAndroid Build Coastguard Workerimport re 32*49cdfc7eSAndroid Build Coastguard Workerclass TestPi1(Log): 33*49cdfc7eSAndroid Build Coastguard Worker def __init__(self,filename): 34*49cdfc7eSAndroid Build Coastguard Worker Log.__init__(self,filename) 35*49cdfc7eSAndroid Build Coastguard Worker 36*49cdfc7eSAndroid Build Coastguard Worker def eval(self): 37*49cdfc7eSAndroid Build Coastguard Worker exp1= re.compile("pthread pol 0 pri 0") 38*49cdfc7eSAndroid Build Coastguard Worker exp2= re.compile(r'^Noise Thread') 39*49cdfc7eSAndroid Build Coastguard Worker exp3=re.compile("[1-9]\d{2,3}") 40*49cdfc7eSAndroid Build Coastguard Worker flag=False 41*49cdfc7eSAndroid Build Coastguard Worker for line in self.read(): 42*49cdfc7eSAndroid Build Coastguard Worker if exp1.search(line) and exp2.search(prev_line)and exp3.search(prev_line): 43*49cdfc7eSAndroid Build Coastguard Worker list=prev_line.split(" ") 44*49cdfc7eSAndroid Build Coastguard Worker if int(list[4])< 9900: 45*49cdfc7eSAndroid Build Coastguard Worker flag=True 46*49cdfc7eSAndroid Build Coastguard Worker else: 47*49cdfc7eSAndroid Build Coastguard Worker flag=False 48*49cdfc7eSAndroid Build Coastguard Worker prev_line=line 49*49cdfc7eSAndroid Build Coastguard Worker return flag 50*49cdfc7eSAndroid Build Coastguard Worker 51*49cdfc7eSAndroid Build Coastguard Workerdef main(): 52*49cdfc7eSAndroid Build Coastguard Worker if len(sys.argv) < 2: 53*49cdfc7eSAndroid Build Coastguard Worker sys.exit("Usage : ./%s <logname>" % sys.argv[0]) 54*49cdfc7eSAndroid Build Coastguard Worker else: 55*49cdfc7eSAndroid Build Coastguard Worker log_file = sys.argv[1] 56*49cdfc7eSAndroid Build Coastguard Worker log = TestPi1(log_file) 57*49cdfc7eSAndroid Build Coastguard Worker sys.exit("Result: %s " % (["FAIL", "PASS"][log.eval()])) 58*49cdfc7eSAndroid Build Coastguard Worker 59*49cdfc7eSAndroid Build Coastguard Workerif __name__ == "__main__": 60*49cdfc7eSAndroid Build Coastguard Worker main() 61