verify.py (13004:ba6455680bfc) | verify.py (13005:9e97204bf57f) |
---|---|
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; --- 198 unchanged lines hidden (view full) --- 207 re.sub(filt, '', data) 208 209 def check(self): 210 test_file = os.path.basename(self.test) 211 ref_file = os.path.basename(self.ref) 212 with open(self.test) as test_f, open(self.ref) as ref_f: 213 test = re.sub(self.test_filt, '', test_f.read()) 214 ref = re.sub(self.ref_filt, '', ref_f.read()) | 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; --- 198 unchanged lines hidden (view full) --- 207 re.sub(filt, '', data) 208 209 def check(self): 210 test_file = os.path.basename(self.test) 211 ref_file = os.path.basename(self.ref) 212 with open(self.test) as test_f, open(self.ref) as ref_f: 213 test = re.sub(self.test_filt, '', test_f.read()) 214 ref = re.sub(self.ref_filt, '', ref_f.read()) |
215 diff_file = '.'.join([ref_file, 'diff']) 216 diff_path = os.path.join(self.out_dir, diff_file) |
|
215 if test != ref: | 217 if test != ref: |
216 diff_file = '.'.join([ref_file, 'diff']) 217 diff_path = os.path.join(self.out_dir, diff_file) | |
218 with open(diff_path, 'w') as diff_f: 219 for line in difflib.unified_diff( 220 ref.splitlines(True), test.splitlines(True), 221 fromfile=ref_file, 222 tofile=test_file): 223 diff_f.write(line) 224 return False | 218 with open(diff_path, 'w') as diff_f: 219 for line in difflib.unified_diff( 220 ref.splitlines(True), test.splitlines(True), 221 fromfile=ref_file, 222 tofile=test_file): 223 diff_f.write(line) 224 return False |
225 else: 226 if os.path.exists(diff_path): 227 os.unlink(diff_path) |
|
225 return True 226 227class VerifyPhase(TestPhaseBase): 228 name = 'verify' 229 number = 3 230 231 def reset_status(self): 232 self._passed = [] --- 202 unchanged lines hidden --- | 228 return True 229 230class VerifyPhase(TestPhaseBase): 231 name = 'verify' 232 number = 3 233 234 def reset_status(self): 235 self._passed = [] --- 202 unchanged lines hidden --- |