Improve not-found message to show cwd

This commit is contained in:
Wilson Snyder 2026-03-10 08:55:51 -04:00
parent 2046879beb
commit a7a5c9f548
9 changed files with 13 additions and 8 deletions

View File

@ -806,9 +806,8 @@ class EmitMkHierVerilation final {
const V3HierGraph* const m_graphp;
const string m_makefile; // path of this makefile
void emitCommonOpts(V3OutMkFile& of) const {
const string cwd = V3Os::filenameRealPath(".");
of.puts("# Verilation of hierarchical blocks are executed in this directory\n");
of.puts("VM_HIER_RUN_DIR := " + cwd + "\n");
of.puts("VM_HIER_RUN_DIR := " + V3Os::cwd() + "\n");
of.puts("# Common options for hierarchical blocks\n");
const string fullpath_bin = V3Os::filenameRealPath(v3Global.opt.buildDepBin());
const string verilator_wrapper = V3Os::filenameDir(fullpath_bin) + "/verilator";

View File

@ -702,6 +702,8 @@ string V3Options::filePathLookedMsg(FileLine* fl, const string& modname) {
ss << V3Error::warnMore() << " " << fn << "\n";
}
}
ss << V3Error::warnMore() << "... With current working directory '" << V3Os::cwd()
<< "'\n";
}
return ss.str();
}
@ -1954,8 +1956,6 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
parser.finalize();
const std::string cwd = V3Os::filenameRealPath(".");
for (int i = 0; i < argc;) {
UINFO(9, " Option: " << argv[i]);

View File

@ -31,6 +31,7 @@
class V3Os final {
public:
// METHODS (environment)
static string cwd() { return filenameRealPath("."); }
static string getenvStr(const string& envvar, const string& defaultValue);
static void setenvStr(const string& envvar, const string& value, const string& why);

View File

@ -2431,11 +2431,11 @@ class VlTest:
line = re.sub(r'CPU Time: +[0-9.]+ seconds[^\n]+', 'CPU Time: ###', line)
line = re.sub(r'\?v=[0-9.]+', '?v=latest', line) # warning URL
line = re.sub(r'_h[0-9a-f]{8}_', '_h########_', line)
line = re.sub(r'%Error: /[^: ]+/([^/:])', r'%Error: .../\1',
line) # Avoid absolute paths
line = re.sub(r'("file://)/[^: ]+/([^/:])', r'\1/.../\2',
line) # Avoid absolute paths
# Avoid absolute paths
line = re.sub(r'%Error: /[^: ]+/([^/:])', r'%Error: .../\1', line)
line = re.sub(r'("file://)/[^: ]+/([^/:])', r'\1/.../\2', line)
line = re.sub(r' \/[^ ]+\/verilated_std.sv', ' verilated_std.sv', line)
line = re.sub(r'(With current working directory \')[^\']+\'', r"\1...'", line)
#
(line, n) = re.subn(r'Exiting due to.*', r"Exiting due to", line)
if n:

View File

@ -12,4 +12,5 @@
obj_vlt/t_gen_missing_bad/foo_not_needed
obj_vlt/t_gen_missing_bad/foo_not_needed.v
obj_vlt/t_gen_missing_bad/foo_not_needed.sv
... With current working directory '...'
%Error: Exiting due to

View File

@ -10,4 +10,5 @@
obj_dir/nfound
obj_dir/nfound.v
obj_dir/nfound.sv
... With current working directory '...'
%Error: Exiting due to

View File

@ -10,4 +10,5 @@
obj_vlt/t_hier_block_type_param_notfound_bad//does-not-exist
obj_vlt/t_hier_block_type_param_notfound_bad//does-not-exist.v
obj_vlt/t_hier_block_type_param_notfound_bad//does-not-exist.sv
... With current working directory '...'
%Error: Exiting due to

View File

@ -20,4 +20,5 @@
obj_vlt/t_package_dup_bad2/IOBUF
obj_vlt/t_package_dup_bad2/IOBUF.v
obj_vlt/t_package_dup_bad2/IOBUF.sv
... With current working directory '...'
%Error: Exiting due to

View File

@ -12,4 +12,5 @@
obj_vlt/t_preproc_inc_notfound_bad/this_file_is_not_found.vh
obj_vlt/t_preproc_inc_notfound_bad/this_file_is_not_found.vh.v
obj_vlt/t_preproc_inc_notfound_bad/this_file_is_not_found.vh.sv
... With current working directory '...'
%Error: Exiting due to