Add ERC QA tests

This commit is contained in:
Seth Hillbrand 2022-09-06 13:26:36 -07:00
parent 09ef7c8f1e
commit f2e3329617
18 changed files with 1409 additions and 26 deletions

View File

@ -56,7 +56,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_pinToPinError = ERC_ITEM::Create( ERCE_PIN_TO_PIN_WARNING );
m_severities = new PANEL_SETUP_SEVERITIES( this, ERC_ITEM::GetItemsWithSeverities(),
schematic.ErcSettings().m_Severities,
schematic.ErcSettings().m_ERCSeverities,
m_pinToPinError.get() );
m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() );
@ -153,7 +153,7 @@ void DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction( wxCommandEvent& event )
m_pinMap->ImportSettingsFrom( file.m_ErcSettings->m_PinMap );
if( importDlg.m_SeveritiesOpt->GetValue() )
m_severities->ImportSettingsFrom( file.m_ErcSettings->m_Severities );
m_severities->ImportSettingsFrom( file.m_ErcSettings->m_ERCSeverities );
if( importDlg.m_NetClassesOpt->GetValue() )
m_netclasses->ImportSettingsFrom( file.m_NetSettings );

View File

@ -90,19 +90,19 @@ ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
ResetPinMap();
for( int i = ERCE_FIRST; i <= ERCE_LAST; ++i )
m_Severities[ i ] = RPT_SEVERITY_ERROR;
m_ERCSeverities[ i ] = RPT_SEVERITY_ERROR;
// Error is the default setting so set non-error priorities here.
m_Severities[ERCE_UNSPECIFIED] = RPT_SEVERITY_UNDEFINED;
m_Severities[ERCE_ENDPOINT_OFF_GRID] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_PIN_TO_PIN_WARNING] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_SIMILAR_LABELS] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_GLOBLABEL] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_DRIVER_CONFLICT] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_BUS_ENTRY_CONFLICT] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_NOCONNECT_CONNECTED] = RPT_SEVERITY_WARNING;
m_Severities[ERCE_NOCONNECT_NOT_CONNECTED] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_UNSPECIFIED] = RPT_SEVERITY_UNDEFINED;
m_ERCSeverities[ERCE_ENDPOINT_OFF_GRID] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_PIN_TO_PIN_WARNING] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_SIMILAR_LABELS] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_GLOBLABEL] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_DRIVER_CONFLICT] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_BUS_ENTRY_CONFLICT] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_NOCONNECT_CONNECTED] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_NOCONNECT_NOT_CONNECTED] = RPT_SEVERITY_WARNING;
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "rule_severities",
[&]() -> nlohmann::json
@ -114,10 +114,10 @@ ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
wxString name = item.GetSettingsKey();
int code = item.GetErrorCode();
if( name.IsEmpty() || m_Severities.count( code ) == 0 )
if( name.IsEmpty() || m_ERCSeverities.count( code ) == 0 )
continue;
ret[std::string( name.ToUTF8() )] = SeverityToString( m_Severities[code] );
ret[std::string( name.ToUTF8() )] = SeverityToString( m_ERCSeverities[code] );
}
return ret;
@ -135,7 +135,7 @@ ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
std::string key( name.ToUTF8() );
if( aJson.contains( key ) )
m_Severities[code] = SeverityFromString( aJson[key] );
m_ERCSeverities[code] = SeverityFromString( aJson[key] );
}
},
{} ) );
@ -232,33 +232,33 @@ SEVERITY ERC_SETTINGS::GetSeverity( int aErrorCode ) const
// Warning-or-error is controlled by which errorCode it is
if( aErrorCode == ERCE_PIN_TO_PIN_ERROR )
{
wxASSERT( m_Severities.count( ERCE_PIN_TO_PIN_WARNING ) );
wxASSERT( m_ERCSeverities.count( ERCE_PIN_TO_PIN_WARNING ) );
if( m_Severities.at( ERCE_PIN_TO_PIN_WARNING ) == RPT_SEVERITY_IGNORE )
if( m_ERCSeverities.at( ERCE_PIN_TO_PIN_WARNING ) == RPT_SEVERITY_IGNORE )
return RPT_SEVERITY_IGNORE;
else
return RPT_SEVERITY_ERROR;
}
else if( aErrorCode == ERCE_PIN_TO_PIN_WARNING )
{
wxASSERT( m_Severities.count( ERCE_PIN_TO_PIN_WARNING ) );
wxASSERT( m_ERCSeverities.count( ERCE_PIN_TO_PIN_WARNING ) );
if( m_Severities.at( ERCE_PIN_TO_PIN_WARNING ) == RPT_SEVERITY_IGNORE )
if( m_ERCSeverities.at( ERCE_PIN_TO_PIN_WARNING ) == RPT_SEVERITY_IGNORE )
return RPT_SEVERITY_IGNORE;
else
return RPT_SEVERITY_WARNING;
}
wxCHECK_MSG( m_Severities.count( aErrorCode ), RPT_SEVERITY_IGNORE,
wxCHECK_MSG( m_ERCSeverities.count( aErrorCode ), RPT_SEVERITY_IGNORE,
"Missing severity from map in ERC_SETTINGS!" );
return m_Severities.at( aErrorCode );
return m_ERCSeverities.at( aErrorCode );
}
void ERC_SETTINGS::SetSeverity( int aErrorCode, SEVERITY aSeverity )
{
m_Severities[ aErrorCode ] = aSeverity;
m_ERCSeverities[ aErrorCode ] = aSeverity;
}

View File

@ -114,7 +114,7 @@ public:
bool operator==( const ERC_SETTINGS& other ) const
{
return ( other.m_Severities == m_Severities );
return ( other.m_ERCSeverities == m_ERCSeverities );
}
bool operator!=( const ERC_SETTINGS& other ) const
@ -165,7 +165,7 @@ public:
public:
std::map<int, SEVERITY> m_Severities;
std::map<int, SEVERITY> m_ERCSeverities;
std::set<wxString> m_ErcExclusions;
PIN_ERROR m_PinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];

View File

@ -40,6 +40,7 @@ set_property( TEST qa_python
# Shared QA helper libraries
add_subdirectory( qa_utils )
add_subdirectory( pcbnew_utils )
add_subdirectory( schematic_utils )
# Unit tests
add_subdirectory( unittests )

View File

@ -0,0 +1,124 @@
(kicad_sch (version 20220904) (generator eeschema)
(uuid 930e09ef-be9e-430e-bcf9-43a95b2b4bd3)
(paper "A4")
(lib_symbols
(symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "R" (id 0) (at 2.032 0 90) (effects (font (size 1.27 1.27)))
)
(property "Value" "R" (id 1) (at 0 0 90) (effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at -1.778 0 90) (effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "R res resistor" (id 4) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Resistor" (id 5) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "R_*" (id 6) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(symbol "R_0_1"
(rectangle (start -1.016 -2.54) (end 1.016 2.54)
(stroke (width 0.254) (type default))
(fill (type none))
)
)
(symbol "R_1_1"
(pin passive line (at 0 3.81 270) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 0 -3.81 90) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
)
)
)
(wire (pts (xy 100.33 64.77) (xy 121.92 64.77))
(stroke (width 0) (type default))
(uuid 2a99c91e-9d4e-4da5-805f-13a997903880)
)
(wire (pts (xy 121.92 64.77) (xy 121.92 74.93))
(stroke (width 0) (type default))
(uuid 4d25b80e-aa06-42aa-ac68-1573391d082a)
)
(wire (pts (xy 121.92 88.9) (xy 100.33 88.9))
(stroke (width 0) (type default))
(uuid 5db2880d-61d4-4000-bc12-7baca2753b3a)
)
(wire (pts (xy 100.33 88.9) (xy 100.33 64.77))
(stroke (width 0) (type default))
(uuid 86b8bc48-c479-4fde-b6f7-96ba28544af8)
)
(wire (pts (xy 121.92 82.55) (xy 121.92 88.9))
(stroke (width 0) (type default))
(uuid 8b878b60-3239-43c4-9d0e-6d2e5d007191)
)
(symbol (lib_id "Device:R") (at 82.55 46.99 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 99696aa3-1f0c-481c-9ebe-99494e3bee14)
(default_instance (reference "R1") (unit 1) (value "R") (footprint ""))
(property "Reference" "R1" (id 0) (at 85.09 46.355 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "R" (id 1) (at 85.09 48.895 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 80.772 46.99 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 82.55 46.99 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 4de30286-088b-443e-98be-1ffca1d383ce))
(pin "2" (uuid 346e1d1c-f595-4ef8-9738-4dec17ffcce4))
)
(symbol (lib_id "Device:R") (at 121.92 78.74 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid ace4c3cb-296b-45e5-9908-2ee794107b85)
(default_instance (reference "R1") (unit 1) (value "R") (footprint ""))
(property "Reference" "R1" (id 0) (at 124.46 78.105 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "R" (id 1) (at 124.46 80.645 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 120.142 78.74 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 121.92 78.74 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 8a1429e1-1dc8-4c46-99d4-cbd6c8f42c87))
(pin "2" (uuid 79487508-b7f8-407c-b22a-ed3b49071572))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/99696aa3-1f0c-481c-9ebe-99494e3bee14"
(reference "R1") (unit 1) (value "R") (footprint "")
)
(path "/ace4c3cb-296b-45e5-9908-2ee794107b85"
(reference "R2") (unit 1) (value "R") (footprint "")
)
)
)

View File

@ -0,0 +1,113 @@
(kicad_sch (version 20220904) (generator eeschema)
(uuid 0d9df0c3-3213-4fa9-aab7-5d0bde758ba4)
(paper "A4")
(lib_symbols
(symbol "Power_Management:AP2161W" (in_bom yes) (on_board yes)
(property "Reference" "U" (id 0) (at -7.62 -6.35 0) (effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "AP2161W" (id 1) (at -7.62 6.35 0) (effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "Package_TO_SOT_SMD:SOT-23-5" (id 2) (at 0 -10.16 0) (effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "https://www.diodes.com/assets/Datasheets/AP2161.pdf" (id 3) (at 0 1.27 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "Limit USB Active Low" (id 4) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Current limited power switch, single channel, SOT-23-5" (id 5) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "SOT?23*" (id 6) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(symbol "AP2161W_0_1"
(rectangle (start -7.62 5.08) (end 7.62 -5.08)
(stroke (width 0.254) (type default))
(fill (type background))
)
)
(symbol "AP2161W_1_1"
(pin power_out line (at 10.16 2.54 180) (length 2.54)
(name "OUT" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin power_in line (at 0 -7.62 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin open_collector line (at 10.16 -2.54 180) (length 2.54)
(name "~{FLG}" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin input line (at -10.16 -2.54 0) (length 2.54)
(name "~{EN}" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
(pin power_in line (at -10.16 2.54 0) (length 2.54)
(name "IN" (effects (font (size 1.27 1.27))))
(number "5" (effects (font (size 1.27 1.27))))
)
)
)
)
(wire (pts (xy 85.09 81.28) (xy 110.49 81.28))
(stroke (width 0) (type default))
(uuid 27e1c1f5-72d5-42f5-8cbf-b0e66edfa028)
)
(text_box "There should be 8 errors here:\n4x Pin not connected\n3x Input Pin not connected to output\n1x Label not connected"
(at 143.51 71.12 0) (size 39.37 15.24)
(stroke (width 0) (type default))
(fill (type none))
(effects (font (size 1.27 1.27)) (justify left top))
(uuid d5e47f66-a2f7-4a57-97f0-58571df6905d)
)
(label "input_label" (at 85.09 81.28 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 7c5bf4a6-f820-4e5e-b50c-798993d688fe)
)
(symbol (lib_id "Power_Management:AP2161W") (at 120.65 83.82 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid e7a1845d-9baf-4d49-988c-c34cdb7edbfb)
(default_instance (reference "U1") (unit 1) (value "AP2161W") (footprint "Package_TO_SOT_SMD:SOT-23-5"))
(property "Reference" "U1" (id 0) (at 120.65 74.93 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "AP2161W" (id 1) (at 120.65 77.47 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "Package_TO_SOT_SMD:SOT-23-5" (id 2) (at 120.65 93.98 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "https://www.diodes.com/assets/Datasheets/AP2161.pdf" (id 3) (at 120.65 82.55 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 8da52586-4dd8-4be2-a9d0-d1dbf5f066a6))
(pin "2" (uuid 4cf15f9e-c6cf-4e57-b1f2-9278d309f7fa))
(pin "3" (uuid 18d8174e-8ab1-40d9-a248-237a8d20c852))
(pin "4" (uuid 20ae559a-da06-4c00-8ab0-a096170650fa))
(pin "5" (uuid 45161e74-209a-44f0-883a-8772637eaa18))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/e7a1845d-9baf-4d49-988c-c34cdb7edbfb"
(reference "U1") (unit 1) (value "AP2161W") (footprint "Package_TO_SOT_SMD:SOT-23-5")
)
)
)

View File

@ -0,0 +1,156 @@
(kicad_sch (version 20220904) (generator eeschema)
(uuid 53995630-a761-4238-8278-4d7d3725db0d)
(paper "A4")
(lib_symbols
(symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "R1" (id 0) (at 2.54 1.2701 0) (effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "R" (id 1) (at 2.54 -1.2699 0) (effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at -1.778 0 90) (effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "R res resistor" (id 4) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Resistor" (id 5) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "R_*" (id 6) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(symbol "R_0_1"
(rectangle (start -1.016 -2.54) (end 1.016 2.54)
(stroke (width 0.254) (type default))
(fill (type none))
)
)
(symbol "R_1_1"
(pin passive line (at 0 3.81 270) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 0 3.81 270) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 0 -3.81 90) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
)
)
)
(no_connect (at 106.68 58.42) (uuid 18df0416-d7a9-445e-bf63-2b8a73263f6b))
(no_connect (at 106.68 73.66) (uuid 6a353ab4-c7d4-46f7-bc6f-b024e2d17a8b))
(polyline (pts (xy 105.41 58.42) (xy 95.25 58.42))
(stroke (width 0) (type default))
(uuid 05dab084-2470-4ecd-ac3f-069d5c97ad29)
)
(polyline (pts (xy 135.89 64.77) (xy 146.05 64.77))
(stroke (width 0) (type default))
(uuid 47bc1ba9-9264-426d-a149-55c7453cce7a)
)
(text "Stacked pins on top\nshould not trigger\nConnected Pins have No-Connect\nerror here"
(at 93.98 60.96 0)
(effects (font (size 1.27 1.27)) (justify right bottom))
(uuid 0ba37af6-5e7d-46e5-8d65-ec7656094fa8)
)
(text "Stacked pins on top\nshould not prevent ERC from logging\nPin not connected Error here"
(at 147.32 67.31 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid c4ad4b08-08ae-4825-a134-c89025429d6d)
)
(symbol (lib_id "Device:R") (at 106.68 62.23 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 5dcb91f5-7e4e-4dfa-bc34-9f673c6f5a92)
(default_instance (reference "") (unit 1) (value "") (footprint ""))
(property "Reference" "" (id 0) (at 109.22 60.9599 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "" (id 1) (at 109.22 63.4999 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 104.902 62.23 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 106.68 62.23 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid a29da7fc-4f6c-43c5-aeac-07287752e82e))
(pin "1" (uuid a29da7fc-4f6c-43c5-aeac-07287752e82e))
(pin "2" (uuid ec18ce3d-d598-4f5b-b86a-f2684103513c))
)
(symbol (lib_id "Device:R") (at 106.68 69.85 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 819e4b72-d6c8-44c6-a636-7ae596b66d8f)
(default_instance (reference "") (unit 1) (value "") (footprint ""))
(property "Reference" "" (id 0) (at 109.22 68.5799 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "" (id 1) (at 109.22 71.1199 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 104.902 69.85 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 106.68 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 39785502-da04-4e54-bf24-710e67be6a41))
(pin "1" (uuid 39785502-da04-4e54-bf24-710e67be6a41))
(pin "2" (uuid a74a2019-40b7-4e63-9e9a-5dde5c954967))
)
(symbol (lib_id "Device:R") (at 134.62 68.58 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid cf81ab99-7011-45b1-a7f3-747f9023f5c0)
(default_instance (reference "") (unit 1) (value "") (footprint ""))
(property "Reference" "" (id 0) (at 137.16 67.3099 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "" (id 1) (at 137.16 69.8499 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 132.842 68.58 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 134.62 68.58 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 75d487d3-0e29-4474-9e30-a490e82ef98d))
(pin "1" (uuid 75d487d3-0e29-4474-9e30-a490e82ef98d))
(pin "2" (uuid b76f4903-8952-4375-961b-e7f86fb2e661))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/5dcb91f5-7e4e-4dfa-bc34-9f673c6f5a92"
(reference "R1") (unit 1) (value "R") (footprint "")
)
(path "/819e4b72-d6c8-44c6-a636-7ae596b66d8f"
(reference "R2") (unit 1) (value "R") (footprint "")
)
(path "/cf81ab99-7011-45b1-a7f3-747f9023f5c0"
(reference "R3") (unit 1) (value "R") (footprint "")
)
)
)

View File

@ -0,0 +1,194 @@
(kicad_sch (version 20220904) (generator eeschema)
(uuid 776ab682-a66a-485f-8b01-1127e87612ac)
(paper "A4")
(lib_symbols
(symbol "Regulator_Linear:LP3982ILD-3.3" (in_bom yes) (on_board yes)
(property "Reference" "U1" (id 0) (at 0 8.89 0) (effects (font (size 1.27 1.27)))
)
(property "Value" "LP3982ILD-3.3" (id 1) (at 0 6.35 0) (effects (font (size 1.27 1.27)))
)
(property "Footprint" "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias" (id 2) (at 5.08 -8.89 0) (effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://www.ti.com/lit/ds/symlink/lp3982.pdf" (id 3) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "linear regulator" (id 4) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "3.3V, 300mA, Micropower, Ultra-Low-Dropout, Low-Noise CMOS Regulator, WSON-8" (id 5) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "WSON*1EP*3x2.5mm*P0.5mm*" (id 6) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(symbol "LP3982ILD-3.3_0_1"
(rectangle (start -7.62 5.08) (end 7.62 -5.08)
(stroke (width 0.254) (type default))
(fill (type background))
)
)
(symbol "LP3982ILD-3.3_1_1"
(pin power_out line (at 10.16 2.54 180) (length 2.54)
(name "OUT" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin power_in line (at -10.16 2.54 0) (length 2.54)
(name "IN" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin power_in line (at 0 -7.62 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin power_out line (at 10.16 2.54 180) (length 2.54) hide
(name "OUT" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
(pin no_connect line (at -7.62 -2.54 0) (length 2.54) hide
(name "NC" (effects (font (size 1.27 1.27))))
(number "5" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 10.16 -2.54 180) (length 2.54)
(name "CC" (effects (font (size 1.27 1.27))))
(number "6" (effects (font (size 1.27 1.27))))
)
(pin input line (at -10.16 0 0) (length 2.54)
(name "~{SHDN}" (effects (font (size 1.27 1.27))))
(number "7" (effects (font (size 1.27 1.27))))
)
(pin open_collector line (at 10.16 0 180) (length 2.54)
(name "~{FAULT}" (effects (font (size 1.27 1.27))))
(number "8" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 2.54 -7.62 90) (length 2.54)
(name "EP" (effects (font (size 1.27 1.27))))
(number "9" (effects (font (size 1.27 1.27))))
)
)
)
)
(no_connect (at 160.02 67.31) (uuid 24f72086-2988-4214-9b87-7103b6f626bc))
(no_connect (at 160.02 64.77) (uuid 2c5c1847-d00d-456f-ba13-01ef75907ec2))
(no_connect (at 180.34 62.23) (uuid 32115d55-5cb6-4723-9799-4de1d725ba1a))
(no_connect (at 111.76 60.96) (uuid 474f4aab-56d5-4f71-b4d8-623609cfb48e))
(no_connect (at 111.76 63.5) (uuid 474f4aab-56d5-4f71-b4d8-623609cfb48f))
(no_connect (at 121.92 71.12) (uuid 474f4aab-56d5-4f71-b4d8-623609cfb490))
(no_connect (at 124.46 71.12) (uuid 474f4aab-56d5-4f71-b4d8-623609cfb491))
(no_connect (at 132.08 66.04) (uuid 474f4aab-56d5-4f71-b4d8-623609cfb492))
(no_connect (at 132.08 63.5) (uuid 474f4aab-56d5-4f71-b4d8-623609cfb493))
(no_connect (at 200.66 62.23) (uuid 59af0f3d-ee98-408b-81c3-a42c2f7d47b4))
(no_connect (at 180.34 67.31) (uuid 63160083-ee49-4b44-87ba-bac259409a5a))
(no_connect (at 180.34 59.69) (uuid 80d46fad-4271-4f69-bc32-11bee9111783))
(no_connect (at 172.72 74.93) (uuid 8b3371a6-8f07-4f33-b8d3-ca01994289a3))
(no_connect (at 200.66 64.77) (uuid a40a0a93-d652-4bb4-b5a5-cfe2755c2279))
(no_connect (at 190.5 54.61) (uuid a8dba0b2-b5bf-4272-93de-d8ee23c91e05))
(no_connect (at 187.96 54.61) (uuid dafced2a-3fc6-4595-b659-47575507b60a))
(no_connect (at 180.34 69.85) (uuid e9a11f46-520d-4480-bda7-c067e1120cee))
(no_connect (at 170.18 74.93) (uuid fd71d529-e63e-45a7-8a7a-94deca838e87))
(symbol (lib_id "Regulator_Linear:LP3982ILD-3.3") (at 170.18 67.31 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 91b2a5ec-3c62-4238-9d23-edd2113e4ace)
(default_instance (reference "U1") (unit 1) (value "LP3982ILD-3.3") (footprint "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias"))
(property "Reference" "U1" (id 0) (at 170.18 58.42 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "LP3982ILD-3.3" (id 1) (at 170.18 60.96 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias" (id 2) (at 175.26 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://www.ti.com/lit/ds/symlink/lp3982.pdf" (id 3) (at 170.18 67.31 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 499c3ce2-8623-4702-8d3d-ba22dca99abe))
(pin "2" (uuid 5187b21b-03e8-436d-a7fd-986fd78e3880))
(pin "3" (uuid 9689c116-a83a-4b87-9f90-e3ee7189f0a0))
(pin "4" (uuid b4e07af1-94f6-4b5a-b35b-9f31fd85273f))
(pin "5" (uuid bb405e26-6887-4c31-a5b2-cdb03f30c1c1))
(pin "6" (uuid 17dde352-b28b-4101-ad90-3b39eefc7a9e))
(pin "7" (uuid 899d3ed0-4fb2-4ef7-8f5c-58b30835c064))
(pin "8" (uuid bbd64c91-3104-4656-b984-fda2631a4b9a))
(pin "9" (uuid b3325cd7-1f03-43ec-a5b3-d6b31ee56297))
)
(symbol (lib_id "Regulator_Linear:LP3982ILD-3.3") (at 121.92 63.5 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 98cdeafb-9fec-4cb2-b0e0-dd01c8d9a0e6)
(default_instance (reference "U1") (unit 1) (value "LP3982ILD-3.3") (footprint "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias"))
(property "Reference" "U1" (id 0) (at 121.92 54.61 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "LP3982ILD-3.3" (id 1) (at 121.92 57.15 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias" (id 2) (at 127 72.39 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://www.ti.com/lit/ds/symlink/lp3982.pdf" (id 3) (at 121.92 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid c1301314-4db8-4c8f-a374-c89403debfd3))
(pin "2" (uuid 30080184-4a80-4d3c-96e4-953317e95fa5))
(pin "3" (uuid 0395b7fe-b3ce-43cc-966e-95ea9f6b7fc1))
(pin "4" (uuid 76070fa9-9db9-488d-bb5e-f9c620bc3165))
(pin "5" (uuid aea03faa-7a20-49d8-aa45-6e5ae35700ab))
(pin "6" (uuid 5bffa3f7-9d65-44b6-9073-461482505f6d))
(pin "7" (uuid 22450373-c5a9-4c1c-80cf-8e604aa191ea))
(pin "8" (uuid 3c2e03ae-b28c-4e7b-bb4a-dc28a09368f0))
(pin "9" (uuid 0cd62d3f-bead-45e2-bee6-9db4bc38f648))
)
(symbol (lib_id "Regulator_Linear:LP3982ILD-3.3") (at 190.5 62.23 180) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid ec75eb37-1e9e-4445-af6e-4e1214099824)
(default_instance (reference "U1") (unit 1) (value "LP3982ILD-3.3") (footprint "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias"))
(property "Reference" "U1" (id 0) (at 190.5 71.12 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "LP3982ILD-3.3" (id 1) (at 190.5 68.58 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias" (id 2) (at 185.42 53.34 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://www.ti.com/lit/ds/symlink/lp3982.pdf" (id 3) (at 190.5 62.23 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 8979fc38-5fcb-4c8b-b8ff-5d8aea89a5bf))
(pin "2" (uuid 83f64711-8fdb-4261-b16e-2b16f4cbde1d))
(pin "3" (uuid 54bd788d-7dea-43ee-bf62-8f53fdeb784f))
(pin "4" (uuid ee78c815-7dec-410b-b967-31549bf1765b))
(pin "5" (uuid deaa742e-6ee7-45eb-ad82-75eeefe8a5f2))
(pin "6" (uuid a528a840-056b-4efe-a1e6-7fbd5087aacc))
(pin "7" (uuid f99ecf6d-82ea-42db-890c-f3d1a4a5ace7))
(pin "8" (uuid 3a57a4f9-5ce1-4272-9799-a3148eacd412))
(pin "9" (uuid d65d010c-7651-488e-b233-acda7fe66349))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/98cdeafb-9fec-4cb2-b0e0-dd01c8d9a0e6"
(reference "U1") (unit 1) (value "LP3982ILD-3.3") (footprint "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias")
)
(path "/91b2a5ec-3c62-4238-9d23-edd2113e4ace"
(reference "U2") (unit 1) (value "LP3982ILD-3.3") (footprint "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias")
)
(path "/ec75eb37-1e9e-4445-af6e-4e1214099824"
(reference "U3") (unit 1) (value "LP3982ILD-3.3") (footprint "Package_SON:WSON-8-1EP_3x2.5mm_P0.5mm_EP1.2x1.5mm_PullBack_ThermalVias")
)
)
)

View File

@ -0,0 +1,191 @@
(kicad_sch (version 20220904) (generator eeschema)
(uuid 04c96d79-48d5-4885-af8e-d7f9a9a29a18)
(paper "A4")
(lib_symbols
(symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "R" (id 0) (at 2.032 0 90) (effects (font (size 1.27 1.27)))
)
(property "Value" "R" (id 1) (at 0 0 90) (effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at -1.778 0 90) (effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "R res resistor" (id 4) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Resistor" (id 5) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "R_*" (id 6) (at 0 0 0) (effects (font (size 1.27 1.27)) hide)
)
(symbol "R_0_1"
(rectangle (start -1.016 -2.54) (end 1.016 2.54)
(stroke (width 0.254) (type default))
(fill (type none))
)
)
(symbol "R_1_1"
(pin passive line (at 0 3.81 270) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 0 -3.81 90) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
)
)
)
(no_connect (at 90.17 88.9) (uuid 6ec41ff2-1713-41c8-b474-cc3abd059206))
(no_connect (at 144.78 88.9) (uuid 76c08e27-3db5-46ac-9f08-6fb09b48acca))
(no_connect (at 116.84 88.9) (uuid 9b226482-45cb-4b73-a977-f0428d1628a1))
(wire (pts (xy 73.66 80.01) (xy 73.66 88.9))
(stroke (width 0) (type default))
(uuid 00c8ee41-02ce-4618-b70d-30c1634ab5fc)
)
(wire (pts (xy 100.33 88.9) (xy 116.84 88.9))
(stroke (width 0) (type default))
(uuid 0cf69055-7db4-479a-87cb-551226f8a0e1)
)
(wire (pts (xy 73.66 88.9) (xy 90.17 88.9))
(stroke (width 0) (type default))
(uuid 198342f2-efea-403f-9043-804cfa9262a0)
)
(wire (pts (xy 100.33 80.01) (xy 100.33 88.9))
(stroke (width 0) (type default))
(uuid 35caae75-61ed-4745-a5d7-97a6ace7b59e)
)
(wire (pts (xy 128.27 64.77) (xy 128.27 72.39))
(stroke (width 0) (type default))
(uuid 61b14430-4ca4-434d-b30f-654d55c6a3bc)
)
(wire (pts (xy 128.27 80.01) (xy 128.27 88.9))
(stroke (width 0) (type default))
(uuid 6eff6f57-a353-4b8a-81a9-c7210595fb71)
)
(wire (pts (xy 100.33 64.77) (xy 100.33 72.39))
(stroke (width 0) (type default))
(uuid 7da5e747-fa49-4980-b8e9-ba0870b0bd00)
)
(wire (pts (xy 128.27 88.9) (xy 144.78 88.9))
(stroke (width 0) (type default))
(uuid 7e19c5d8-157a-4955-a4b7-14783802a8b1)
)
(wire (pts (xy 73.66 64.77) (xy 73.66 72.39))
(stroke (width 0) (type default))
(uuid b124d93d-79dd-491b-b451-beb59748c0d6)
)
(text "This test should result in 3 ERC errors\ncentered on the labels"
(at 74.93 48.26 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid d05c5d4d-805f-4bc1-85d4-4536a8642b9a)
)
(label "test1" (at 73.66 64.77 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 4318cfac-09aa-479c-886b-29110f48468d)
)
(global_label "test2" (shape input) (at 100.33 64.77 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid 7df1ad95-c091-4bad-9d4b-1fa200f7e372)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (id 0) (at 107.8546 64.77 0)
(effects (font (size 1.27 1.27)) (justify left))
)
)
(hierarchical_label "test3" (shape input) (at 128.27 64.77 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid 0b095bd8-cc42-4ec2-b2b6-647d97f49853)
)
(symbol (lib_id "Device:R") (at 73.66 76.2 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 0a2cc769-fb59-4476-8c45-9d19637150dc)
(default_instance (reference "R1") (unit 1) (value "R") (footprint ""))
(property "Reference" "R1" (id 0) (at 76.2 75.565 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "R" (id 1) (at 76.2 78.105 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 71.882 76.2 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 73.66 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 6a3c8010-df12-4417-b2b4-0d31c61a340a))
(pin "2" (uuid 03c6a327-1a26-48ff-89e0-9f7507022052))
)
(symbol (lib_id "Device:R") (at 128.27 76.2 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 5500cea6-55d2-4685-8e6f-119da9acb56f)
(default_instance (reference "R1") (unit 1) (value "R") (footprint ""))
(property "Reference" "R1" (id 0) (at 130.81 75.565 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "R" (id 1) (at 130.81 78.105 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 126.492 76.2 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 128.27 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 476de613-4f8d-4993-b247-2762e739fc91))
(pin "2" (uuid 2e54cfa4-b4ed-4614-99a8-30189d5d9307))
)
(symbol (lib_id "Device:R") (at 100.33 76.2 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 641fc5f7-d00e-4a53-9aa3-57b6273a605e)
(default_instance (reference "R1") (unit 1) (value "R") (footprint ""))
(property "Reference" "R1" (id 0) (at 102.87 75.565 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "R" (id 1) (at 102.87 78.105 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 98.552 76.2 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 100.33 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid dfbb0613-a535-4327-96c6-d6347ed6e447))
(pin "2" (uuid 734940da-e524-4392-a646-ee035ed7b825))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/641fc5f7-d00e-4a53-9aa3-57b6273a605e"
(reference "R1") (unit 1) (value "R") (footprint "")
)
(path "/0a2cc769-fb59-4476-8c45-9d19637150dc"
(reference "R2") (unit 1) (value "R") (footprint "")
)
(path "/5500cea6-55d2-4685-8e6f-119da9acb56f"
(reference "R3") (unit 1) (value "R") (footprint "")
)
)
)

View File

@ -0,0 +1,86 @@
(kicad_sch (version 20220904) (generator eeschema)
(uuid 42cb452b-0025-41f3-ae52-70902384e6c1)
(paper "A4")
(lib_symbols
)
(no_connect (at 121.92 78.74) (uuid de36d74a-ca9f-4049-b9b3-1ae40137e716))
(wire (pts (xy 121.92 78.74) (xy 138.43 78.74))
(stroke (width 0) (type default))
(uuid 5f3fe4fd-c13a-48e9-91d7-50e9781364e3)
)
(wire (pts (xy 121.92 71.12) (xy 138.43 71.12))
(stroke (width 0) (type default))
(uuid b929aaf4-57da-46c1-8ebd-39696966af45)
)
(wire (pts (xy 124.46 97.79) (xy 135.89 97.79))
(stroke (width 0) (type default))
(uuid ed2d734a-96ab-4f8d-9964-b35fb6f264e1)
)
(text_box "Global labels connect to local labels, so this should be an error connecting RX1 to TX1"
(at 146.05 68.58 0) (size 30.48 10.16)
(stroke (width 0) (type default))
(fill (type none))
(effects (font (size 1.27 1.27)) (justify left top))
(uuid 8b7979c5-91e0-4622-b5f7-46261e54852f)
)
(text_box "Because GL2 is subsumed, it should raise an error about not being connected elsewhere"
(at 86.36 95.25 0) (size 30.48 8.89)
(stroke (width 0) (type default))
(fill (type none))
(effects (font (size 1.27 1.27)) (justify left top))
(uuid a86330ff-260b-47dd-aa97-d0048adacf6a)
)
(text_box "Two global labels on the same net should be an error"
(at 144.78 95.25 0) (size 30.48 6.35)
(stroke (width 0) (type default))
(fill (type none))
(effects (font (size 1.27 1.27)) (justify left top))
(uuid e0ed898f-b66d-4e39-bcf1-41f327b1f742)
)
(label "RX1" (at 121.92 71.12 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid a704bc1b-cffd-42f1-b255-604a994f491f)
)
(global_label "GL2" (shape input) (at 124.46 97.79 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 33c2e437-c11c-4ea2-9005-694c58022174)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (id 0) (at 118.2054 97.79 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
(global_label "GL1" (shape input) (at 135.89 97.79 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid 36c8b1e4-3cc0-4715-ac55-64a74412c33f)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (id 0) (at 142.1446 97.79 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
)
(global_label "RX1" (shape input) (at 138.43 78.74 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid 4d379e56-88a8-4875-8bdc-4cc50cce81b3)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (id 0) (at 144.866 78.74 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
)
(global_label "TX1" (shape input) (at 138.43 71.12 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid 595f58ee-7a9d-483b-900c-241205affa97)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (id 0) (at 144.5636 71.12 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
)
(sheet_instances
(path "/" (page "1"))
)
)

View File

@ -43,13 +43,17 @@ MOCK_BASE_CLASS( MOCK_PGM_BASE, PGM_BASE )
MOCK_METHOD( ForceSystemPdfBrowser, 1, void( bool ) );
MOCK_METHOD( SetLanguage, 2, bool( wxString&, bool ) );
MOCK_METHOD( SetLanguageIdentifier, 1, void( int ) );
MOCK_CONST_METHOD( GetSelectedLanguageIdentifier, 0, int() );
MOCK_METHOD( ReadPdfBrowserInfos, 0, void() );
MOCK_METHOD( WritePdfBrowserInfos, 0, void() );
MOCK_METHOD( SetLocalEnvVariable, 2, bool( const wxString&, const wxString& ) );
MOCK_METHOD( SetLocalEnvVariables, 0, void() );
MOCK_CONST_METHOD( GetLocalEnvVariables, 0, ENV_VAR_MAP&() );
int GetSelectedLanguageIdentifier()
{
return 0;
}
// following functions will not be mocked in order to mimic old qa behavior
// MOCK_METHOD( App, 0, wxApp&() );
// MOCK_METHOD( GetLocale, 0, wxLocale*() );

View File

@ -0,0 +1,58 @@
# This program source code file is part of KiCad, a free EDA CAD application.
#
# Copyright (C) 2022 KiCad Developers, see CHANGELOG.TXT for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/
# Eeschema-related auxiliary functions that are useful for QA purposes
set( QA_SCHEMATIC_UTILS_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/schematic_file_util.cpp
)
add_library( qa_schematic_utils STATIC ${QA_SCHEMATIC_UTILS_SRCS} )
target_include_directories( qa_schematic_utils PUBLIC BEFORE ${INC_BEFORE} )
target_include_directories( qa_schematic_utils PUBLIC
include
# target_include_directories and made PUBLIC)
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/eeschema
${CMAKE_SOURCE_DIR}/common
${INC_AFTER}
)
target_link_libraries( qa_schematic_utils PUBLIC
qa_utils
)
# # we need to pretend to be something to appease the units code
target_compile_definitions( qa_schematic_utils
PUBLIC EESCHEMA
)
# Pass in the default data location
set_source_files_properties( schematic_file_util.cpp PROPERTIES
COMPILE_DEFINITIONS "QA_EESCHEMA_DATA_LOCATION=(\"${CMAKE_SOURCE_DIR}/qa/data/eeschema\")"
)
target_include_directories( qa_schematic_utils PRIVATE
$<TARGET_PROPERTY:eeschema_kiface_objects,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@ -0,0 +1,169 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one at
* http://www.gnu.org/licenses/
*/
#include <schematic_file_util.h>
#include <settings/settings_manager.h>
#include <connection_graph.h>
#include <lib_textbox.h>
#include <schematic.h>
#include <sch_screen.h>
#include <sch_io_mgr.h>
// For SCH parsing
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <sch_plugins/kicad/sch_sexpr_parser.h>
#include <richio.h>
#include <qa_utils/stdstream_line_reader.h>
namespace KI_TEST
{
#ifndef QA_EESCHEMA_DATA_LOCATION
#define QA_EESCHEMA_DATA_LOCATION "???"
#endif
std::string GetEeschemaTestDataDir()
{
const char* env = std::getenv( "KICAD_TEST_EESCHEMA_DATA_DIR" );
std::string fn;
if( !env )
{
// Use the compiled-in location of the data dir (i.e. where the files were at build time)
fn = QA_EESCHEMA_DATA_LOCATION;
}
else
{
// Use whatever was given in the env var
fn = env;
}
// Ensure the string ends in / to force a directory interpretation
fn += "/";
return fn;
}
void DumpSchematicToFile( SCHEMATIC& aSchematic, SCH_SHEET& aSheet, const std::string& aFilename )
{
SCH_SEXPR_PLUGIN io;
io.Save( aFilename, &aSheet, &aSchematic );
}
std::unique_ptr<SCHEMATIC> ReadSchematicFromStream( std::istream& aStream, PROJECT* aProject )
{
STDISTREAM_LINE_READER reader;
reader.SetStream( aStream );
SCH_SEXPR_PARSER parser( &reader );
std::unique_ptr<SCHEMATIC> schematic( new SCHEMATIC( nullptr ) );
try
{
schematic->SetProject( aProject );
SCH_SHEET* newSheet = new SCH_SHEET( schematic.get() );
schematic->SetRoot( newSheet );
SCH_SCREEN* rootScreen = new SCH_SCREEN( schematic.get() );
schematic->Root().SetScreen( rootScreen );
parser.ParseSchematic( newSheet );
}
catch( const IO_ERROR& )
{
}
return schematic;
}
std::unique_ptr<SCHEMATIC> ReadSchematicFromFile( const std::string& aFilename, PROJECT* aProject )
{
std::ifstream file_stream;
file_stream.open( aFilename );
wxASSERT( file_stream.is_open() );
return ReadSchematicFromStream( file_stream, aProject );
}
void LoadSchematic( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
std::unique_ptr<SCHEMATIC>& aSchematic )
{
if( aSchematic )
{
PROJECT* prj = &aSchematic->Prj();
aSchematic->SetProject( nullptr );
aSettingsManager.UnloadProject( prj, false );
aSchematic->Reset();
}
std::string absPath = GetEeschemaTestDataDir() + aRelPath.ToStdString();
wxFileName projectFile( absPath + ".kicad_pro" );
wxFileName legacyProject( absPath + ".pro" );
std::string schematicPath = absPath + ".kicad_sch";
if( projectFile.Exists() )
aSettingsManager.LoadProject( projectFile.GetFullPath() );
else if( legacyProject.Exists() )
aSettingsManager.LoadProject( legacyProject.GetFullPath() );
else
aSettingsManager.LoadProject( "" );
aSettingsManager.Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
aSchematic = ReadSchematicFromFile( schematicPath, &aSettingsManager.Prj() );
aSchematic->CurrentSheet().push_back( &aSchematic->Root() );
SCH_SCREENS screens( aSchematic->Root() );
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
screen->UpdateLocalLibSymbolLinks();
SCH_SHEET_LIST sheets = aSchematic->GetSheets();
// Restore all of the loaded symbol instances from the root sheet screen.
sheets.UpdateSymbolInstances( aSchematic->RootScreen()->GetSymbolInstances() );
sheets.UpdateSheetInstances( aSchematic->RootScreen()->GetSheetInstances() );
sheets.AnnotatePowerSymbols();
// NOTE: This is required for multi-unit symbols to be correct
// Normally called from SCH_EDIT_FRAME::FixupJunctions() but could be refactored
for( SCH_SHEET_PATH& sheet : sheets )
sheet.UpdateAllScreenReferences();
// NOTE: SchematicCleanUp is not called; QA schematics must already be clean or else
// SchematicCleanUp must be freed from its UI dependencies.
aSchematic->ConnectionGraph()->Recalculate( sheets, true );
}
} // namespace KI_TEST

View File

@ -0,0 +1,46 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one at
* http://www.gnu.org/licenses/
*/
#ifndef QA_QA_UTILS_SCHEMATIC_SCHEMATIC_FILE_UTIL_H_
#define QA_QA_UTILS_SCHEMATIC_SCHEMATIC_FILE_UTIL_H_
#include <string>
#include <memory>
class PROJECT;
class SCH_SHEET;
class SCHEMATIC;
class SETTINGS_MANAGER;
class wxString;
namespace KI_TEST
{
std::string GetEeschemaTestDataDir();
void DumpSchematicToFile( SCHEMATIC& aSchematic, SCH_SHEET& aSheet, const std::string& aFilename );
std::unique_ptr<SCHEMATIC> ReadSchematicFromStream( std::istream& aStream, PROJECT* aProject );
std::unique_ptr<SCHEMATIC> ReadSchematicFromFile( const std::string& aFilename, PROJECT* aProject );
void LoadSchematic( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
std::unique_ptr<SCHEMATIC>& aSchematic );
}
#endif /* QA_QA_UTILS_SCHEMATIC_SCHEMATIC_FILE_UTIL_H_ */

View File

@ -44,6 +44,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/pcbnew
${CMAKE_SOURCE_DIR}/qa/mocks/include
${CMAKE_SOURCE_DIR}/qa/qa_utils
${CMAKE_SOURCE_DIR}/qa
${INC_AFTER}
)
@ -67,6 +68,10 @@ set( QA_EESCHEMA_SRCS
sch_plugins/altium/test_altium_parser_sch.cpp
erc/test_erc_label_not_connected.cpp
erc/test_erc_stacking_pins.cpp
erc/test_erc_global_labels.cpp
test_eagle_plugin.cpp
test_lib_part.cpp
test_netlist_exporter_kicad.cpp
@ -118,6 +123,7 @@ PRIVATE
scripting
kimath
qa_utils
qa_schematic_utils
markdown_lib
${GDI_PLUS_LIBRARIES}
${Boost_LIBRARIES}

View File

@ -0,0 +1,78 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one at
* http://www.gnu.org/licenses/
*/
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <schematic_utils/schematic_file_util.h>
#include <connection_graph.h>
#include <schematic.h>
#include <erc_settings.h>
#include <erc.h>
#include <settings/settings_manager.h>
struct ERC_REGRESSION_TEST_FIXTURE
{
ERC_REGRESSION_TEST_FIXTURE() :
m_settingsManager( true /* headless */ )
{ }
SETTINGS_MANAGER m_settingsManager;
std::unique_ptr<SCHEMATIC> m_schematic;
};
BOOST_FIXTURE_TEST_CASE( ERCGlobalLabels, ERC_REGRESSION_TEST_FIXTURE )
{
// Check for Errors when using global labels
std::vector<std::pair<wxString, int>> tests =
{
{ "issue9367", 3 }
};
for( const std::pair<wxString, int>& test : tests )
{
KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic );
ERC_SETTINGS& settings = m_schematic->ErcSettings();
SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() );
// Skip the "Modified symbol" warning
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_IGNORE;
m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
m_schematic->ConnectionGraph()->RunERC();
ERC_TESTER tester( m_schematic.get() );
tester.TestConflictingBusAliases();
tester.TestMultUnitPinConflicts();
tester.TestMultiunitFootprints();
tester.TestNoConnectPins();
tester.TestPinToPin();
tester.TestSimilarLabels();
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
}
}

View File

@ -0,0 +1,80 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one at
* http://www.gnu.org/licenses/
*/
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <schematic_utils/schematic_file_util.h>
#include <connection_graph.h>
#include <schematic.h>
#include <erc_settings.h>
#include <erc.h>
#include <settings/settings_manager.h>
struct ERC_REGRESSION_TEST_FIXTURE
{
ERC_REGRESSION_TEST_FIXTURE() :
m_settingsManager( true /* headless */ )
{ }
SETTINGS_MANAGER m_settingsManager;
std::unique_ptr<SCHEMATIC> m_schematic;
};
BOOST_FIXTURE_TEST_CASE( ERCLabelNotConnected, ERC_REGRESSION_TEST_FIXTURE )
{
// Check not-connected ERC errors
std::vector<std::pair<wxString, int>> tests =
{
{ "erc_pin_not_connected_basic", 2 },
{ "issue7203", 3 },
{ "issue11926", 2 },
{ "issue10430", 8 }
};
for( const std::pair<wxString, int>& test : tests )
{
KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic );
ERC_SETTINGS& settings = m_schematic->ErcSettings();
SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() );
// Skip the "Modified symbol" warning
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_IGNORE;
m_schematic->ConnectionGraph()->RunERC();
ERC_TESTER tester( m_schematic.get() );
tester.TestConflictingBusAliases();
tester.TestMultUnitPinConflicts();
tester.TestMultiunitFootprints();
tester.TestNoConnectPins();
tester.TestPinToPin();
tester.TestSimilarLabels();
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
}
}

View File

@ -0,0 +1,77 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one at
* http://www.gnu.org/licenses/
*/
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <schematic_utils/schematic_file_util.h>
#include <connection_graph.h>
#include <schematic.h>
#include <erc_settings.h>
#include <erc.h>
#include <settings/settings_manager.h>
struct ERC_REGRESSION_TEST_FIXTURE
{
ERC_REGRESSION_TEST_FIXTURE() :
m_settingsManager( true /* headless */ )
{ }
SETTINGS_MANAGER m_settingsManager;
std::unique_ptr<SCHEMATIC> m_schematic;
};
BOOST_FIXTURE_TEST_CASE( ERCStackingPins, ERC_REGRESSION_TEST_FIXTURE )
{
// Check for Errors when stacking pins
std::vector<std::pair<wxString, int>> tests =
{
{ "issue6588", 5 }
};
for( const std::pair<wxString, int>& test : tests )
{
KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic );
ERC_SETTINGS& settings = m_schematic->ErcSettings();
SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() );
// Skip the "Modified symbol" warning
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_IGNORE;
m_schematic->ConnectionGraph()->RunERC();
ERC_TESTER tester( m_schematic.get() );
tester.TestConflictingBusAliases();
tester.TestMultUnitPinConflicts();
tester.TestMultiunitFootprints();
tester.TestNoConnectPins();
tester.TestPinToPin();
tester.TestSimilarLabels();
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
}
}