Add testutil archive on failed tests for debug

This commit is contained in:
Matt Guthaus 2018-11-10 11:54:28 -08:00
parent 65b6bfd5e7
commit 6c17734712
1 changed files with 9 additions and 5 deletions

View File

@ -1,12 +1,14 @@
import unittest,warnings
import sys,os,glob,copy
import shutil
sys.path.append(os.path.join(sys.path[0],".."))
from globals import OPTS
import debug
class openram_test(unittest.TestCase):
""" Base unit test that we have some shared classes in. """
def local_drc_check(self, w):
self.reset()
@ -36,15 +38,17 @@ class openram_test(unittest.TestCase):
import verify
result=verify.run_drc(a.name, tempgds)
if result != 0:
new_file = "/tmp/"+a.name+".gds"
debug.info(0,"Copying failed file to {}".format(new_file))
import shutil
shutil.copy(tempgds, newfile)
zip_file = "/tmp/{0}_{1}".format(a.name,os.getpid())
debug.info(0,"Archiving failed files to {}.zip".format(zip_file))
shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
self.fail("DRC failed: {}".format(a.name))
result=verify.run_lvs(a.name, tempgds, tempspice, final_verification)
if result != 0:
zip_file = "/tmp/{0}_{1}".format(a.name,os.getpid())
debug.info(0,"Archiving failed files to {}.zip".format(zip_file))
shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
self.fail("LVS mismatch: {}".format(a.name))
if OPTS.purge_temp: