Skip to content
Snippets Groups Projects

RTSD-103, fixed rm error in regtest

Merged RTSD-103, fixed rm error in regtest
All threads resolved!
Merged Pieter Donker requested to merge RTSD-103 into master
All threads resolved!
1 file
+ 21
30
Compare changes
  • Side-by-side
  • Inline
@@ -68,13 +68,14 @@ from datetime import timedelta
@@ -68,13 +68,14 @@ from datetime import timedelta
from argparse import ArgumentParser
from argparse import ArgumentParser
from collections import OrderedDict
from collections import OrderedDict
from copy import copy
from copy import copy
 
from shutil import rmtree
import common_radiohdl as cm
import common_radiohdl as cm
from logger import MyLogger
from logger import MyLogger
from hdl_libraries_wizard import HdlLibrariesWizard
from hdl_libraries_wizard import HdlLibrariesWizard
from terminal import Terminal
from terminal import Terminal
MAX_PROC = 4 # maximum number of processes to run, each process needs a modelsim license
MAX_PROC = 2 # maximum number of processes to run, each process needs a modelsim license
MK_TIMEOUT = 20 * 60 # timeout in seconds (1x60 seconds = 1 min(s)) for each *_mk.do command
MK_TIMEOUT = 20 * 60 # timeout in seconds (1x60 seconds = 1 min(s)) for each *_mk.do command
SIM_TIMEOUT = 3 * 3600 # timeout in seconds (1x3600 seconds = 1 hour(s)) for each *_sim.do command
SIM_TIMEOUT = 3 * 3600 # timeout in seconds (1x3600 seconds = 1 hour(s)) for each *_sim.do command
@@ -234,7 +235,6 @@ def generate_task_info_dict(buildset, buildset_file, lib_names):
@@ -234,7 +235,6 @@ def generate_task_info_dict(buildset, buildset_file, lib_names):
"tb_name": tb_name,
"tb_name": tb_name,
"n_make_runs": 0,
"n_make_runs": 0,
"n_simulate_runs": 0,
"n_simulate_runs": 0,
"remove_do_files": False,
"create_do_make_all_file": False,
"create_do_make_all_file": False,
"create_do_simulate_file": False,
"create_do_simulate_file": False,
}
}
@@ -254,7 +254,6 @@ def make_all_do_paths(task_info):
@@ -254,7 +254,6 @@ def make_all_do_paths(task_info):
def make_do_files(task_info, task_queue, response_queue):
def make_do_files(task_info, task_queue, response_queue):
# 1) make all do files
# 1) make all do files
open_tasks = []
open_tasks = []
remove_done = []
make_all_done = []
make_all_done = []
tb_file_done = []
tb_file_done = []
for task_id in task_info:
for task_id in task_info:
@@ -262,11 +261,6 @@ def make_do_files(task_info, task_queue, response_queue):
@@ -262,11 +261,6 @@ def make_do_files(task_info, task_queue, response_queue):
tb_file = task_info[task_id]["tb_file"]
tb_file = task_info[task_id]["tb_file"]
tb_name = task_info[task_id]["tb_name"]
tb_name = task_info[task_id]["tb_name"]
do_action = False
do_action = False
if lib_name not in remove_done:
logger.info("remove_do_files = True for %s", lib_name)
task_info[task_id]["remove_do_files"] = True
do_action = True
remove_done.append(lib_name)
if lib_name not in make_all_done:
if lib_name not in make_all_done:
logger.info("create_do_make_all_file = True for %s", lib_name)
logger.info("create_do_make_all_file = True for %s", lib_name)
@@ -400,7 +394,7 @@ def simulate_all_tb(task_info, task_queue, response_queue, time_ordered_tb_dict,
@@ -400,7 +394,7 @@ def simulate_all_tb(task_info, task_queue, response_queue, time_ordered_tb_dict,
if task["task_id"] not in tb_failed_retry:
if task["task_id"] not in tb_failed_retry:
tb_failed_retry.append(task["task_id"])
tb_failed_retry.append(task["task_id"])
task_queue.put(task)
task_queue.put(task)
logger.info("Retry simulation for: %s",
logger.info("%s failed, put again in the task queue and retry simulation",
task["tb_name"])
task["tb_name"])
continue
continue
tb_passed.extend(response["passed"])
tb_passed.extend(response["passed"])
@@ -493,8 +487,10 @@ class TestBenchWorker(multiprocessing.Process):
@@ -493,8 +487,10 @@ class TestBenchWorker(multiprocessing.Process):
self.run_time = 0
self.run_time = 0
sim_dir = os.path.join(os.getenv("HDL_BUILD_DIR"), f"sim_worker{self._id}")
sim_dir = os.path.join(os.getenv("HDL_BUILD_DIR"), f"sim_worker{self._id}")
if not os.path.exists(sim_dir):
if os.path.exists(sim_dir): # delete old sim data
os.mkdir(sim_dir)
rmtree(sim_dir, ignore_errors=True)
 
os.mkdir(sim_dir)
 
os.environ["HDL_IOFILE_SIM_DIR"] = sim_dir
os.environ["HDL_IOFILE_SIM_DIR"] = sim_dir
# logger.debug("%s", str(os.environ))
# logger.debug("%s", str(os.environ))
@@ -553,7 +549,6 @@ class TestBenchWorker(multiprocessing.Process):
@@ -553,7 +549,6 @@ class TestBenchWorker(multiprocessing.Process):
self.buildset = task["buildset"]
self.buildset = task["buildset"]
self.project_sim_p_search_libraries = task["project_sim_p_search_libraries"]
self.project_sim_p_search_libraries = task["project_sim_p_search_libraries"]
self.project_sim_p_otherargs = task["project_sim_p_otherargs"]
self.project_sim_p_otherargs = task["project_sim_p_otherargs"]
self.remove_do_files_action = task["remove_do_files"]
self.create_do_make_all_action = task["create_do_make_all_file"]
self.create_do_make_all_action = task["create_do_make_all_file"]
self.create_do_simulate_action = task["create_do_simulate_file"]
self.create_do_simulate_action = task["create_do_simulate_file"]
@@ -570,8 +565,6 @@ class TestBenchWorker(multiprocessing.Process):
@@ -570,8 +565,6 @@ class TestBenchWorker(multiprocessing.Process):
if self.task == "make_new_do_files":
if self.task == "make_new_do_files":
self.make_new_do_files()
self.make_new_do_files()
elif self.task == "remove_do_files":
self.remove_do_files()
elif self.task == "create_do_make_all_file":
elif self.task == "create_do_make_all_file":
self.create_do_make_all_file()
self.create_do_make_all_file()
elif self.task == "create_do_simulate_file":
elif self.task == "create_do_simulate_file":
@@ -616,27 +609,11 @@ class TestBenchWorker(multiprocessing.Process):
@@ -616,27 +609,11 @@ class TestBenchWorker(multiprocessing.Process):
logger.info("stop worker %d", self._id)
logger.info("stop worker %d", self._id)
def make_new_do_files(self):
def make_new_do_files(self):
if self.remove_do_files_action:
self.remove_do_files()
if self.create_do_make_all_action:
if self.create_do_make_all_action:
self.create_do_make_all_file()
self.create_do_make_all_file()
if self.create_do_simulate_action:
if self.create_do_simulate_action:
self.create_do_simulate_file()
self.create_do_simulate_file()
def remove_do_files(self):
"""
Remove all .do files.
"""
rm_list = glob.glob(os.path.join(self.do_path, "*.do"))
# logger.info("remove rm_list '%s'", str(rm_list))
for rm in rm_list:
try:
logger.debug("%s: remove '%s'", self.lib_name, rm)
os.remove(rm) # rm <mpf_path>/regression_test_vhdl/*.do
except FileNotFoundError:
logger.error("FileNotFoundError r632")
pass
def create_do_make_all_file(self):
def create_do_make_all_file(self):
"""
"""
Create test bench do files in same build directory as where the mpf is
Create test bench do files in same build directory as where the mpf is
@@ -654,6 +631,13 @@ class TestBenchWorker(multiprocessing.Process):
@@ -654,6 +631,13 @@ class TestBenchWorker(multiprocessing.Process):
# Write separate do file for each test bench in the VHDL regression test of this library
# Write separate do file for each test bench in the VHDL regression test of this library
do_name = f"{self.lib_name}_mk_all.do"
do_name = f"{self.lib_name}_mk_all.do"
do_pathname = os.path.join(self.do_path, do_name)
do_pathname = os.path.join(self.do_path, do_name)
 
try:
 
# rm <mpf_path>/regression_test_vhdl/<lib_name>_mk_all.do
 
os.remove(do_pathname)
 
logger.debug("%s: remove '%s'", self.lib_name, do_pathname)
 
except FileNotFoundError:
 
pass
 
with open(do_pathname, "w") as fp:
with open(do_pathname, "w") as fp:
fp.write(do_file)
fp.write(do_file)
return
return
@@ -687,6 +671,13 @@ class TestBenchWorker(multiprocessing.Process):
@@ -687,6 +671,13 @@ class TestBenchWorker(multiprocessing.Process):
# Write separate do file for each test bench in the VHDL regression test of this library
# Write separate do file for each test bench in the VHDL regression test of this library
do_name = f"{self.tb_name}_simulate.do"
do_name = f"{self.tb_name}_simulate.do"
do_pathname = os.path.join(self.do_path, do_name)
do_pathname = os.path.join(self.do_path, do_name)
 
try:
 
# rm <mpf_path>/regression_test_vhdl/<lib_name>_simulate.do
 
os.remove(do_pathname)
 
logger.debug("%s: remove '%s'", self.lib_name, do_pathname)
 
except FileNotFoundError:
 
pass
 
with open(do_pathname, "w") as fp:
with open(do_pathname, "w") as fp:
fp.write(do_file)
fp.write(do_file)
return
return
Loading