7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 21:41:40 +00:00

Add qa for cli sch erc

This commit is contained in:
Marek Roszko 2025-01-04 22:29:01 -05:00
parent 02b3d03c23
commit ae0dc97929
4 changed files with 567 additions and 1 deletions

View File

@ -0,0 +1,375 @@
{
"$schema": "https://schemas.kicad.org/erc.v1.json",
"coordinate_units": "mm",
"date": "2025-01-04T22:22:42-0500",
"kicad_version": "9.0.0",
"sheets": [
{
"path": "/",
"uuid_path": "/64c481bc-ea0a-4f9c-a176-3729f4987c58",
"violations": [
{
"description": "Input Power pin not driven by any Output Power pins",
"items": [
{
"description": "Symbol U1 Pin 5 [V+, Power input, Line]",
"pos": {
"x": 1.4097,
"y": 0.7112
},
"uuid": "0123f423-4b4c-467f-8b7d-43421b82330d"
}
],
"severity": "error",
"type": "power_pin_not_driven"
},
{
"description": "The current configuration does not include the symbol library 'Device'",
"items": [
{
"description": "Symbol R1 [R_US]",
"pos": {
"x": 1.27,
"y": 0.9398
},
"uuid": "eaf8668d-aec7-4209-a3f9-fc7bfb5b931b"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'Resistor_SMD'.",
"items": [
{
"description": "Symbol R1 [R_US]",
"pos": {
"x": 1.27,
"y": 0.9398
},
"uuid": "eaf8668d-aec7-4209-a3f9-fc7bfb5b931b"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the symbol library 'Device'",
"items": [
{
"description": "Symbol R2 [R_US]",
"pos": {
"x": 1.4986,
"y": 0.9398
},
"uuid": "8b2eeae5-e1ad-4999-aeb9-01fe06aff8b1"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the symbol library 'power'",
"items": [
{
"description": "Symbol #PWR02 [GND]",
"pos": {
"x": 1.4097,
"y": 0.8763
},
"uuid": "62fef766-bfdd-4a4a-a8fa-79183473dd3b"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'Resistor_SMD'.",
"items": [
{
"description": "Symbol R2 [R_US]",
"pos": {
"x": 1.4986,
"y": 0.9398
},
"uuid": "8b2eeae5-e1ad-4999-aeb9-01fe06aff8b1"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the symbol library 'power'",
"items": [
{
"description": "Symbol #PWR03 [GND]",
"pos": {
"x": 1.2192,
"y": 0.8382
},
"uuid": "5d9a8cf4-5c54-4c57-accb-dd6295272287"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the symbol library 'Device'",
"items": [
{
"description": "Symbol C1 [C_Small]",
"pos": {
"x": 1.2192,
"y": 0.8001
},
"uuid": "8a4f4d93-4e0c-474b-8535-68c4fef6e828"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'Capacitor_SMD'.",
"items": [
{
"description": "Symbol C1 [C_Small]",
"pos": {
"x": 1.2192,
"y": 0.8001
},
"uuid": "8a4f4d93-4e0c-474b-8535-68c4fef6e828"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "Input Power pin not driven by any Output Power pins",
"items": [
{
"description": "Symbol U1 Pin 2 [V-, Power input, Line]",
"pos": {
"x": 1.4097,
"y": 0.8636
},
"uuid": "74f1f498-1594-4d18-a0fd-b624cedbd22a"
}
],
"severity": "error",
"type": "power_pin_not_driven"
},
{
"description": "The current configuration does not include the symbol library 'Connector'",
"items": [
{
"description": "Symbol J3 [Conn_01x01_Pin]",
"pos": {
"x": 1.778,
"y": 0.7874
},
"uuid": "9efa520e-00e1-47a2-b8dc-bf8e2121d065"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the symbol library 'Amplifier_Operational'",
"items": [
{
"description": "Symbol U1 [TLV2371DBV]",
"pos": {
"x": 1.4351,
"y": 0.7874
},
"uuid": "b8a40376-5e4f-459f-9886-5e9ee83698cf"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'Package_TO_SOT_SMD'.",
"items": [
{
"description": "Symbol U1 [TLV2371DBV]",
"pos": {
"x": 1.4351,
"y": 0.7874
},
"uuid": "b8a40376-5e4f-459f-9886-5e9ee83698cf"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the footprint library 'TestPoint'.",
"items": [
{
"description": "Symbol J3 [Conn_01x01_Pin]",
"pos": {
"x": 1.778,
"y": 0.7874
},
"uuid": "9efa520e-00e1-47a2-b8dc-bf8e2121d065"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the symbol library 'Connector'",
"items": [
{
"description": "Symbol J2 [Conn_01x01_Pin]",
"pos": {
"x": 1.0541,
"y": 0.762
},
"uuid": "2a9f5f63-d864-4898-ae3e-539c635e8f2c"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the symbol library 'Connector'",
"items": [
{
"description": "Symbol J1 [Conn_01x01_Pin]",
"pos": {
"x": 1.0541,
"y": 0.635
},
"uuid": "203ec3c1-122c-4087-8f6d-2a0dd0b941e6"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'TestPoint'.",
"items": [
{
"description": "Symbol J1 [Conn_01x01_Pin]",
"pos": {
"x": 1.0541,
"y": 0.635
},
"uuid": "203ec3c1-122c-4087-8f6d-2a0dd0b941e6"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the symbol library 'Device'",
"items": [
{
"description": "Symbol R3 [R_US]",
"pos": {
"x": 1.1557,
"y": 0.762
},
"uuid": "985a669c-9a7f-4b74-bb4f-9487b164d3aa"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'Resistor_SMD'.",
"items": [
{
"description": "Symbol R3 [R_US]",
"pos": {
"x": 1.1557,
"y": 0.762
},
"uuid": "985a669c-9a7f-4b74-bb4f-9487b164d3aa"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the symbol library 'power'",
"items": [
{
"description": "Symbol #PWR01 [GND]",
"pos": {
"x": 1.1938,
"y": 0.9652
},
"uuid": "19ba0538-2910-44b8-9336-edf1ff095912"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the symbol library 'power'",
"items": [
{
"description": "Symbol #PWR04 [GND]",
"pos": {
"x": 1.1176,
"y": 1.0033
},
"uuid": "a45b22f2-0929-43b6-b1fb-e2272cb68106"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the symbol library 'Connector'",
"items": [
{
"description": "Symbol J4 [Conn_01x01_Pin]",
"pos": {
"x": 1.0541,
"y": 0.9906
},
"uuid": "789295bb-2cfb-4a2b-977f-b3831d5aa975"
}
],
"severity": "warning",
"type": "lib_symbol_issues"
},
{
"description": "The current configuration does not include the footprint library 'TestPoint'.",
"items": [
{
"description": "Symbol J2 [Conn_01x01_Pin]",
"pos": {
"x": 1.0541,
"y": 0.762
},
"uuid": "2a9f5f63-d864-4898-ae3e-539c635e8f2c"
}
],
"severity": "warning",
"type": "footprint_link_issues"
},
{
"description": "The current configuration does not include the footprint library 'TestPoint'.",
"items": [
{
"description": "Symbol J4 [Conn_01x01_Pin]",
"pos": {
"x": 1.0541,
"y": 0.9906
},
"uuid": "789295bb-2cfb-4a2b-977f-b3831d5aa975"
}
],
"severity": "warning",
"type": "footprint_link_issues"
}
]
}
],
"source": "basic_test.kicad_sch"
}

View File

@ -0,0 +1,77 @@
ERC report (2025-01-04T22:22:42-0500, Encoding UTF8)
***** Sheet /
[power_pin_not_driven]: Input Power pin not driven by any Output Power pins
; error
@(140.97 mm, 71.12 mm): Symbol U1 Pin 5 [V+, Power input, Line]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(127.00 mm, 93.98 mm): Symbol R1 [R_US]
[footprint_link_issues]: The current configuration does not include the footprint library 'Resistor_SMD'.
; warning
@(127.00 mm, 93.98 mm): Symbol R1 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(149.86 mm, 93.98 mm): Symbol R2 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(140.97 mm, 87.63 mm): Symbol #PWR02 [GND]
[footprint_link_issues]: The current configuration does not include the footprint library 'Resistor_SMD'.
; warning
@(149.86 mm, 93.98 mm): Symbol R2 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(121.92 mm, 83.82 mm): Symbol #PWR03 [GND]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(121.92 mm, 80.01 mm): Symbol C1 [C_Small]
[footprint_link_issues]: The current configuration does not include the footprint library 'Capacitor_SMD'.
; warning
@(121.92 mm, 80.01 mm): Symbol C1 [C_Small]
[power_pin_not_driven]: Input Power pin not driven by any Output Power pins
; error
@(140.97 mm, 86.36 mm): Symbol U1 Pin 2 [V-, Power input, Line]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(177.80 mm, 78.74 mm): Symbol J3 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Amplifier_Operational'
; warning
@(143.51 mm, 78.74 mm): Symbol U1 [TLV2371DBV]
[footprint_link_issues]: The current configuration does not include the footprint library 'Package_TO_SOT_SMD'.
; warning
@(143.51 mm, 78.74 mm): Symbol U1 [TLV2371DBV]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(177.80 mm, 78.74 mm): Symbol J3 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(105.41 mm, 76.20 mm): Symbol J2 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(105.41 mm, 63.50 mm): Symbol J1 [Conn_01x01_Pin]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(105.41 mm, 63.50 mm): Symbol J1 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(115.57 mm, 76.20 mm): Symbol R3 [R_US]
[footprint_link_issues]: The current configuration does not include the footprint library 'Resistor_SMD'.
; warning
@(115.57 mm, 76.20 mm): Symbol R3 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(119.38 mm, 96.52 mm): Symbol #PWR01 [GND]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(111.76 mm, 100.33 mm): Symbol #PWR04 [GND]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(105.41 mm, 99.06 mm): Symbol J4 [Conn_01x01_Pin]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(105.41 mm, 76.20 mm): Symbol J2 [Conn_01x01_Pin]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(105.41 mm, 99.06 mm): Symbol J4 [Conn_01x01_Pin]
** ERC messages: 24 Errors 2 Warnings 22

View File

@ -0,0 +1,77 @@
ERC report (2025-01-04T22:27:21-0500, Encoding UTF8)
***** Sheet /
[power_pin_not_driven]: Input Power pin not driven by any Output Power pins
; error
@(5.550 in, 2.800 in): Symbol U1 Pin 5 [V+, Power input, Line]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(5.000 in, 3.700 in): Symbol R1 [R_US]
[footprint_link_issues]: The current configuration does not include the footprint library 'Resistor_SMD'.
; warning
@(5.000 in, 3.700 in): Symbol R1 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(5.900 in, 3.700 in): Symbol R2 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(5.550 in, 3.450 in): Symbol #PWR02 [GND]
[footprint_link_issues]: The current configuration does not include the footprint library 'Resistor_SMD'.
; warning
@(5.900 in, 3.700 in): Symbol R2 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(4.800 in, 3.300 in): Symbol #PWR03 [GND]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(4.800 in, 3.150 in): Symbol C1 [C_Small]
[footprint_link_issues]: The current configuration does not include the footprint library 'Capacitor_SMD'.
; warning
@(4.800 in, 3.150 in): Symbol C1 [C_Small]
[power_pin_not_driven]: Input Power pin not driven by any Output Power pins
; error
@(5.550 in, 3.400 in): Symbol U1 Pin 2 [V-, Power input, Line]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(7.000 in, 3.100 in): Symbol J3 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Amplifier_Operational'
; warning
@(5.650 in, 3.100 in): Symbol U1 [TLV2371DBV]
[footprint_link_issues]: The current configuration does not include the footprint library 'Package_TO_SOT_SMD'.
; warning
@(5.650 in, 3.100 in): Symbol U1 [TLV2371DBV]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(7.000 in, 3.100 in): Symbol J3 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(4.150 in, 3.000 in): Symbol J2 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(4.150 in, 2.500 in): Symbol J1 [Conn_01x01_Pin]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(4.150 in, 2.500 in): Symbol J1 [Conn_01x01_Pin]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Device'
; warning
@(4.550 in, 3.000 in): Symbol R3 [R_US]
[footprint_link_issues]: The current configuration does not include the footprint library 'Resistor_SMD'.
; warning
@(4.550 in, 3.000 in): Symbol R3 [R_US]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(4.700 in, 3.800 in): Symbol #PWR01 [GND]
[lib_symbol_issues]: The current configuration does not include the symbol library 'power'
; warning
@(4.400 in, 3.950 in): Symbol #PWR04 [GND]
[lib_symbol_issues]: The current configuration does not include the symbol library 'Connector'
; warning
@(4.150 in, 3.900 in): Symbol J4 [Conn_01x01_Pin]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(4.150 in, 3.000 in): Symbol J2 [Conn_01x01_Pin]
[footprint_link_issues]: The current configuration does not include the footprint library 'TestPoint'.
; warning
@(4.150 in, 3.900 in): Symbol J4 [Conn_01x01_Pin]
** ERC messages: 24 Errors 2 Warnings 22

View File

@ -160,4 +160,41 @@ def test_sch_export_pythonbom( kitest,
# pythonbom is not currently crossplatform (platform specific paths) to enable diffs
kitest.add_attachment( str( output_filepath ) )
kitest.add_attachment( str( output_filepath ) )
@pytest.mark.parametrize("test_file,output_fn,line_skip_count,skip_compare,expected_exit_code,cli_args",
[("cli/basic_test/basic_test.kicad_sch", "basic_test.erc.rpt", 1, False, 0, []),
("cli/basic_test/basic_test.kicad_sch", "basic_test.erc.rpt", 1, False, 0, ["--format=report"]),
("cli/basic_test/basic_test.kicad_sch", "basic_test.erc.json", 4, False,0, ["--format=json"]),
("cli/basic_test/basic_test.kicad_sch", "basic_test.erc.unitsin.rpt", 1, False, 0, ["--format=report", "--units=in"]),
])
def test_sch_export_erc( kitest,
test_file: str,
output_fn: str,
line_skip_count: int,
skip_compare: bool,
expected_exit_code: int,
cli_args: List[str] ):
input_file = kitest.get_data_file_path( test_file )
compare_filepath = kitest.get_data_file_path( "cli/basic_test/{}".format( output_fn ) )
output_filepath = kitest.get_output_path( "cli/" ).joinpath( output_fn )
command = ["kicad-cli", "sch", "erc"]
command.extend( cli_args )
command.append( "-o" )
command.append( str( output_filepath ) )
command.append( input_file )
stdout, stderr, exitcode = utils.run_and_capture( command )
assert exitcode == expected_exit_code
assert stderr == ''
# some of our netlist formats are not cross platform so skip for now
if not skip_compare:
assert utils.textdiff_files( compare_filepath, str( output_filepath ), line_skip_count )
kitest.add_attachment( str( output_filepath ) )