diff --git a/tests/board_samples/error_l5.sch b/tests/board_samples/error_l5.sch new file mode 100644 index 00000000..4622a4ac --- /dev/null +++ b/tests/board_samples/error_l5.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 l5:R R1 +U 1 1 5EBE8A2E +P 3500 2200 +F 0 "R1" 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/board_samples/error_l6.sch b/tests/board_samples/error_l6.sch new file mode 100644 index 00000000..0a6bc50a --- /dev/null +++ b/tests/board_samples/error_l6.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 l6:R R1 +U 1 1 5EBE8A2E +P 3500 2200 +F 0 "R1" 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/board_samples/error_l7.sch b/tests/board_samples/error_l7.sch new file mode 100644 index 00000000..2e0eac13 --- /dev/null +++ b/tests/board_samples/error_l7.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 l7:R R1 +U 1 1 5EBE8A2E +P 3500 2200 +F 0 "R1" 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/board_samples/l5.lib b/tests/board_samples/l5.lib new file mode 100644 index 00000000..98a79408 --- /dev/null +++ b/tests/board_samples/l5.lib @@ -0,0 +1,47 @@ +EESchema-LIBRARY Version 2.4 +#encoding utf-8 +# +# R +# +DEF R R 0 0 N Y 1 F N +F0 "R" 80 0 50 V V C CNN +F1 "R" 0 0 50 V V C CNN +F2 "" -70 0 50 V I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + R_* + R_* +$ENDFPLIST +DRAW +S -40 -100 40 100 0 1 10 +P 3 0 1 0 -100 -150 0 -50 0 -50 +P 3 0 1 0 -100 -150 0 -50 0 -50 0 -50 N +C 100 100 5 0 1 0 +A -150 0 50 1 1799 1 1 0 N -100 0 -200 +T 0 300 250 24 0 0 0 BAL/STRB Normal 0 C +X ~ 1 0 150 50 D 50 50 1 1 +X ~ 2 0 -150 50 U 50 50 1 1 P +Y pepe +ENDDRAW +ENDDEF +# +# C +# Broken DEF +DEF C C 0 10 N Y 1 F +F0 "C" 25 100 50 H V L CNN +F1 "C" 25 -100 50 H V L CNN +F2 "" 38 -150 50 H I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + C_* +$ENDFPLIST +DRAW +P 2 0 1 20 -80 -30 80 -30 N +P 2 0 1 20 -80 30 80 30 N +X ~ 1 0 150 110 D 50 50 1 1 P +X ~ 2 0 -150 110 U 50 50 1 1 P +ENDDRAW +ENDDEF +DEF R R 0 0 N Y 1 F N +# +#End Library diff --git a/tests/board_samples/l6.lib b/tests/board_samples/l6.lib new file mode 100644 index 00000000..5ffba7b5 --- /dev/null +++ b/tests/board_samples/l6.lib @@ -0,0 +1 @@ +bogus diff --git a/tests/board_samples/l7.lib b/tests/board_samples/l7.lib new file mode 100644 index 00000000..2575865b --- /dev/null +++ b/tests/board_samples/l7.lib @@ -0,0 +1,8 @@ +EESchema-LIBRARY Version 2.4 +#encoding utf-8 +# +# R +# +DQF R R 0 0 N Y 1 F N +# +#End Library diff --git a/tests/board_samples/sym-lib-table b/tests/board_samples/sym-lib-table index 2211cd5a..1aaeca68 100644 --- a/tests/board_samples/sym-lib-table +++ b/tests/board_samples/sym-lib-table @@ -3,4 +3,8 @@ (lib (name l2)(type Legacy)(uri ${KIPRJMOD}/l2.lib)(options "")(descr "")) (lib (name l3)(type Legacy)(uri ${KIPRJMOD}/l3.lib)(options "")(descr "")) (lib (name l4)(type Legacy)(uri ${KIPRJMOD}/l4.lib)(options "")(descr "")) + (lib (name l5)(type Legacy)(uri ${KIPRJMOD}/l5.lib)(options "")(descr "")) + (lib (name l6)(type Legacy)(uri ${KIPRJMOD}/l6.lib)(options "")(descr "")) + (lib (name l7)(type Legacy)(uri ${KIPRJMOD}/l7.lib)(options "")(descr "")) + (lib (name l8)(type Legacy)(uri ${KIPRJMOD}/l8.lib)(options "")(descr "")) ) diff --git a/tests/test_plot/test_sch_errors.py b/tests/test_plot/test_sch_errors.py index 515e39e1..7a87f17f 100644 --- a/tests/test_plot/test_sch_errors.py +++ b/tests/test_plot/test_sch_errors.py @@ -61,3 +61,17 @@ def test_sch_errors_l4(): setup_ctx('l4', 'error_l4', 'Missing component field name') +def test_sch_errors_l5(): + setup_ctx('l5', 'error_l5', ['Unknown poligon definition', 'Expected 6 coordinates and got 8 in poligon', + 'Unknown square definition', 'Unknown circle definition', 'Unknown arc definition', + 'Unknown text definition', 'Unknown pin definition', 'Failed to load component definition', + 'Unknown draw element']) + + +def test_sch_errors_l6(): + setup_ctx('l6', 'error_l6', 'Missing library signature') + + +def test_sch_errors_l7(): + setup_ctx('l7', 'error_l7', 'Unknown library entry') + diff --git a/tests/utils/context.py b/tests/utils/context.py index 0475669e..df56f4e4 100644 --- a/tests/utils/context.py +++ b/tests/utils/context.py @@ -257,6 +257,14 @@ class TestContext(object): return m def search_err(self, text): + if isinstance(text, list): + res = [] + for t in text: + m = re.search(t, self.err, re.MULTILINE) + assert m is not None + logging.debug('error match: `{}` (`{}`) OK'.format(t, m.group(0))) + res.append(m) + return res m = re.search(text, self.err, re.MULTILINE) assert m is not None logging.debug('error match: `{}` (`{}`) OK'.format(text, m.group(0)))