[dvsim] Separate publish report option [PART1]
This PR is the first part of moving publish report to a separate script.
This PR moves the generated results into a separate /scratch_root/report
folder.
The result summary will be located at: /scratch_root/{branch}/report
The individual summary will be located at: /scratch_path/report
I also update the --purge option so it won't delete the report folders.
Signed-off-by: Cindy Chen <chencindy@opentitan.org>
diff --git a/util/dvsim/utils.py b/util/dvsim/utils.py
index dedcf75..4916a8d 100644
--- a/util/dvsim/utils.py
+++ b/util/dvsim/utils.py
@@ -555,6 +555,20 @@
raise exc
+def mk_path(path):
+ '''Create the specified path if it does not exist.
+
+ 'path' is a Path-like object. If it does exist, the function simply
+ returns. If it does not exist, the function creates the path and its
+ parent dictories if necessary.
+ '''
+ try:
+ Path(path).mkdir(parents=True, exist_ok=True)
+ except PermissionError as e:
+ log.fatal("Failed to create dirctory {}:\n{}.".format(path, e))
+ sys.exit(1)
+
+
def clean_odirs(odir, max_odirs, ts_format=TS_FORMAT):
"""Clean previous output directories.