Browse Source
Eeschema: ERC checks handle connections between a common sub-circuit
Eeschema: ERC checks handle connections between a common sub-circuit
Fixes #10926 Contains the following changes: - Adds a new ERC_SCH_PIN_CONTEXT class which is used to provide deterministic comparison between items causing ERC violations (e.g. pins) when associated with a SCH_SHEET_PATH context. - Adds association of SCH_SHEET_PATHs for ERC_ITEMs and the sub-schematic items which caused an ERC violation. This allows correct display of markers on the sheets of interest only, and allows correct naming resolution and cross-probing from the ERC dialog. - Adds a new ERC_TREE_MODEL class, derived from RC_TREE_MODEL, which correctly resolves component references across heirarchical sheets using the associated SCH_SHEET_PATHs. This allows sheet-specific component references to be displayed correctly in the ERC results tree. - Updates SCH_MARKER to only draw sheet-specific markers on the sheet causing an ERC violation. - Increments the schematic file version. - When loading a schematic with legacy ERC exclusions, discards those of type ERCE_PIN_TO_PIN_WARNING, ERCE_PIN_TO_PIN_ERROR, ERCE_HIERACHICAL_LABEL, and ERCE_DIFFERENT_UNIT_NET as there is no safe way to automatically infer the information which is now stored with these exclusions (sheet paths for error location and related items). Requiring users to (once) re-add exclusions is preferable to silently incorrectly matching new ERC issues to legacy exclusions.7.0
committed by
Jeff Young
19 changed files with 993 additions and 63 deletions
-
1eeschema/CMakeLists.txt
-
9eeschema/connection_graph.cpp
-
26eeschema/dialogs/dialog_erc.cpp
-
76eeschema/erc.cpp
-
113eeschema/erc_item.cpp
-
121eeschema/erc_item.h
-
73eeschema/erc_sch_pin_context.cpp
-
82eeschema/erc_sch_pin_context.h
-
15eeschema/erc_settings.cpp
-
3eeschema/sch_file_versions.h
-
93eeschema/sch_marker.cpp
-
16eeschema/sch_marker.h
-
35eeschema/schematic.cpp
-
2include/rc_item.h
-
72qa/data/eeschema/issue10926_1.kicad_sch
-
149qa/data/eeschema/issue10926_1_subsheet_1.kicad_sch
-
94qa/data/eeschema/issue10926_1_subsheet_1_1.kicad_sch
-
1qa/unittests/eeschema/CMakeLists.txt
-
75qa/unittests/eeschema/erc/test_erc_hierarchical_schematics.cpp
@ -0,0 +1,73 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr |
|||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> |
|||
* Copyright (C) 1992-2023 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 2 |
|||
* 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/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/**
|
|||
* @file erc_sch_pin_context.cpp |
|||
*/ |
|||
|
|||
#include <erc_sch_pin_context.h>
|
|||
|
|||
/**
|
|||
* Gets the SCH_PIN for this context |
|||
*/ |
|||
SCH_PIN* ERC_SCH_PIN_CONTEXT::Pin() |
|||
{ |
|||
return m_pin; |
|||
} |
|||
|
|||
/**
|
|||
* Gets the SCH_SHEET_PATH context for the paired SCH_PIN |
|||
*/ |
|||
SCH_SHEET_PATH& ERC_SCH_PIN_CONTEXT::Sheet() |
|||
{ |
|||
return m_sheet; |
|||
} |
|||
|
|||
/**
|
|||
* Tests two pin contexts for equality based on the deterministic hash |
|||
*/ |
|||
bool ERC_SCH_PIN_CONTEXT::operator==( const ERC_SCH_PIN_CONTEXT& other ) const |
|||
{ |
|||
return m_hash == other.m_hash; |
|||
} |
|||
|
|||
/**
|
|||
* Provides a deterministic ordering for item contexts based on hash value |
|||
*/ |
|||
bool ERC_SCH_PIN_CONTEXT::operator<( const ERC_SCH_PIN_CONTEXT& other ) const |
|||
{ |
|||
return m_hash < other.m_hash; |
|||
} |
|||
|
|||
/**
|
|||
* Calculates the deterministic hash for this pin / sheet context |
|||
*/ |
|||
void ERC_SCH_PIN_CONTEXT::rehash() |
|||
{ |
|||
m_hash = 0; |
|||
|
|||
boost::hash_combine( m_hash, m_pin ); |
|||
boost::hash_combine( m_hash, m_sheet.GetCurrentHash() ); |
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr |
|||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> |
|||
* Copyright (C) 2009-2023 KiCad Developers, see change_log.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 2 |
|||
* 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/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/** |
|||
* @file erc_sch_pin_context.h |
|||
*/ |
|||
|
|||
#ifndef _ERC_ITEM_CONTEXT_H |
|||
#define _ERC_ITEM_CONTEXT_H |
|||
|
|||
#include <sch_pin.h> |
|||
#include <boost/functional/hash.hpp> |
|||
|
|||
/** |
|||
* A class used to associate a SCH_PIN with its owning SCH_SHEET_PATH, in order to handle ERC checks |
|||
* across connected common hierarchical schematics |
|||
*/ |
|||
class ERC_SCH_PIN_CONTEXT |
|||
{ |
|||
protected: |
|||
SCH_PIN* m_pin; |
|||
SCH_SHEET_PATH m_sheet; |
|||
size_t m_hash; |
|||
|
|||
public: |
|||
ERC_SCH_PIN_CONTEXT() : m_pin( nullptr ), m_sheet(), m_hash( 0 ) {} |
|||
|
|||
ERC_SCH_PIN_CONTEXT( SCH_PIN* pin, SCH_SHEET_PATH sheet ) : m_pin( pin ), m_sheet( sheet ) |
|||
{ |
|||
rehash(); |
|||
} |
|||
|
|||
ERC_SCH_PIN_CONTEXT( const ERC_SCH_PIN_CONTEXT& other ) = default; |
|||
|
|||
ERC_SCH_PIN_CONTEXT& operator=( const ERC_SCH_PIN_CONTEXT& other ) = default; |
|||
|
|||
~ERC_SCH_PIN_CONTEXT() = default; |
|||
|
|||
/** |
|||
* Gets the SCH_PIN for this context |
|||
*/ |
|||
SCH_PIN* Pin(); |
|||
|
|||
/** |
|||
* Gets the SCH_SHEET_PATH context for the paired SCH_PIN |
|||
*/ |
|||
SCH_SHEET_PATH& Sheet(); |
|||
|
|||
bool operator==( const ERC_SCH_PIN_CONTEXT& other ) const; |
|||
|
|||
bool operator<( const ERC_SCH_PIN_CONTEXT& other ) const; |
|||
|
|||
protected: |
|||
/** |
|||
* Calculates the deterministic hash for this context |
|||
*/ |
|||
void rehash(); |
|||
}; |
|||
|
|||
#endif //_ERC_ITEM_CONTEXT_H |
|||
@ -0,0 +1,72 @@ |
|||
(kicad_sch (version 20221206) (generator eeschema) |
|||
|
|||
(uuid 30037e9f-fb8a-4b65-9af4-98689a2fae61) |
|||
|
|||
(paper "A4") |
|||
|
|||
(lib_symbols |
|||
) |
|||
|
|||
|
|||
(no_connect (at 218.44 62.23) (uuid 083eb137-b86e-4300-a846-2bb596205673)) |
|||
(no_connect (at 140.97 62.23) (uuid 4be53f71-3455-49bb-bde8-59378e524b0f)) |
|||
|
|||
(wire (pts (xy 165.1 62.23) (xy 194.31 62.23)) |
|||
(stroke (width 0) (type default)) |
|||
(uuid ad8a2a0f-07e5-4bda-adf7-ee4963f2c46d) |
|||
) |
|||
|
|||
(sheet (at 140.97 59.69) (size 24.13 5.08) (fields_autoplaced) |
|||
(stroke (width 0.1524) (type solid)) |
|||
(fill (color 0 0 0 0.0000)) |
|||
(uuid 48e5c29d-dae7-410f-a801-6c402cc42990) |
|||
(property "Sheetname" "SubSheet1" (at 140.97 58.9784 0) |
|||
(effects (font (size 1.27 1.27)) (justify left bottom)) |
|||
) |
|||
(property "Sheetfile" "issue10926_1_subsheet_1.kicad_sch" (at 140.97 65.3546 0) |
|||
(effects (font (size 1.27 1.27)) (justify left top)) |
|||
) |
|||
(pin "OUT" output (at 165.1 62.23 0) |
|||
(effects (font (size 1.27 1.27)) (justify right)) |
|||
(uuid 1f5f62db-c203-4919-ba5b-ade4e9ea2a6b) |
|||
) |
|||
(pin "IN" input (at 140.97 62.23 180) |
|||
(effects (font (size 1.27 1.27)) (justify left)) |
|||
(uuid 56de26b5-1deb-4848-83c8-22baf301b552) |
|||
) |
|||
(instances |
|||
(project "issue10926_1" |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61" (page "3")) |
|||
) |
|||
) |
|||
) |
|||
|
|||
(sheet (at 194.31 59.69) (size 24.13 5.08) (fields_autoplaced) |
|||
(stroke (width 0.1524) (type solid)) |
|||
(fill (color 0 0 0 0.0000)) |
|||
(uuid 745d7512-5b57-4355-bb9c-332f95478133) |
|||
(property "Sheetname" "SubSheet2" (at 194.31 58.9784 0) |
|||
(effects (font (size 1.27 1.27)) (justify left bottom)) |
|||
) |
|||
(property "Sheetfile" "issue10926_1_subsheet_1.kicad_sch" (at 194.31 65.3546 0) |
|||
(effects (font (size 1.27 1.27)) (justify left top)) |
|||
) |
|||
(pin "OUT" output (at 194.31 62.23 180) |
|||
(effects (font (size 1.27 1.27)) (justify left)) |
|||
(uuid faa919ea-e1e6-48fa-a852-eca05c09b10a) |
|||
) |
|||
(pin "IN" input (at 218.44 62.23 0) |
|||
(effects (font (size 1.27 1.27)) (justify right)) |
|||
(uuid c3b43390-ad2c-4f18-8b8b-2ecd0ba9205a) |
|||
) |
|||
(instances |
|||
(project "issue10926_1" |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61" (page "4")) |
|||
) |
|||
) |
|||
) |
|||
|
|||
(sheet_instances |
|||
(path "/" (page "1")) |
|||
) |
|||
) |
|||
@ -0,0 +1,149 @@ |
|||
(kicad_sch (version 20221206) (generator eeschema) |
|||
|
|||
(uuid be526097-dcfd-4f9b-a181-67db2fe0ba1c) |
|||
|
|||
(paper "A4") |
|||
|
|||
(lib_symbols |
|||
(symbol "Test-Library:TEST" (in_bom yes) (on_board yes) |
|||
(property "Reference" "U" (at 0 1.27 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Value" "" (at 0 0 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Footprint" "" (at 0 0 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(property "Datasheet" "" (at 0 0 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(symbol "TEST_0_1" |
|||
(rectangle (start -3.81 0) (end 5.08 -5.08) |
|||
(stroke (width 0) (type default)) |
|||
(fill (type background)) |
|||
) |
|||
) |
|||
(symbol "TEST_1_1" |
|||
(pin input line (at -6.35 -2.54 0) (length 2.54) |
|||
(name "IN" (effects (font (size 1.27 1.27)))) |
|||
(number "1" (effects (font (size 1.27 1.27)))) |
|||
) |
|||
(pin output line (at 7.62 -2.54 180) (length 2.54) |
|||
(name "OUT" (effects (font (size 1.27 1.27)))) |
|||
(number "2" (effects (font (size 1.27 1.27)))) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
|
|||
|
|||
|
|||
(no_connect (at 67.31 38.1) (uuid 1f9f1969-c5f8-40e8-8246-b977b20daba4)) |
|||
(no_connect (at 167.64 38.1) (uuid 989a1368-c3cd-49db-a907-c5445ec2477d)) |
|||
|
|||
(wire (pts (xy 143.51 69.85) (xy 146.05 69.85)) |
|||
(stroke (width 0) (type default)) |
|||
(uuid 01a5e094-9958-4828-a629-41d9f5c6527d) |
|||
) |
|||
(wire (pts (xy 113.03 38.1) (xy 121.92 38.1)) |
|||
(stroke (width 0) (type default)) |
|||
(uuid 133145c3-6dac-4b3a-920d-9ebc2100325f) |
|||
) |
|||
(wire (pts (xy 127 69.85) (xy 129.54 69.85)) |
|||
(stroke (width 0) (type default)) |
|||
(uuid 15845972-e785-4b64-b81a-c5b6b9aa406c) |
|||
) |
|||
|
|||
(hierarchical_label "OUT" (shape output) (at 146.05 69.85 0) (fields_autoplaced) |
|||
(effects (font (size 1.27 1.27)) (justify left)) |
|||
(uuid c12ca71e-05e9-4686-b95e-26d43be31c39) |
|||
) |
|||
(hierarchical_label "IN" (shape input) (at 127 69.85 180) (fields_autoplaced) |
|||
(effects (font (size 1.27 1.27)) (justify right)) |
|||
(uuid f0727efc-5d42-4816-b517-a7fda806c9a6) |
|||
) |
|||
|
|||
(symbol (lib_id "Test-Library:TEST") (at 135.89 67.31 0) (unit 1) |
|||
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) |
|||
(uuid 6f4fe901-859a-4888-8767-d39c882b4837) |
|||
(property "Reference" "U?" (at 136.525 66.04 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Value" "~" (at 135.89 67.31 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Footprint" "" (at 135.89 67.31 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(property "Datasheet" "" (at 135.89 67.31 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(pin "1" (uuid 481c2304-5900-4cb7-8847-6d645570be60)) |
|||
(pin "2" (uuid 59429fd6-6091-44c9-9523-a8adc4ba1bbe)) |
|||
(instances |
|||
(project "issue10926_1" |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61" |
|||
(reference "U?") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/745d7512-5b57-4355-bb9c-332f95478133" |
|||
(reference "U3") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/48e5c29d-dae7-410f-a801-6c402cc42990" |
|||
(reference "U2") (unit 1) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
|
|||
(sheet (at 121.92 30.48) (size 45.72 17.78) (fields_autoplaced) |
|||
(stroke (width 0.1524) (type solid)) |
|||
(fill (color 0 0 0 0.0000)) |
|||
(uuid 0203a5e0-a22b-467e-bbd1-13728dd7050e) |
|||
(property "Sheetname" "Subsheet_1_1" (at 121.92 29.7684 0) |
|||
(effects (font (size 1.27 1.27)) (justify left bottom)) |
|||
) |
|||
(property "Sheetfile" "issue10926_1_subsheet_1_1.kicad_sch" (at 121.92 48.8446 0) |
|||
(effects (font (size 1.27 1.27)) (justify left top)) |
|||
) |
|||
(pin "OUT_A" output (at 121.92 38.1 180) |
|||
(effects (font (size 1.27 1.27)) (justify left)) |
|||
(uuid a136add9-7292-4943-9c47-7d95d0dd20f0) |
|||
) |
|||
(pin "IN_A" input (at 167.64 38.1 0) |
|||
(effects (font (size 1.27 1.27)) (justify right)) |
|||
(uuid 9e034dc1-322e-4e11-ab3e-a70310826b7f) |
|||
) |
|||
(instances |
|||
(project "issue10926_1" |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/48e5c29d-dae7-410f-a801-6c402cc42990" (page "4")) |
|||
) |
|||
) |
|||
) |
|||
|
|||
(sheet (at 67.31 30.48) (size 45.72 17.78) (fields_autoplaced) |
|||
(stroke (width 0.1524) (type solid)) |
|||
(fill (color 0 0 0 0.0000)) |
|||
(uuid efd6cf1d-46e4-43a3-833d-ac2e75973904) |
|||
(property "Sheetname" "Subsheet_1_2" (at 67.31 29.7684 0) |
|||
(effects (font (size 1.27 1.27)) (justify left bottom)) |
|||
) |
|||
(property "Sheetfile" "issue10926_1_subsheet_1_1.kicad_sch" (at 67.31 48.8446 0) |
|||
(effects (font (size 1.27 1.27)) (justify left top)) |
|||
) |
|||
(pin "OUT_A" output (at 113.03 38.1 0) |
|||
(effects (font (size 1.27 1.27)) (justify right)) |
|||
(uuid 54a0a920-a43e-4508-aa6d-ecfc08fd7b62) |
|||
) |
|||
(pin "IN_A" input (at 67.31 38.1 180) |
|||
(effects (font (size 1.27 1.27)) (justify left)) |
|||
(uuid 1fb4f480-e9eb-4522-9b4f-b793583c5265) |
|||
) |
|||
(instances |
|||
(project "issue10926_1" |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/48e5c29d-dae7-410f-a801-6c402cc42990" (page "2")) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/745d7512-5b57-4355-bb9c-332f95478133" (page "5")) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
@ -0,0 +1,94 @@ |
|||
(kicad_sch (version 20221206) (generator eeschema) |
|||
|
|||
(uuid 45062e6c-d9e3-47ef-9773-cf9ed241f3ea) |
|||
|
|||
(paper "A4") |
|||
|
|||
(lib_symbols |
|||
(symbol "Test-Library:TEST" (in_bom yes) (on_board yes) |
|||
(property "Reference" "U" (at 0 1.27 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Value" "" (at 0 0 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Footprint" "" (at 0 0 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(property "Datasheet" "" (at 0 0 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(symbol "TEST_0_1" |
|||
(rectangle (start -3.81 0) (end 5.08 -5.08) |
|||
(stroke (width 0) (type default)) |
|||
(fill (type background)) |
|||
) |
|||
) |
|||
(symbol "TEST_1_1" |
|||
(pin input line (at -6.35 -2.54 0) (length 2.54) |
|||
(name "IN" (effects (font (size 1.27 1.27)))) |
|||
(number "1" (effects (font (size 1.27 1.27)))) |
|||
) |
|||
(pin output line (at 7.62 -2.54 180) (length 2.54) |
|||
(name "OUT" (effects (font (size 1.27 1.27)))) |
|||
(number "2" (effects (font (size 1.27 1.27)))) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
|
|||
|
|||
|
|||
(hierarchical_label "OUT_A" (shape output) (at 105.41 46.99 0) (fields_autoplaced) |
|||
(effects (font (size 1.27 1.27)) (justify left)) |
|||
(uuid 13b0c889-1ff2-41ce-b523-62a03c25b660) |
|||
) |
|||
(hierarchical_label "IN_A" (shape input) (at 91.44 46.99 180) (fields_autoplaced) |
|||
(effects (font (size 1.27 1.27)) (justify right)) |
|||
(uuid 829b3ae8-cd09-4eec-8fb1-2248807b71c5) |
|||
) |
|||
|
|||
(symbol (lib_id "Test-Library:TEST") (at 97.79 44.45 0) (unit 1) |
|||
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) |
|||
(uuid ad556e4a-3e61-4db6-b04a-45e4e2ee1dfb) |
|||
(property "Reference" "U?" (at 98.425 43.18 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Value" "~" (at 97.79 44.45 0) |
|||
(effects (font (size 1.27 1.27))) |
|||
) |
|||
(property "Footprint" "" (at 97.79 44.45 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(property "Datasheet" "" (at 97.79 44.45 0) |
|||
(effects (font (size 1.27 1.27)) hide) |
|||
) |
|||
(pin "1" (uuid add2ba25-6d53-4e93-8c77-301f68c1eb6d)) |
|||
(pin "2" (uuid e707f010-d34a-44d3-8c9b-00dd66344fb6)) |
|||
(instances |
|||
(project "issue10926_1" |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61" |
|||
(reference "U?") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/745d7512-5b57-4355-bb9c-332f95478133" |
|||
(reference "U3") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/48e5c29d-dae7-410f-a801-6c402cc42990" |
|||
(reference "U2") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/48e5c29d-dae7-410f-a801-6c402cc42990/0203a5e0-a22b-467e-bbd1-13728dd7050e" |
|||
(reference "U1") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/745d7512-5b57-4355-bb9c-332f95478133/0203a5e0-a22b-467e-bbd1-13728dd7050e" |
|||
(reference "U4") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/48e5c29d-dae7-410f-a801-6c402cc42990/efd6cf1d-46e4-43a3-833d-ac2e75973904" |
|||
(reference "U5") (unit 1) |
|||
) |
|||
(path "/30037e9f-fb8a-4b65-9af4-98689a2fae61/745d7512-5b57-4355-bb9c-332f95478133/efd6cf1d-46e4-43a3-833d-ac2e75973904" |
|||
(reference "U6") (unit 1) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
@ -0,0 +1,75 @@ |
|||
/*
|
|||
* 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>
|
|||
#include <locale_io.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( ERCHierarchicalSchematics, ERC_REGRESSION_TEST_FIXTURE ) |
|||
{ |
|||
LOCALE_IO dummy; |
|||
|
|||
// Check not-connected ERC errors
|
|||
|
|||
std::vector<std::pair<wxString, int>> tests = { { "issue10926_1", 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()->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() ); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue