Option to expect no warnings
authorMiodrag Milanovic <mmicko@gmail.com>
Mon, 17 Feb 2020 14:36:06 +0000 (15:36 +0100)
committerMiodrag Milanovic <mmicko@gmail.com>
Mon, 17 Feb 2020 14:36:06 +0000 (15:36 +0100)
kernel/driver.cc
kernel/log.cc
kernel/log.h
passes/cmds/logger.cc

index 2917586eaf6e53df77bd93aeb2688dd6283b590d..74f53901e6f1195674852180d2c95817669cdf43 100644 (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);
index 89a403e63612ae787059a81a746c6ffcae1b8f42..1575b4fedd6e4ce11a25a1452e5d72d58b5774e1 100644 (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;
index 0f912fccb14c81fd784c8aaf0a02d71eb5a22de8..79de1a20afae1b60b48c2eb4b30d06e63cbadd53 100644 (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;
index 30768980e95b4228f0b607a7197d37ba186e7279..947b178c50cc1c8d91b66336d0e32b41af262540 100644 (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);