From 2bab5d3fa53e20430ec52c8b4fd3951480e256a0 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Jun 2026 14:48:11 +0200 Subject: [PATCH] Add VERBOSE (and V) option to Makefiles --- tests/common.mk | 8 +++++++- tests/gen_tests_makefile.py | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/common.mk b/tests/common.mk index 3f1efbf2a..eb9dcf260 100644 --- a/tests/common.mk +++ b/tests/common.mk @@ -28,6 +28,12 @@ export YOSYS_MAX_THREADS export LLVM_PROFILE_FILE export LLVM_PROFILE_FILE_BUFFER_SIZE=0 +ifeq ($(or $(V),$(VERBOSE)),1) + QUIET := +else + QUIET := >/dev/null 2>&1 +endif + all: ifndef OVERRIDE_MAIN @@ -38,7 +44,7 @@ endif define run_test @set -e; \ rc=0; \ - ( set -e; $(2) ) >/dev/null 2>&1 || rc=$$?; \ + ( set -e; $(2) ) $(QUIET) || rc=$$?; \ if [ $$rc -eq 0 ]; then \ echo "PASS $1"; \ echo PASS > $1.result; \ diff --git a/tests/gen_tests_makefile.py b/tests/gen_tests_makefile.py index efaa9a652..13bb806c9 100644 --- a/tests/gen_tests_makefile.py +++ b/tests/gen_tests_makefile.py @@ -26,27 +26,27 @@ def generate_target(name, command, deps = None): print(f"\t@$(call run_test,{target}, $({target}_cmd))") def generate_ys_test(ys_file, yosys_args="", commands=""): - cmd = f'$(YOSYS) -ql {ys_file}.err {yosys_args} {ys_file} && mv {ys_file}.err {ys_file}.log' + cmd = f'$(YOSYS) -l {ys_file}.err {yosys_args} {ys_file} && mv {ys_file}.err {ys_file}.log' if commands: cmd += f"; \\\n{commands}" generate_target(ys_file, cmd) def generate_tcl_test(tcl_file, yosys_args="", commands=""): - cmd = f'$(YOSYS) -ql {tcl_file}.err {yosys_args} {tcl_file} && mv {tcl_file}.err {tcl_file}.log' + cmd = f'$(YOSYS) -l {tcl_file}.err {yosys_args} {tcl_file} && mv {tcl_file}.err {tcl_file}.log' if commands: cmd += f"; \\\n{commands}" generate_target(tcl_file, cmd) def generate_sv_check(sv_file, yosys_args="", yosys_cmds=""): yosys_cmd = f'read -sv {sv_file}; {yosys_cmds}' - cmd = f'$(YOSYS) -ql {sv_file}.err -p "{yosys_cmd}" {yosys_args} && mv {sv_file}.err {sv_file}.log' + cmd = f'$(YOSYS) -l {sv_file}.err -p "{yosys_cmd}" {yosys_args} && mv {sv_file}.err {sv_file}.log' generate_target(sv_file, cmd) def generate_sv_test(sv_file, yosys_args="", commands=""): base = os.path.splitext(sv_file)[0] if not os.path.exists(base + ".ys"): yosys_cmd = '-p "prep -top top; async2sync; sat -enable_undef -verify -prove-asserts"' - cmd = f'$(YOSYS) -ql {sv_file}.err {yosys_cmd} {yosys_args} {sv_file} && mv {sv_file}.err {sv_file}.log' + cmd = f'$(YOSYS) -l {sv_file}.err {yosys_cmd} {yosys_args} {sv_file} && mv {sv_file}.err {sv_file}.log' if commands: cmd += f"; \\\n{commands}" generate_target(sv_file, cmd)