From 1aae6df669bf6aa1976a4c154a05fd73e59cedf0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 30 Jun 2019 17:36:58 -0400 Subject: [PATCH] Internals: Run graph self tests on --debug-self-test --- src/V3GraphTest.cpp | 17 +++-------------- src/Verilator.cpp | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/V3GraphTest.cpp b/src/V3GraphTest.cpp index 515325eaa..00dd954e3 100644 --- a/src/V3GraphTest.cpp +++ b/src/V3GraphTest.cpp @@ -32,15 +32,6 @@ // Test class class V3GraphTest { -public: - // ***These tests only run with DEBUG ON*** - static int debug() { - static int level = -1; - // Note setting just --debug will not enable this, as we exit when we run the test - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__, 0); - return level; - } - protected: // MEMBERS DfaGraph m_graph; @@ -59,9 +50,8 @@ protected: public: V3GraphTest() {} virtual ~V3GraphTest() {} - void run() { - if (debug()) runTest(); - } + VL_DEBUG_FUNC; // Declare debug() + void run() { runTest(); } }; //###################################################################### @@ -69,7 +59,7 @@ public: // Vertices and nodes class V3GraphTestVertex : public V3GraphVertex { - string m_name; + string m_name; public: V3GraphTestVertex(V3Graph* graphp, const string& name) : V3GraphVertex(graphp), m_name(name) {} @@ -363,5 +353,4 @@ void V3Graph::selfTest() { { V3GraphTestVars test; test.run(); } { V3GraphTestDfa test; test.run(); } { V3GraphTestImport test; test.run(); } - if (V3GraphTest::debug()) v3fatalSrc("Exiting due to graph testing enabled"); } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index b34ab5b5e..6c693b14b 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -624,8 +624,8 @@ int main(int argc, char** argv, char** env) { // and after removing files as may make debug output) VHashSha1::selfTest(); AstBasicDTypeKwd::selfTest(); - V3Graph::selfTest(); if (v3Global.opt.debugSelfTest()) { + V3Graph::selfTest(); V3TSP::selfTest(); V3ScoreboardBase::selfTest(); V3Partition::selfTest();