drc_proto: don't launch DRC providers with empty/incomplete rule sets

This commit is contained in:
Tomasz Wlostowski 2020-07-23 16:22:45 +02:00
parent cf0bb60fbb
commit a504bd0795
2 changed files with 26 additions and 3 deletions

View File

@ -207,10 +207,25 @@ void test::DRC_ENGINE::RunTests( )
inferImplicitRules();
CompileRules();
for( auto provider : m_testProviders )
{
bool skipProvider = false;
for( auto ruleID : provider->GetMatchingRuleIds() )
{
if( !HasCorrectRulesForId( ruleID ) )
{
ReportAux( wxString::Format( "DRC provider '%s' has no rules provided. Skipping run.", provider->GetName() ) );
skipProvider = true;
break;
}
}
if( skipProvider )
continue;
drc_dbg(0, "Running test provider: '%s'\n", (const char *) provider->GetName().c_str() );
ReportAux( wxString::Format( "Run DRC provider: '%s'", provider->GetName() ) );
provider->Run();
@ -316,10 +331,10 @@ std::vector<test::DRC_RULE*> test::DRC_ENGINE::QueryRulesById( test::DRC_RULE_ID
std::vector<test::DRC_RULE*> rv;
auto dr = m_ruleMap[ruleID]->defaultRule;
assert( dr );
if ( dr )
rv.push_back( dr );
rv.push_back( dr );
for( auto rule : m_ruleMap[ruleID]->sortedRules )
{
@ -331,3 +346,9 @@ std::vector<test::DRC_RULE*> test::DRC_ENGINE::QueryRulesById( test::DRC_RULE_ID
return rv;
}
bool test::DRC_ENGINE::HasCorrectRulesForId( test::DRC_RULE_ID_T ruleID )
{
return m_ruleMap[ruleID]->defaultRule != nullptr;
}

View File

@ -148,6 +148,8 @@ public:
std::vector<DRC_RULE*> QueryRulesById( test::DRC_RULE_ID_T ruleID );
bool HasCorrectRulesForId( test::DRC_RULE_ID_T ruleID );
EDA_UNITS UserUnits() const
{
return EDA_UNITS::MILLIMETRES;