Skip to content

Commit

Permalink
Removing time.sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanad0mohamed authored and mithro committed Aug 20, 2022
1 parent 859d03b commit 0380066
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions rules/klayout/lvs/testing/run_sc_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def lvs_check(sc_input):
# os.system(f"mv -f sc_testcases/{sc_input}.lvsdb sc_testcases/*/{cdl_input_clean}_extracted.cir sc_testcases/*/{cdl_input_clean}_modified.cdl {out_dir}/{sc_input_clean}/")

if "INFO : Congratulations! Netlists match." in result:
logging.info(f"Extraction of {sc_input_clean} is passed")
logging.info("Extraction of {:<25s} is passed".format(sc_input_clean))

with open (f"{dir}_testcases/{dir}_report.csv","a+") as rep:
rep.write(f"{sc_input_clean},passed\n")
else:
logging.info(f"Extraction of {sc_input_clean} is failed")
logging.info("Extraction of {:<25s} is failed".format(sc_input_clean))

with open (f"{dir}_testcases/{dir}_report.csv","a+") as rep:
rep.write(f"{sc_input_clean},failed\n")
Expand Down Expand Up @@ -135,7 +135,7 @@ def main():
end''')
os.system(f"klayout -b -r sc_testcases/split_gds.rb -rd input={cell}.gds")
os.system(f"rm -rf sc_testcases/split_gds.rb")

# Create cdl splitter script
cdl = cell.split("/")[-1]
os.makedirs(f"sc_testcases/sc_split/sc_netlists/",exist_ok=False)
Expand Down Expand Up @@ -165,40 +165,14 @@ def main():
else:
cell_clean = cell.replace("ip_testcases/","")
executor.submit(lvs_check, cell_clean)

# Running LVS on SC
else:
sc_list = glob.glob("sc_testcases/sc_split/*")
for sc in sc_list:
sc_clean = sc.split('.gds')[0].split ('sc_testcases/')[-1]
executor.submit(lvs_check, sc_clean)


if __name__ == "__main__":

# logs format
logging.basicConfig(level=logging.DEBUG, format=f"%(asctime)s | %(levelname)-7s | %(message)s", datefmt='%d-%b-%Y %H:%M:%S')

# Args
arguments = docopt(__doc__, version='SC LVS REGRESSION: 0.1')
workers_count = os.cpu_count()*2 if arguments["--num_cores"] == None else int(arguments["--num_cores"])

out_dir = arguments["--run_dir"]
# Check out_dir existance
if os.path.exists(out_dir) and os.path.isdir(out_dir):
pass
else:
logging.error("This run directory doesn't exist. Please recheck.")
exit ()

pass_count = 0
fail_count = 0

# Calling main function
main()

time.sleep(10)

if os.path.isfile("sc_testcases/sc_report.csv"):
df = pd.read_csv("sc_testcases/sc_report.csv")
df.columns = ["CELL NAME","RESULT"]
Expand All @@ -212,8 +186,9 @@ def main():
logging.info(f"NO. OF FAILED SC CELLS : {fail_count}")
logging.info("==================================\n")

# Move split files into run dir
os.system (f"mv -f sc_testcases/sc_report.csv sc_testcases/sc_split/ {out_dir}")
# Move split files into run dir
shutil.move("sc_testcases/sc_report.csv", out_dir)
shutil.move("sc_testcases/sc_split/", out_dir)

elif os.path.isfile("ip_testcases/ip_report.csv"):
df = pd.read_csv("ip_testcases/ip_report.csv")
Expand All @@ -228,10 +203,34 @@ def main():
logging.info(f"NO. OF FAILED IP CELLS : {fail_count}")
logging.info("==================================\n")

# Move split files into run dir
os.system (f"mv -f ip_testcases/ip_report.csv {out_dir}")
# Move files into run dir
shutil.move("ip_testcases/ip_report.csv", out_dir)

else:
logging.info("\n==================================")
logging.info("Regression Test is failed")
logging.info("==================================\n")


if __name__ == "__main__":

# logs format
logging.basicConfig(level=logging.DEBUG, format=f"%(asctime)s | %(levelname)-7s | %(message)s", datefmt='%d-%b-%Y %H:%M:%S')

# Args
arguments = docopt(__doc__, version='SC LVS REGRESSION: 0.1')
workers_count = os.cpu_count()*2 if arguments["--num_cores"] == None else int(arguments["--num_cores"])

out_dir = arguments["--run_dir"]
# Check out_dir existance
if os.path.exists(out_dir) and os.path.isdir(out_dir):
pass
else:
logging.error("This run directory doesn't exist. Please recheck.")
exit ()

pass_count = 0
fail_count = 0

# Calling main function
main()

0 comments on commit 0380066

Please sign in to comment.