Browse Source

Add ERC QA for wire bus entry unconnected / off grid

pcb_db
JamesJCode 9 months ago
parent
commit
0c76b723b4
  1. 451
      qa/data/eeschema/unconnected_bus_entry_qa.kicad_sch
  2. 1
      qa/tests/eeschema/CMakeLists.txt
  3. 77
      qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp

451
qa/data/eeschema/unconnected_bus_entry_qa.kicad_sch

@ -0,0 +1,451 @@
(kicad_sch
(version 20241209)
(generator "eeschema")
(generator_version "9.0")
(uuid "c33a2675-2f07-49e1-8de7-5364c718d121")
(paper "A4")
(lib_symbols
(symbol "Device:R"
(pin_numbers
(hide yes)
)
(pin_names
(offset 0)
)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "R"
(at 2.032 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 0 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at -1.778 0 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_keywords" "R res resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_fp_filters" "R_*"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(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)
)
)
)
)
)
(embedded_fonts no)
)
)
(text "<- THESE ARE UNCONNECTED"
(exclude_from_sim no)
(at 114.3 74.93 0)
(effects
(font
(size 1.27 1.27)
)
)
(uuid "215f4888-4bb7-434e-8504-686e4210e5f2")
)
(text "<- THESE ARE OFF-GRID + UNCONNECTED"
(exclude_from_sim no)
(at 120.65 67.31 0)
(effects
(font
(size 1.27 1.27)
)
)
(uuid "ded1bcad-371f-4efe-9f45-952492fcd0da")
)
(no_connect
(at 109.22 60.96)
(uuid "1d89c5b8-6944-4da7-ad6c-17dab1fb4411")
)
(no_connect
(at 82.55 60.96)
(uuid "f44cd4d5-7458-4670-8d78-01469565faa2")
)
(bus_entry
(at 93.98 73.66)
(size 2.54 2.54)
(stroke
(width 0)
(type default)
)
(uuid "801e2a1d-ff1e-4f13-a58f-4f1ab51cea94")
)
(bus_entry
(at 93.98 65.532)
(size 2.54 2.54)
(stroke
(width 0)
(type default)
)
(uuid "b4f6f9bc-a7ae-4b56-afa4-aa76c0f06f09")
)
(bus_entry
(at 80.01 45.72)
(size 2.54 2.54)
(stroke
(width 0)
(type default)
)
(uuid "fb4ce1ca-cc8c-4e1c-bc87-12ec54cceb95")
)
(bus_entry
(at 93.98 58.42)
(size 2.54 2.54)
(stroke
(width 0)
(type default)
)
(uuid "feb2a302-76bd-4ccb-983f-d87b900a04fc")
)
(bus
(pts
(xy 80.01 45.72) (xy 93.98 45.72)
)
(stroke
(width 0)
(type default)
)
(uuid "1325b324-50dd-4d73-945b-061478eeb5ba")
)
(bus
(pts
(xy 93.98 45.72) (xy 93.98 58.42)
)
(stroke
(width 0)
(type default)
)
(uuid "264742dd-a8d5-47f8-820b-8cae9e7649d9")
)
(wire
(pts
(xy 82.55 48.26) (xy 82.55 53.34)
)
(stroke
(width 0)
(type default)
)
(uuid "58b6b527-2de6-4ffb-bda8-851f908e8a4f")
)
(bus
(pts
(xy 73.66 45.72) (xy 80.01 45.72)
)
(stroke
(width 0)
(type default)
)
(uuid "69adee01-7d63-484e-98cb-b24f10f26f73")
)
(bus
(pts
(xy 93.98 58.42) (xy 93.98 65.532)
)
(stroke
(width 0)
(type default)
)
(uuid "acdd81c1-355a-4bb9-bc61-04564f077597")
)
(bus
(pts
(xy 93.98 73.66) (xy 93.98 116.84)
)
(stroke
(width 0)
(type default)
)
(uuid "cfc50338-e41e-4c22-ab97-8ad23e2066e9")
)
(wire
(pts
(xy 96.52 60.96) (xy 101.6 60.96)
)
(stroke
(width 0)
(type default)
)
(uuid "d989d335-946b-4c72-9eef-718def2aa89b")
)
(bus
(pts
(xy 93.98 65.532) (xy 93.98 73.66)
)
(stroke
(width 0)
(type default)
)
(uuid "ec876835-81dd-4bed-ad69-8dc9d9f64fde")
)
(label "A1"
(at 82.55 52.07 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
(uuid "2fa508ed-3e53-4b56-9f4d-6b965f213e95")
)
(label "A1"
(at 100.33 60.96 90)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
(uuid "a5689b91-1600-4ecb-9fc4-1b44f4b54313")
)
(label "A[1..2]"
(at 85.09 45.72 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
(uuid "adfedbf3-317c-439a-b4a4-44760d44564f")
)
(symbol
(lib_id "Device:R")
(at 105.41 60.96 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "7ac934ad-d2c2-4a3c-b10e-8c7665b1fb9d")
(property "Reference" "R2"
(at 105.41 54.61 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 105.41 57.15 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 105.41 62.738 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 105.41 60.96 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 105.41 60.96 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "1"
(uuid "4e4ded7a-59aa-4efb-affd-883b7ae384a7")
)
(pin "2"
(uuid "7aacd731-ea3c-49f2-9505-ff04c484a538")
)
(instances
(project "unconnected_bus_entry_qa"
(path "/c33a2675-2f07-49e1-8de7-5364c718d121"
(reference "R2")
(unit 1)
)
)
)
)
(symbol
(lib_id "Device:R")
(at 82.55 57.15 0)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "ea63b1f4-4f1b-4506-ad51-049f597d4bbd")
(property "Reference" "R1"
(at 85.09 55.8799 0)
(effects
(font
(size 1.27 1.27)
)
(justify left)
)
)
(property "Value" "R"
(at 85.09 58.4199 0)
(effects
(font
(size 1.27 1.27)
)
(justify left)
)
)
(property "Footprint" ""
(at 80.772 57.15 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 82.55 57.15 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 82.55 57.15 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "1"
(uuid "e783f75f-9d23-4271-bc07-fcd22f01ce0e")
)
(pin "2"
(uuid "454e58f7-5d12-4e63-9002-286f5c2f97a3")
)
(instances
(project ""
(path "/c33a2675-2f07-49e1-8de7-5364c718d121"
(reference "R1")
(unit 1)
)
)
)
)
(sheet_instances
(path "/"
(page "1")
)
)
(embedded_fonts no)
)

1
qa/tests/eeschema/CMakeLists.txt

@ -61,6 +61,7 @@ set( QA_EESCHEMA_SRCS
erc/test_erc_hierarchical_schematics.cpp
erc/test_erc_label_multiple_wires.cpp
erc/test_erc_unconnected_wire_endpoints.cpp
erc/test_erc_wire_bus_entry.cpp
test_connectivity_algo.cpp
test_eagle_plugin.cpp

77
qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp

@ -0,0 +1,77 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The 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/erc_settings.h>
#include <erc/erc.h>
#include <erc/erc_report.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( ERCWireBusEntry, ERC_REGRESSION_TEST_FIXTURE )
{
LOCALE_IO dummy;
std::vector<std::pair<wxString, int>> tests = { { "unconnected_bus_entry_qa", 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;
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_MISMATCH] = RPT_SEVERITY_IGNORE;
// Configure the rules under test
settings.m_ERCSeverities[ERCE_UNCONNECTED_WIRE_ENDPOINT] = RPT_SEVERITY_ERROR;
settings.m_ERCSeverities[ERCE_WIRE_DANGLING] = RPT_SEVERITY_ERROR;
settings.m_ERCSeverities[ERCE_ENDPOINT_OFF_GRID] = RPT_SEVERITY_ERROR;
m_schematic->ConnectionGraph()->RunERC();
ERC_TESTER tester( m_schematic.get() );
tester.TestOffGridEndpoints();
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second,
"Expected " << test.second << " errors in " << test.first.ToStdString()
<< " but got " << errors.GetCount() << "\n"
<< reportWriter.GetTextReport() );
}
}
Loading…
Cancel
Save