From a1255590e24f25d23adfa1c8a9083bc502abfcf1 Mon Sep 17 00:00:00 2001 From: SET Date: Fri, 14 Aug 2020 18:02:32 -0300 Subject: [PATCH] Added test for various errors in the component instantiation. --- tests/board_samples/error_bad_label.sch | 28 +++++++++++++ tests/board_samples/error_bad_matrix.sch | 28 +++++++++++++ tests/board_samples/error_bad_pos.sch | 41 +++++++++++++++++++ tests/board_samples/error_bad_red_pos.sch | 28 +++++++++++++ tests/board_samples/error_bad_unit.sch | 28 +++++++++++++ tests/board_samples/error_l9.sch | 4 +- tests/board_samples/error_miss_label.sch | 28 +++++++++++++ tests/board_samples/error_miss_matrix.sch | 27 +++++++++++++ tests/board_samples/error_miss_pos.sch | 28 +++++++++++++ tests/board_samples/error_miss_red_pos.sch | 26 ++++++++++++ tests/board_samples/error_miss_unit.sch | 28 +++++++++++++ tests/board_samples/error_wrong_ref.sch | 27 +++++++++++++ tests/test_plot/test_sch_errors.py | 46 +++++++++++++++++++++- 13 files changed, 364 insertions(+), 3 deletions(-) create mode 100644 tests/board_samples/error_bad_label.sch create mode 100644 tests/board_samples/error_bad_matrix.sch create mode 100644 tests/board_samples/error_bad_pos.sch create mode 100644 tests/board_samples/error_bad_red_pos.sch create mode 100644 tests/board_samples/error_bad_unit.sch create mode 100644 tests/board_samples/error_miss_label.sch create mode 100644 tests/board_samples/error_miss_matrix.sch create mode 100644 tests/board_samples/error_miss_pos.sch create mode 100644 tests/board_samples/error_miss_red_pos.sch create mode 100644 tests/board_samples/error_miss_unit.sch create mode 100644 tests/board_samples/error_wrong_ref.sch diff --git a/tests/board_samples/error_bad_label.sch b/tests/board_samples/error_bad_label.sch new file mode 100644 index 00000000..37ec2521 --- /dev/null +++ b/tests/board_samples/error_bad_label.sch @@ -0,0 +1,28 @@ +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 +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 +$EndSCHEMATC diff --git a/tests/board_samples/error_bad_matrix.sch b/tests/board_samples/error_bad_matrix.sch new file mode 100644 index 00000000..9d20e617 --- /dev/null +++ b/tests/board_samples/error_bad_matrix.sch @@ -0,0 +1,28 @@ +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 5F346E8B +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 +$EndComp +$EndSCHEMATC diff --git a/tests/board_samples/error_bad_pos.sch b/tests/board_samples/error_bad_pos.sch new file mode 100644 index 00000000..7514c7b1 --- /dev/null +++ b/tests/board_samples/error_bad_pos.sch @@ -0,0 +1,41 @@ +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 74xx:74LS04 U1 +U 3 1 5F345E39 +P 5200 2500 +AR Path="/5F342DEB/5F345E39" Ref="U1" Part="3" +AR Path="/5F34E267/5F345E39" Ref="U2" Part="3" +F 0 "U2" H 5200 2817 50 0000 C CNN +F 1 "74LS04" H 5200 2726 50 0000 C CNN +F 2 "" H 5200 2500 50 0001 C CNN +F 3 "http://www.ti.com/lit/gpn/sn74LS04" H 5200 2500 50 0001 C CNN + 3 5200 1500 + 1 0 0 -1 +$EndComp +$Comp +L Connector:Conn_01x06_Male J1 +U 1 1 5F170FD6 +P 2950 +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 +$EndSCHEMATC diff --git a/tests/board_samples/error_bad_red_pos.sch b/tests/board_samples/error_bad_red_pos.sch new file mode 100644 index 00000000..396c93e7 --- /dev/null +++ b/tests/board_samples/error_bad_red_pos.sch @@ -0,0 +1,28 @@ +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 + 1 0 0 -1 +$EndComp +$EndSCHEMATC diff --git a/tests/board_samples/error_bad_unit.sch b/tests/board_samples/error_bad_unit.sch new file mode 100644 index 00000000..3384b6ad --- /dev/null +++ b/tests/board_samples/error_bad_unit.sch @@ -0,0 +1,28 @@ +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 +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 +$EndSCHEMATC diff --git a/tests/board_samples/error_l9.sch b/tests/board_samples/error_l9.sch index a8559fa2..0d036074 100644 --- a/tests/board_samples/error_l9.sch +++ b/tests/board_samples/error_l9.sch @@ -14,10 +14,10 @@ Comment3 "" Comment4 "" $EndDescr $Comp -L l9:R R1 +L l9:R R? U 1 1 5EBE8A2E P 3500 2200 -F 0 "R1" H 3570 2246 50 0000 L CNN +F 0 "R?" H 3570 2246 50 0000 L CNN F 1 "100" H 3570 2155 50 0000 L CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 3430 2200 50 0001 C CNN F 3 "~" H 3500 2200 50 0001 C CNN diff --git a/tests/board_samples/error_miss_label.sch b/tests/board_samples/error_miss_label.sch new file mode 100644 index 00000000..ebd48d43 --- /dev/null +++ b/tests/board_samples/error_miss_label.sch @@ -0,0 +1,28 @@ +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 +R 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 +$EndSCHEMATC diff --git a/tests/board_samples/error_miss_matrix.sch b/tests/board_samples/error_miss_matrix.sch new file mode 100644 index 00000000..20ed2c9d --- /dev/null +++ b/tests/board_samples/error_miss_matrix.sch @@ -0,0 +1,27 @@ +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 +$EndComp +$EndSCHEMATC diff --git a/tests/board_samples/error_miss_pos.sch b/tests/board_samples/error_miss_pos.sch new file mode 100644 index 00000000..c5165623 --- /dev/null +++ b/tests/board_samples/error_miss_pos.sch @@ -0,0 +1,28 @@ +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 +QP 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 +$EndSCHEMATC diff --git a/tests/board_samples/error_miss_red_pos.sch b/tests/board_samples/error_miss_red_pos.sch new file mode 100644 index 00000000..de85eaf0 --- /dev/null +++ b/tests/board_samples/error_miss_red_pos.sch @@ -0,0 +1,26 @@ +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" +$EndComp +$EndSCHEMATC diff --git a/tests/board_samples/error_miss_unit.sch b/tests/board_samples/error_miss_unit.sch new file mode 100644 index 00000000..536d1d66 --- /dev/null +++ b/tests/board_samples/error_miss_unit.sch @@ -0,0 +1,28 @@ +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 +Q 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 +$EndSCHEMATC diff --git a/tests/board_samples/error_wrong_ref.sch b/tests/board_samples/error_wrong_ref.sch new file mode 100644 index 00000000..5882f06b --- /dev/null +++ b/tests/board_samples/error_wrong_ref.sch @@ -0,0 +1,27 @@ +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 l9:R REF +U 1 1 5EBE8A2E +P 3500 2200 +F 0 "REF" H 3570 2246 50 0000 L CNN +F 1 "100" H 3570 2155 50 0000 L CNN +F 2 "Resistor_SMD:R_0805_2012Metric" V 3430 2200 50 0001 C CNN +F 3 "~" H 3500 2200 50 0001 C CNN + 1 3500 2200 + 1 0 0 -1 +$EndComp +$EndSCHEMATC diff --git a/tests/test_plot/test_sch_errors.py b/tests/test_plot/test_sch_errors.py index 97773343..4d75d36b 100644 --- a/tests/test_plot/test_sch_errors.py +++ b/tests/test_plot/test_sch_errors.py @@ -81,7 +81,7 @@ def test_sch_errors_l8(): def test_sch_errors_l9(): - setup_ctx('l9', 'error_l9', 'Missing DCM signature') + setup_ctx('l9', 'error_l9', ['Missing DCM signature', 'Component (.*?) is not annotated']) def test_sch_errors_field(): @@ -96,3 +96,47 @@ def test_sch_errors_ar(): setup_ctx('field_ar', 'error_ar', ['Unknown AR field .?Bogus.?', 'Alternative Reference without path', 'Alternative Reference without reference', 'Component `U1` without the basic fields', 'Footprint with more than one colon']) + + +def test_sch_errors_miss_label(): + setup_ctx('miss_label', 'error_miss_label', 'Missing component label') + + +def test_sch_errors_bad_label(): + setup_ctx('bad_label', 'error_bad_label', 'Malformed component label') + + +def test_sch_errors_miss_unit(): + setup_ctx('miss_unit', 'error_miss_unit', 'Missing component unit') + + +def test_sch_errors_bad_unit(): + setup_ctx('bad_unit', 'error_bad_unit', 'Malformed component unit') + + +def test_sch_errors_miss_pos(): + setup_ctx('miss_pos', 'error_miss_pos', 'Missing component position') + + +def test_sch_errors_bad_pos(): + setup_ctx('bad_pos', 'error_bad_pos', ['Malformed component position', 'Inconsistent position for component']) + + +def test_sch_errors_miss_red_pos(): + setup_ctx('miss_red_pos', 'error_miss_red_pos', 'Missing component redundant position') + + +def test_sch_errors_bad_red_pos(): + setup_ctx('bad_red_pos', 'error_bad_red_pos', 'Malformed component redundant position') + + +def test_sch_errors_miss_matrix(): + setup_ctx('miss_matrix', 'error_miss_matrix', 'Missing component orientation matrix') + + +def test_sch_errors_bad_matrix(): + setup_ctx('bad_matrix', 'error_bad_matrix', 'Malformed component orientation matrix') + + +def test_sch_errors_wrong_ref(): + setup_ctx('wrong_ref', 'error_wrong_ref', 'Malformed component reference')