YosysHQ / yosys

Yosys Open SYnthesis Suite
https://yosyshq.net/yosys/
ISC License
3.5k stars 895 forks source link

log: Never silence `log_cmd_error` #4613

Closed povik closed 1 month ago

povik commented 1 month ago

What are the reasons/motivation for this change?

Some errors can get hidden by -v N, see The-OpenROAD-Project/OpenROAD-flow-scripts#2375

This makes the user almost always worse off. The only exception I can think of is someone scripting around Yosys commands, checking for their exit status, and handling failures gracefully (for the few failure modes where that can be done). I've never seen such a Yosys script.

Explain how this is achieved.

Add extra handling to arrange for log_cmd_error never being silenced by the command line -v N option. Similar path for log_error exists already.

If applicable, please suggest to reviewers how they can test the change.

With test.tcl:

yosys -import
hierarchy -top nonexistent

Before

$ ./yosys -v 3 test.tcl
1. Executing HIERARCHY pass (managing design hierarchy).
ERROR: TCL interpreter returned an error: Yosys command produced an error

After

$ ./yosys -v 3 test.tcl
1. Executing HIERARCHY pass (managing design hierarchy).
ERROR: Module `nonexistent' not found!
ERROR: TCL interpreter returned an error: Yosys command produced an error
Ravenslofty commented 1 month ago

I think this should have a testcase, but I'm not entirely sure how it would be implemented; maybe with a custom run_test.sh?