verify.py (13037:ae6f69952478) verify.py (13055:59ec7f6db329)
1#!/usr/bin/env python2
2#
3# Copyright 2018 Google, Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 170 unchanged lines hidden (view full) ---

179 self.ref = ref
180 self.test = test
181 self.tag = tag
182
183 def check(self):
184 with open(self.text) as test_f, open(self.ref) as ref_f:
185 return test_f.read() == ref_f.read()
186
1#!/usr/bin/env python2
2#
3# Copyright 2018 Google, Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 170 unchanged lines hidden (view full) ---

179 self.ref = ref
180 self.test = test
181 self.tag = tag
182
183 def check(self):
184 with open(self.text) as test_f, open(self.ref) as ref_f:
185 return test_f.read() == ref_f.read()
186
187def tagged_filt(tag, num):
188 return (r'^\n{}: \({}{}\) .*\n(In file: .*\n)?'
189 r'(In process: [\w.]* @ .*\n)?').format(tag, tag[0], num)
190
191def warning_filt(num):
192 return tagged_filt('Warning', num)
193
194def info_filt(num):
195 return tagged_filt('Info', num)
196
187class LogChecker(Checker):
188 def merge_filts(*filts):
189 filts = map(lambda f: '(' + f + ')', filts)
190 filts = '|'.join(filts)
191 return re.compile(filts, flags=re.MULTILINE)
192
197class LogChecker(Checker):
198 def merge_filts(*filts):
199 filts = map(lambda f: '(' + f + ')', filts)
200 filts = '|'.join(filts)
201 return re.compile(filts, flags=re.MULTILINE)
202
193 def warning_filt(num):
194 return (r'^\nWarning: \(W{}\) .*\n(In file: .*\n)?'
195 r'(In process: [\w.]* @ .*\n)?').format(num)
196
197 ref_filt = merge_filts(
198 r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n',
199 r'^SystemC Simulation\n',
203 ref_filt = merge_filts(
204 r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n',
205 r'^SystemC Simulation\n',
206 r'^\nInfo: \(I804\) /IEEE_Std_1666/deprecated: ' +
207 r'You can turn off(.*\n){7}',
200 warning_filt(540),
201 warning_filt(569),
202 warning_filt(571),
208 warning_filt(540),
209 warning_filt(569),
210 warning_filt(571),
203 r'^\nInfo: \(I804\) /IEEE_Std_1666/deprecated: ' +
204 r'You can turn off(.*\n){7}'
211 info_filt(804),
205 )
206 test_filt = merge_filts(
212 )
213 test_filt = merge_filts(
207 r'^Global frequency set at \d* ticks per second\n'
214 r'^Global frequency set at \d* ticks per second\n',
215 info_filt(804),
208 )
209
210 def __init__(self, ref, test, tag, out_dir):
211 super(LogChecker, self).__init__(ref, test, tag)
212 self.out_dir = out_dir
213
214 def apply_filters(self, data, filts):
215 re.sub(filt, '', data)

--- 299 unchanged lines hidden ---
216 )
217
218 def __init__(self, ref, test, tag, out_dir):
219 super(LogChecker, self).__init__(ref, test, tag)
220 self.out_dir = out_dir
221
222 def apply_filters(self, data, filts):
223 re.sub(filt, '', data)

--- 299 unchanged lines hidden ---