Option to expect no warnings

This commit is contained in:
Miodrag Milanovic 2020-02-17 15:36:06 +01:00
parent d8735b2913
commit 5641b0248f
4 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -45,6 +45,7 @@ std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes
std::vector<std::pair<std::regex,LogExpectedItem>> log_expect_log, log_expect_warning, log_expect_error;
std::set<std::string> 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;

View File

@ -52,6 +52,7 @@ extern std::map<std::string, std::set<std::string>> log_hdump;
extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
extern std::set<std::string> 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;

View File

@ -60,6 +60,9 @@ struct LoggerPass : public Pass {
log(" -expect <type> <regex> <expected_count>\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<std::string> 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);