Separate footprint lib issues from footprint mismatch issues.

Fixes https://gitlab.com/kicad/code/kicad/issues/10132
This commit is contained in:
Jeff Young 2022-01-11 21:13:41 +00:00
parent 6ccfec0553
commit 8c6c87eaf4
5 changed files with 24 additions and 8 deletions

View File

@ -177,9 +177,13 @@ DRC_ITEM DRC_ITEM::netConflict( DRCE_NET_CONFLICT,
wxT( "net_conflict" ) );
DRC_ITEM DRC_ITEM::libFootprintIssues( DRCE_LIB_FOOTPRINT_ISSUES,
_( "Library footprint issue" ),
_( "Footprint not found in libraries" ),
wxT( "lib_footprint_issues" ) );
DRC_ITEM DRC_ITEM::libFootprintMismatch( DRCE_LIB_FOOTPRINT_MISMATCH,
_( "Footprint doesn't match copy in library" ),
wxT( "lib_footprint_mismatch" ) );
DRC_ITEM DRC_ITEM::unresolvedVariable( DRCE_UNRESOLVED_VARIABLE,
_( "Unresolved text variable" ),
wxT( "unresolved_variable" ) );
@ -297,6 +301,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
DRC_ITEM::footprintTypeMismatch,
DRC_ITEM::libFootprintIssues,
DRC_ITEM::libFootprintMismatch,
DRC_ITEM::footprintTHPadhasNoHole
} );
@ -338,6 +343,7 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
case DRCE_NET_CONFLICT: return std::make_shared<DRC_ITEM>( netConflict );
case DRCE_EXTRA_FOOTPRINT: return std::make_shared<DRC_ITEM>( extraFootprint );
case DRCE_LIB_FOOTPRINT_ISSUES: return std::make_shared<DRC_ITEM>( libFootprintIssues );
case DRCE_LIB_FOOTPRINT_MISMATCH: return std::make_shared<DRC_ITEM>( libFootprintMismatch );
case DRCE_UNRESOLVED_VARIABLE: return std::make_shared<DRC_ITEM>( unresolvedVariable );
case DRCE_ASSERTION_FAILURE: return std::make_shared<DRC_ITEM>( assertionFailure );
case DRCE_COPPER_SLIVER: return std::make_shared<DRC_ITEM>( copperSliver );

View File

@ -72,7 +72,8 @@ enum PCB_DRC_CODE {
DRCE_NET_CONFLICT, // pad net doesn't match netlist
DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
DRCE_LIB_FOOTPRINT_ISSUES, // footprint does not match the current library
DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
DRCE_LIB_FOOTPRINT_MISMATCH, // footprint does not match the current library
DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
DRCE_UNRESOLVED_VARIABLE,
@ -180,6 +181,7 @@ private:
static DRC_ITEM extraFootprint;
static DRC_ITEM netConflict;
static DRC_ITEM libFootprintIssues;
static DRC_ITEM libFootprintMismatch;
static DRC_ITEM unresolvedVariable;
static DRC_ITEM assertionFailure;
static DRC_ITEM copperSliver;

View File

@ -40,6 +40,7 @@
Errors generated:
- DRCE_LIB_FOOTPRINT_ISSUES
- DRCE_LIB_FOOTPRINT_MISMATCH
*/
class DRC_TEST_PROVIDER_LIBRARY_PARITY : public DRC_TEST_PROVIDER
@ -421,8 +422,11 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
for( FOOTPRINT* footprint : board->Footprints() )
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) )
if( m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES )
&& m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_MISMATCH ) )
{
return true; // Continue with other tests
}
if( !reportProgress( ii++, board->Footprints().size(), delta ) )
return false; // DRC cancelled
@ -440,7 +444,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
{
}
if( !libTableRow )
if( !libTableRow && !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) )
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
msg.Printf( _( "The current configuration does not include the library '%s'." ),
@ -451,7 +455,8 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
continue;
}
else if( !libTable->HasLibrary( libName, true ) )
else if( !libTable->HasLibrary( libName, true )
&& !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ))
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
msg.Printf( _( "The library '%s' is not enabled in the current configuration." ),
@ -484,7 +489,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
}
}
if( !libFootprint )
if( !libFootprint && !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) )
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
msg.Printf( "Footprint '%s' not found in library '%s'.",
@ -494,9 +499,10 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
}
else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) )
else if( footprint->FootprintNeedsUpdate( libFootprint.get() )
&& !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_MISMATCH ))
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_MISMATCH );
msg.Printf( "Footprint '%s' does not match copy in library '%s'.",
fpName,
libName );

View File

@ -131,6 +131,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR
bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_MISMATCH ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer )

View File

@ -173,6 +173,7 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE
// Disable some DRC tests not useful in this testcase
bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_ISSUES ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_LIB_FOOTPRINT_MISMATCH ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_COPPER_SLIVER ] = SEVERITY::RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_STARVED_THERMAL ] = SEVERITY::RPT_SEVERITY_IGNORE;