diff --git a/kernel/driver.cc b/kernel/driver.cc index 2917586ea..74f53901e 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -558,6 +558,9 @@ int main(int argc, char **argv) fprintf(f, "\n"); } + if (log_expect_no_warnings && log_warnings_count) + log_error("Warnings: %d unique messages, %d total\n", GetSize(log_warnings), log_warnings_count); + if (print_stats) { std::string hash = log_hasher->final().substr(0, 10); diff --git a/kernel/log.cc b/kernel/log.cc index 89a403e63..1575b4fed 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -45,6 +45,7 @@ std::vector log_warn_regexes, log_nowarn_regexes, log_werror_regexes std::vector> log_expect_log, log_expect_warning, log_expect_error; std::set log_warnings, log_experimentals, log_experimentals_ignored; int log_warnings_count = 0; +bool log_expect_no_warnings = false; bool log_hdump_all = false; FILE *log_errfile = NULL; SHA1 *log_hasher = NULL; diff --git a/kernel/log.h b/kernel/log.h index 0f912fccb..79de1a20a 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -52,6 +52,7 @@ extern std::map> log_hdump; extern std::vector log_warn_regexes, log_nowarn_regexes, log_werror_regexes; extern std::set log_warnings, log_experimentals, log_experimentals_ignored; extern int log_warnings_count; +extern bool log_expect_no_warnings; extern bool log_hdump_all; extern FILE *log_errfile; extern SHA1 *log_hasher; diff --git a/passes/cmds/logger.cc b/passes/cmds/logger.cc index 30768980e..947b178c5 100644 --- a/passes/cmds/logger.cc +++ b/passes/cmds/logger.cc @@ -60,6 +60,9 @@ struct LoggerPass : public Pass { log(" -expect \n"); log(" expect log,warning or error to appear. In case of error return code is 0.\n"); log("\n"); + log(" -expect-no-warnings\n"); + log(" gives error in case there is at least one warning.\n"); + log("\n"); } void execute(std::vector args, RTLIL::Design * design) YS_OVERRIDE @@ -166,6 +169,10 @@ struct LoggerPass : public Pass { continue; } + if (args[argidx] == "-expect-no-warnings") { + log_expect_no_warnings = true; + continue; + } break; } extra_args(args, argidx, design, false);