mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Cleanup quotes
This commit is contained in:
parent
51c3d59605
commit
32b62e9d0c
27
bin/iterelf
27
bin/iterelf
@ -13,15 +13,15 @@ from multiprocessing import Pool, TimeoutError as MPTimeoutError
|
|||||||
TIMEOUT_DUR = 60 # 1` minute
|
TIMEOUT_DUR = 60 # 1` minute
|
||||||
|
|
||||||
class bcolors:
|
class bcolors:
|
||||||
HEADER = '\033[95m'
|
HEADER = "\033[95m"
|
||||||
OKBLUE = '\033[94m'
|
OKBLUE = "\033[94m"
|
||||||
OKCYAN = '\033[96m'
|
OKCYAN = "\033[96m"
|
||||||
OKGREEN = '\033[92m'
|
OKGREEN = "\033[92m"
|
||||||
WARNING = '\033[93m'
|
WARNING = "\033[93m"
|
||||||
FAIL = '\033[91m'
|
FAIL = "\033[91m"
|
||||||
ENDC = '\033[0m'
|
ENDC = "\033[0m"
|
||||||
BOLD = '\033[1m'
|
BOLD = "\033[1m"
|
||||||
UNDERLINE = '\033[4m'
|
UNDERLINE = "\033[4m"
|
||||||
|
|
||||||
def search_log_for_mismatches(logfile):
|
def search_log_for_mismatches(logfile):
|
||||||
"""Search through the given log file for text, returning True if it is found or False if it is not"""
|
"""Search through the given log file for text, returning True if it is found or False if it is not"""
|
||||||
@ -34,8 +34,8 @@ def search_log_for_mismatches(logfile):
|
|||||||
|
|
||||||
def run_test_case(elf):
|
def run_test_case(elf):
|
||||||
"""Run the given test case, and return 0 if the test suceeds and 1 if it fails"""
|
"""Run the given test case, and return 0 if the test suceeds and 1 if it fails"""
|
||||||
WALLY = os.environ.get('WALLY')
|
WALLY = os.environ.get("WALLY")
|
||||||
fields = elf.rsplit('/', 3)
|
fields = elf.rsplit("/", 3)
|
||||||
if fields[2] == "ref":
|
if fields[2] == "ref":
|
||||||
shortelf = fields[1] + "_" + fields[3]
|
shortelf = fields[1] + "_" + fields[3]
|
||||||
else:
|
else:
|
||||||
@ -78,12 +78,11 @@ if os.path.isdir(args.dir):
|
|||||||
DirectorMode = 1
|
DirectorMode = 1
|
||||||
for dirpath, dirnames, filenames in os.walk(os.path.abspath(args.dir)):
|
for dirpath, dirnames, filenames in os.walk(os.path.abspath(args.dir)):
|
||||||
for file in filenames:
|
for file in filenames:
|
||||||
if (file.endswith("elf") and not file.endswith(args.exclude)):
|
if file.endswith("elf") and not file.endswith(args.exclude):
|
||||||
ElfList.append(os.path.join(dirpath, file))
|
ElfList.append(os.path.join(dirpath, file))
|
||||||
else:
|
else:
|
||||||
print(args.dir + " is not a directory")
|
print(args.dir + " is not a directory")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
#print(ElfList)
|
|
||||||
|
|
||||||
# spawn parallel wsim jobs for each ELF file
|
# spawn parallel wsim jobs for each ELF file
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ with Pool(processes=min(len(ElfList),multiprocessing.cpu_count(), ImperasDVLicen
|
|||||||
results = {}
|
results = {}
|
||||||
for elf in ElfList:
|
for elf in ElfList:
|
||||||
results[elf] = pool.apply_async(run_test_case, (elf,))
|
results[elf] = pool.apply_async(run_test_case, (elf,))
|
||||||
for (elf,result) in results.items():
|
for elf, result in results.items():
|
||||||
try:
|
try:
|
||||||
num_fail += result.get(timeout=TIMEOUT_DUR)
|
num_fail += result.get(timeout=TIMEOUT_DUR)
|
||||||
except MPTimeoutError:
|
except MPTimeoutError:
|
||||||
|
14
bin/wsim
14
bin/wsim
@ -16,7 +16,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Global variable
|
# Global variable
|
||||||
WALLY = os.environ.get('WALLY')
|
WALLY = os.environ.get("WALLY")
|
||||||
|
|
||||||
def parseArgs():
|
def parseArgs():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
@ -41,13 +41,13 @@ def validateArgs(args):
|
|||||||
if not args.testsuite and not args.elf:
|
if not args.testsuite and not args.elf:
|
||||||
print("Error: Missing test suite or ELF file")
|
print("Error: Missing test suite or ELF file")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if any([args.lockstep, args.lockstepverbose, args.fcov]) and not (args.testsuite.endswith('.elf') or args.elf) and args.testsuite != "buildroot":
|
if any([args.lockstep, args.lockstepverbose, args.fcov]) and not (args.testsuite.endswith(".elf") or args.elf) and args.testsuite != "buildroot":
|
||||||
print(f"Invalid Options. Cannot run a testsuite, {args.testsuite} with lockstep or fcov. Must run a single elf or buildroot.")
|
print(f"Invalid Options. Cannot run a testsuite, {args.testsuite} with lockstep or fcov. Must run a single elf or buildroot.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif any([args.gui, args.ccov, args.fcov, args.lockstep, args.lockstepverbose]) and args.sim not in ["questa", "vcs"]:
|
elif any([args.gui, args.ccov, args.fcov, args.lockstep, args.lockstepverbose]) and args.sim not in ["questa", "vcs"]:
|
||||||
print("Option only supported for Questa and VCS")
|
print("Option only supported for Questa and VCS")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif (args.tb == "testbench_fp" and args.sim != "questa"):
|
elif args.tb == "testbench_fp" and args.sim != "questa":
|
||||||
print("Error: testbench_fp presently only supported by Questa, not VCS or Verilator, because of a touchy testbench")
|
print("Error: testbench_fp presently only supported by Questa, not VCS or Verilator, because of a touchy testbench")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@ -58,19 +58,19 @@ def elfFileCheck(args):
|
|||||||
elif args.elf:
|
elif args.elf:
|
||||||
print(f"ELF file not found: {args.elf}")
|
print(f"ELF file not found: {args.elf}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif args.testsuite.endswith('.elf'): # No --elf argument; check if testsuite has a .elf extension and use that instead
|
elif args.testsuite.endswith(".elf"): # No --elf argument; check if testsuite has a .elf extension and use that instead
|
||||||
if os.path.isfile(args.testsuite):
|
if os.path.isfile(args.testsuite):
|
||||||
ElfFile = f"+ElfFile={os.path.abspath(args.testsuite)}"
|
ElfFile = f"+ElfFile={os.path.abspath(args.testsuite)}"
|
||||||
# extract the elf name from the path to be the test suite
|
# extract the elf name from the path to be the test suite
|
||||||
fields = args.testsuite.rsplit('/', 3)
|
fields = args.testsuite.rsplit("/", 3)
|
||||||
# if the name is just ref.elf in a deep path (riscv-arch-test/wally-riscv-arch-test), then use the directory name as the test suite to make it unique; otherwise work directory will have duplicates.
|
# if the name is just ref.elf in a deep path (riscv-arch-test/wally-riscv-arch-test), then use the directory name as the test suite to make it unique; otherwise work directory will have duplicates.
|
||||||
if len(fields) > 3:
|
if len(fields) > 3:
|
||||||
if fields[2] == "ref":
|
if fields[2] == "ref":
|
||||||
args.testsuite = f"{fields[1]}_{fields[3]}"
|
args.testsuite = f"{fields[1]}_{fields[3]}"
|
||||||
else:
|
else:
|
||||||
args.testsuite = f"{fields[2]}_{fields[3]}"
|
args.testsuite = f"{fields[2]}_{fields[3]}"
|
||||||
elif '/' in args.testsuite:
|
elif "/" in args.testsuite:
|
||||||
args.testsuite=args.testsuite.rsplit('/', 1)[1] # strip off path if present
|
args.testsuite = args.testsuite.rsplit("/", 1)[1] # strip off path if present
|
||||||
else:
|
else:
|
||||||
print(f"ELF file not found: {args.testsuite}")
|
print(f"ELF file not found: {args.testsuite}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -12,7 +12,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Global variables
|
# Global variables
|
||||||
WALLY = os.environ.get('WALLY')
|
WALLY = os.environ.get("WALLY")
|
||||||
simdir = f"{WALLY}/sim/vcs"
|
simdir = f"{WALLY}/sim/vcs"
|
||||||
cfgdir = f"{WALLY}/config"
|
cfgdir = f"{WALLY}/config"
|
||||||
srcdir = f"{WALLY}/src"
|
srcdir = f"{WALLY}/src"
|
||||||
@ -21,7 +21,7 @@ logdir = f"{simdir}/logs"
|
|||||||
|
|
||||||
# run a Linux command and return the result as a string in a form that VCS can use
|
# run a Linux command and return the result as a string in a form that VCS can use
|
||||||
def runFindCommand(cmd):
|
def runFindCommand(cmd):
|
||||||
res = subprocess.check_output(cmd, shell=True, )
|
res = subprocess.check_output(cmd, shell=True)
|
||||||
res = str(res)
|
res = str(res)
|
||||||
res = res.replace("\\n", " ") # replace newline with space
|
res = res.replace("\\n", " ") # replace newline with space
|
||||||
res = res.replace("'", "") # strip off quotation marks
|
res = res.replace("'", "") # strip off quotation marks
|
||||||
@ -55,7 +55,7 @@ def generateFileList(testbench):
|
|||||||
rtlsrc_files = runFindCommand(rtlsrc_cmd)
|
rtlsrc_files = runFindCommand(rtlsrc_cmd)
|
||||||
tbcommon_cmd = f'find {tbdir}/common -name "*.sv"'
|
tbcommon_cmd = f'find {tbdir}/common -name "*.sv"'
|
||||||
tbcommon_files = runFindCommand(tbcommon_cmd)
|
tbcommon_files = runFindCommand(tbcommon_cmd)
|
||||||
tb_file = f'{tbdir}/{testbench}.sv'
|
tb_file = f"{tbdir}/{testbench}.sv"
|
||||||
return f"{tb_file} {rtlsrc_files} {tbcommon_files}"
|
return f"{tb_file} {rtlsrc_files} {tbcommon_files}"
|
||||||
|
|
||||||
def processArgs(wkdir, args):
|
def processArgs(wkdir, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user