Skip to content

Commit

Permalink
Added test for group_connectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Jul 21, 2020
1 parent ee46a6e commit 9a888a3
Show file tree
Hide file tree
Showing 7 changed files with 553 additions and 16 deletions.
110 changes: 110 additions & 0 deletions tests/config_samples/bom.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[BOM_OPTIONS]
; General BoM options here
; If 'ignore_dnf' option is set to 1, rows that are not to be fitted on the PCB will not be written to the BoM file
ignore_dnf = 1
; If 'html_generate_dnf' option is set to 1, also generate a list of components not fitted on the PCB (HTML only)
html_generate_dnf = 1
; If 'use_alt' option is set to 1, grouped references will be printed in the alternate compressed style eg: R1-R7,R18
use_alt = 0
; If 'number_rows' option is set to 1, each row in the BoM will be prepended with an incrementing row number
number_rows = 1
; If 'group_connectors' option is set to 1, connectors with the same footprints will be grouped together, independent of the name of the connector
group_connectors = 1
; If 'test_regex' option is set to 1, each component group will be tested against a number of regular-expressions (specified, per column, below). If any matches are found, the row is ignored in the output file
test_regex = 1
; If 'merge_blank_fields' option is set to 1, component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields = 1
; Specify output file name format, %O is the defined output name, %v is the version, %V is the variant name which will be ammended according to 'variant_file_name_format'.
output_file_name = %O_bom_%v%V
; Specify the variant file name format, this is a unique field as the variant is not always used/specified. When it is unused you will want to strip all of this.
variant_file_name_format = _(%V)
; Field name used to determine if a particular part is to be fitted
fit_field = Config
; Make a backup of the bom before generating the new one, using the following template
make_backup = %O.tmp
; Put the datasheet as a link for the following field
datasheet_as_link =
; Default number of boards to produce if none given on CLI with -n
number_boards = 1
; Default PCB variant if none given on CLI with -r
board_variant = default
; If 'hide_headers' option is set to 1, column headers aren't included in the output file
hide_headers = 0
; If 'hide_pcb_info' option is set to 1, PCB info isn't included in the output file
hide_pcb_info = 0
; Interpret as a Digikey P/N and link the following field
digikey_link =

[IGNORE_COLUMNS]
; Any column heading that appears here will be excluded from the Generated BoM
; Titles are case-insensitive
part lib
footprint lib

[COLUMN_ORDER]
; Columns will apear in the order they are listed here
; Titles are case-insensitive
Description
Part
Part Lib
References
Value
Footprint
Footprint Lib
Quantity Per PCB
Build Quantity
Datasheet

[GROUP_FIELDS]
; List of fields used for sorting individual components into groups
; Components which match (comparing *all* fields) will be grouped together
; Field names are case-insensitive
Part
Part Lib
Value
Footprint
Footprint Lib

[COMPONENT_ALIASES]
; A series of values which are considered to be equivalent for the part name
; Each line represents a list of equivalent component name values separated by white space
; e.g. 'c c_small cap' will ensure the equivalent capacitor symbols can be grouped together
; Aliases are case-insensitive
c c_small cap capacitor
r r_small res resistor
sw switch
l l_small inductor
zener zenersmall
d diode d_small

[JOIN]
; A list of rules to join the content of fields
; Each line is a rule, the first name is the field that will receive the data
; from the other fields
; Use tab (ASCII 9) as separator
; Field names are case sensitive

[REGEX_INCLUDE]
; A series of regular expressions used to include parts in the BoM
; If there are any regex defined here, only components that match against ANY of them will be included in the BOM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)

[COLUMN_RENAME]
; A list of columns to be renamed
; Format is: "[ColumName] [NewName]" (white-space separated)

[REGEX_EXCLUDE]
; A series of regular expressions used to exclude parts from the BoM
; If a component matches ANY of these, it will be excluded from the BoM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
References ^TP[0-9]*
References ^FID
Part mount.*hole
Part solder.*bridge
Part test.*point
Footprint test.*point
Footprint mount.*hole
Footprint fiducial

110 changes: 110 additions & 0 deletions tests/config_samples/no_group_connectors.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[BOM_OPTIONS]
; General BoM options here
; If 'ignore_dnf' option is set to 1, rows that are not to be fitted on the PCB will not be written to the BoM file
ignore_dnf = 1
; If 'html_generate_dnf' option is set to 1, also generate a list of components not fitted on the PCB (HTML only)
html_generate_dnf = 1
; If 'use_alt' option is set to 1, grouped references will be printed in the alternate compressed style eg: R1-R7,R18
use_alt = 0
; If 'number_rows' option is set to 1, each row in the BoM will be prepended with an incrementing row number
number_rows = 1
; If 'group_connectors' option is set to 1, connectors with the same footprints will be grouped together, independent of the name of the connector
group_connectors = 0
; If 'test_regex' option is set to 1, each component group will be tested against a number of regular-expressions (specified, per column, below). If any matches are found, the row is ignored in the output file
test_regex = 1
; If 'merge_blank_fields' option is set to 1, component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields = 1
; Specify output file name format, %O is the defined output name, %v is the version, %V is the variant name which will be ammended according to 'variant_file_name_format'.
output_file_name = %O_bom_%v%V
; Specify the variant file name format, this is a unique field as the variant is not always used/specified. When it is unused you will want to strip all of this.
variant_file_name_format = _(%V)
; Field name used to determine if a particular part is to be fitted
fit_field = Config
; Make a backup of the bom before generating the new one, using the following template
make_backup = %O.tmp
; Put the datasheet as a link for the following field
datasheet_as_link =
; Default number of boards to produce if none given on CLI with -n
number_boards = 1
; Default PCB variant if none given on CLI with -r
board_variant = default
; If 'hide_headers' option is set to 1, column headers aren't included in the output file
hide_headers = 0
; If 'hide_pcb_info' option is set to 1, PCB info isn't included in the output file
hide_pcb_info = 0
; Interpret as a Digikey P/N and link the following field
digikey_link =

[IGNORE_COLUMNS]
; Any column heading that appears here will be excluded from the Generated BoM
; Titles are case-insensitive
part lib
footprint lib

[COLUMN_ORDER]
; Columns will apear in the order they are listed here
; Titles are case-insensitive
Description
Part
Part Lib
References
Value
Footprint
Footprint Lib
Quantity Per PCB
Build Quantity
Datasheet

[GROUP_FIELDS]
; List of fields used for sorting individual components into groups
; Components which match (comparing *all* fields) will be grouped together
; Field names are case-insensitive
Part
Part Lib
Value
Footprint
Footprint Lib

[COMPONENT_ALIASES]
; A series of values which are considered to be equivalent for the part name
; Each line represents a list of equivalent component name values separated by white space
; e.g. 'c c_small cap' will ensure the equivalent capacitor symbols can be grouped together
; Aliases are case-insensitive
c c_small cap capacitor
r r_small res resistor
sw switch
l l_small inductor
zener zenersmall
d diode d_small

[JOIN]
; A list of rules to join the content of fields
; Each line is a rule, the first name is the field that will receive the data
; from the other fields
; Use tab (ASCII 9) as separator
; Field names are case sensitive

[REGEX_INCLUDE]
; A series of regular expressions used to include parts in the BoM
; If there are any regex defined here, only components that match against ANY of them will be included in the BOM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)

[COLUMN_RENAME]
; A list of columns to be renamed
; Format is: "[ColumName] [NewName]" (white-space separated)

[REGEX_EXCLUDE]
; A series of regular expressions used to exclude parts from the BoM
; If a component matches ANY of these, it will be excluded from the BoM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
References ^TP[0-9]*
References ^FID
Part mount.*hole
Part solder.*bridge
Part test.*point
Footprint test.*point
Footprint mount.*hole
Footprint fiducial

62 changes: 62 additions & 0 deletions tests/input_samples/connectors-cache.lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Connector_Conn_01x04_Female
#
DEF Connector_Conn_01x04_Female J 0 40 Y N 1 F N
F0 "J" 0 200 50 H V C CNN
F1 "Connector_Conn_01x04_Female" 0 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_1x??_*
$ENDFPLIST
DRAW
A 0 -200 20 901 -901 1 1 6 N 0 -180 0 -220
A 0 -100 20 901 -901 1 1 6 N 0 -80 0 -120
A 0 0 20 901 -901 1 1 6 N 0 20 0 -20
A 0 100 20 901 -901 1 1 6 N 0 120 0 80
P 2 1 1 6 -50 -200 -20 -200 N
P 2 1 1 6 -50 -100 -20 -100 N
P 2 1 1 6 -50 0 -20 0 N
P 2 1 1 6 -50 100 -20 100 N
X Pin_1 1 -200 100 150 R 50 50 1 1 P
X Pin_2 2 -200 0 150 R 50 50 1 1 P
X Pin_3 3 -200 -100 150 R 50 50 1 1 P
X Pin_4 4 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_Conn_01x06_Male
#
DEF Connector_Conn_01x06_Male J 0 40 Y N 1 F N
F0 "J" 0 300 50 H V C CNN
F1 "Connector_Conn_01x06_Male" 0 -400 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_1x??_*
$ENDFPLIST
DRAW
S 34 -295 0 -305 1 1 6 F
S 34 -195 0 -205 1 1 6 F
S 34 -95 0 -105 1 1 6 F
S 34 5 0 -5 1 1 6 F
S 34 105 0 95 1 1 6 F
S 34 205 0 195 1 1 6 F
P 2 1 1 6 50 -300 34 -300 N
P 2 1 1 6 50 -200 34 -200 N
P 2 1 1 6 50 -100 34 -100 N
P 2 1 1 6 50 0 34 0 N
P 2 1 1 6 50 100 34 100 N
P 2 1 1 6 50 200 34 200 N
X Pin_1 1 200 200 150 L 50 50 1 1 P
X Pin_2 2 200 100 150 L 50 50 1 1 P
X Pin_3 3 200 0 150 L 50 50 1 1 P
X Pin_4 4 200 -100 150 L 50 50 1 1 P
X Pin_5 5 200 -200 150 L 50 50 1 1 P
X Pin_6 6 200 -300 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library
64 changes: 64 additions & 0 deletions tests/input_samples/connectors.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L Connector:Conn_01x06_Male J1
U 1 1 5F170FD6
P 2950 2150
F 0 "J1" H 3058 2531 50 0000 C CNN
F 1 "Bizarre Bus" H 3058 2440 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 2950 2150 50 0001 C CNN
F 3 "~" H 2950 2150 50 0001 C CNN
F 4 "1x6" H 2950 2150 50 0001 C CNN "Description"
1 2950 2150
1 0 0 -1
$EndComp
$Comp
L Connector:Conn_01x06_Male J2
U 1 1 5F1718A4
P 3850 2150
F 0 "J2" H 3958 2531 50 0000 C CNN
F 1 "Output crazy" H 3958 2440 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 3850 2150 50 0001 C CNN
F 3 "~" H 3850 2150 50 0001 C CNN
F 4 "1x6" H 3850 2150 50 0001 C CNN "Description"
1 3850 2150
1 0 0 -1
$EndComp
$Comp
L Connector:Conn_01x04_Female J4
U 1 1 5F172308
P 4050 2850
F 0 "J4" H 4078 2826 50 0000 L CNN
F 1 "Another connector" H 4078 2735 50 0000 L CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 4050 2850 50 0001 C CNN
F 3 "~" H 4050 2850 50 0001 C CNN
F 4 "1x4" H 4050 2850 50 0001 C CNN "Description"
1 4050 2850
1 0 0 -1
$EndComp
$Comp
L Connector:Conn_01x04_Female J3
U 1 1 5F172BD1
P 2900 2850
F 0 "J3" H 2928 2826 50 0000 L CNN
F 1 "Bla bla connector" H 2928 2735 50 0000 L CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 2900 2850 50 0001 C CNN
F 3 "~" H 2900 2850 50 0001 C CNN
F 4 "1x4" H 2900 2850 50 0001 C CNN "Description"
1 2900 2850
1 0 0 -1
$EndComp
$EndSCHEMATC
Loading

0 comments on commit 9a888a3

Please sign in to comment.