Re: [Kicad-developers] [PATCH] Further QA consolidation
Hi Wayne, On Tue, Jan 29, 2019 at 4:56 PM Wayne Stambaugh wrote: > Fair enough but I cannot see how the polygon changes could have broken > the common_eeschema tests. The common tests were recently replicated three times, one for each of the units defines, with each replication containing *every* common unit test. See commit 90ad2406607606187b2d2eb629ce764dbb46d965. Despite being named _pcbnew, etc, there is no such linkage. SHAPE_POLY_SET is a libcommon class, so the tests are now in qa_common_{pcbnew,eeschem,gerbview}, with the other generic geometry stuff (the contents of qa/common/geometry). > I merged your patch set. Hopefully test > failures will get resolved in the not too distant future. Here is a patch to fix the tests (the point on an outline edge is NOT supposed to collide according the docs). There could still be a defect in the SHAPE_POLY_SET implementation WRT the hole edges: currently these edges *do* count as collisions. For now, code and tests are consistent. If the SHAPE_POLY_SET is changed, whoever does it should ensure the tests are updated. This test is a bit fiddly, I think it could be improved, but I don't want to mess with it right now if the class its testing is having work done on it! Cheers, John From b8494711bf7c8dd1ec41863d58486651117c1e8d Mon Sep 17 00:00:00 2001 From: John Beard Date: Tue, 29 Jan 2019 17:38:31 + Subject: [PATCH] QA: Fix faulty test of SHAPE_POLY_SET Collision This test assumed points on a edge are counted as colliding. This is not true: points on an edge are NOT counted at inside the poly_set. THe test does still consider points on a *hole* edge as collisions. The API to SHAPE_POLY_SET is unclear on if this is correct. --- qa/common/geometry/test_shape_poly_set_collision.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa/common/geometry/test_shape_poly_set_collision.cpp b/qa/common/geometry/test_shape_poly_set_collision.cpp index 46de3db4b..828679d25 100644 --- a/qa/common/geometry/test_shape_poly_set_collision.cpp +++ b/qa/common/geometry/test_shape_poly_set_collision.cpp @@ -57,11 +57,11 @@ struct CollisionFixture // On a hole edge => inside the polygon collidingPoints.push_back( VECTOR2I( 40, 25 ) ); -// On the outline edge => inside the polygon -collidingPoints.push_back( VECTOR2I( 0, 10 ) ); - // Create points not colliding with the poly set. +// On the outline edge => outside the polygon +nonCollidingPoints.push_back( VECTOR2I( 0, 10 ) ); + // Completely outside of the polygon nonCollidingPoints.push_back( VECTOR2I( 200, 200 ) ); -- 2.20.1 ___ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
Re: [Kicad-developers] [PATCH] Further QA consolidation
Hey John, Fair enough but I cannot see how the polygon changes could have broken the common_eeschema tests. I merged your patch set. Hopefully test failures will get resolved in the not too distant future. Cheers, Wayne On 1/29/2019 9:28 AM, John Beard wrote: > Hi Wayne, > > Yes, it's the same failure, just moved into qa_common. Just a sad > quirk of timing that this thing was exposed at this particular moment > after being untouched for ages! > > Selfishly, I'd rather these patches were merged first, then the > polygon issue fixed, or I'll need to rebase the series and fix the > conflicts. Whereas merging first, then fixing, would not require a > conflict resolution. I'm willing to fix it as a follow up to this > patch series, but I am still unsure of whether a point on a "hole > edge" of the polygon counts as in or outside. If it's outside, the > POLY_SET implementation is still wrong. > > Cheers, > > John > > On Tue, Jan 29, 2019 at 1:30 PM Wayne Stambaugh wrote: >> >> John, >> >> I'm getting test failures with common_gerbview, common_eeschema, and >> common_pcbnew. I'm guessing the common_pcbnew is due to the recent >> polygon changes which broke the previous polygon test. Does it make >> sense to merge this unit the test failures are resolved? >> >> Cheers, >> >> Wayne >> >> On 1/25/2019 10:48 AM, John Beard wrote: >>> Hi, >>> >>> Here are a few more patches to finish up consolidating most of the >>> rest of the QA tools. >>> >>> 1) Adds some very basic dev-docs about the utility programs >>> 2) Housekeeping in qa_utils (hide some code in KI_TEST) >>> 3) qa_shape_factor_refactor is now only SHAPE_POLY_SET tests (the >>> CPolyline stuff is gone), so move to qa_common where pure geom tests >>> belong. Kill off this test executable. >>> 4) Reinstate the polygon triangulation util under qa_pcbnew_tools >>> 5) qa_pcbnew_tools: reuse common board reading code (useful when >>> quickly prototyping with utilities) >>> >>> The only outstanding broken PCB-related QA things now should be: >>> >>> * pcb_test_window: what is this for and can it be fixed? Can it be >>> made into a sub-tool, or does it need its own executable for the >>> wxApp? >>> >>> Cheers, >>> >>> John >>> >>> >>> ___ >>> Mailing list: https://launchpad.net/~kicad-developers >>> Post to : kicad-developers@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~kicad-developers >>> More help : https://help.launchpad.net/ListHelp >>> >> >> ___ >> Mailing list: https://launchpad.net/~kicad-developers >> Post to : kicad-developers@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~kicad-developers >> More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
Re: [Kicad-developers] [PATCH] Further QA consolidation
Hi Wayne, Yes, it's the same failure, just moved into qa_common. Just a sad quirk of timing that this thing was exposed at this particular moment after being untouched for ages! Selfishly, I'd rather these patches were merged first, then the polygon issue fixed, or I'll need to rebase the series and fix the conflicts. Whereas merging first, then fixing, would not require a conflict resolution. I'm willing to fix it as a follow up to this patch series, but I am still unsure of whether a point on a "hole edge" of the polygon counts as in or outside. If it's outside, the POLY_SET implementation is still wrong. Cheers, John On Tue, Jan 29, 2019 at 1:30 PM Wayne Stambaugh wrote: > > John, > > I'm getting test failures with common_gerbview, common_eeschema, and > common_pcbnew. I'm guessing the common_pcbnew is due to the recent > polygon changes which broke the previous polygon test. Does it make > sense to merge this unit the test failures are resolved? > > Cheers, > > Wayne > > On 1/25/2019 10:48 AM, John Beard wrote: > > Hi, > > > > Here are a few more patches to finish up consolidating most of the > > rest of the QA tools. > > > > 1) Adds some very basic dev-docs about the utility programs > > 2) Housekeeping in qa_utils (hide some code in KI_TEST) > > 3) qa_shape_factor_refactor is now only SHAPE_POLY_SET tests (the > > CPolyline stuff is gone), so move to qa_common where pure geom tests > > belong. Kill off this test executable. > > 4) Reinstate the polygon triangulation util under qa_pcbnew_tools > > 5) qa_pcbnew_tools: reuse common board reading code (useful when > > quickly prototyping with utilities) > > > > The only outstanding broken PCB-related QA things now should be: > > > > * pcb_test_window: what is this for and can it be fixed? Can it be > > made into a sub-tool, or does it need its own executable for the > > wxApp? > > > > Cheers, > > > > John > > > > > > ___ > > Mailing list: https://launchpad.net/~kicad-developers > > Post to : kicad-developers@lists.launchpad.net > > Unsubscribe : https://launchpad.net/~kicad-developers > > More help : https://help.launchpad.net/ListHelp > > > > ___ > Mailing list: https://launchpad.net/~kicad-developers > Post to : kicad-developers@lists.launchpad.net > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
Re: [Kicad-developers] [PATCH] Further QA consolidation
John, I'm getting test failures with common_gerbview, common_eeschema, and common_pcbnew. I'm guessing the common_pcbnew is due to the recent polygon changes which broke the previous polygon test. Does it make sense to merge this unit the test failures are resolved? Cheers, Wayne On 1/25/2019 10:48 AM, John Beard wrote: > Hi, > > Here are a few more patches to finish up consolidating most of the > rest of the QA tools. > > 1) Adds some very basic dev-docs about the utility programs > 2) Housekeeping in qa_utils (hide some code in KI_TEST) > 3) qa_shape_factor_refactor is now only SHAPE_POLY_SET tests (the > CPolyline stuff is gone), so move to qa_common where pure geom tests > belong. Kill off this test executable. > 4) Reinstate the polygon triangulation util under qa_pcbnew_tools > 5) qa_pcbnew_tools: reuse common board reading code (useful when > quickly prototyping with utilities) > > The only outstanding broken PCB-related QA things now should be: > > * pcb_test_window: what is this for and can it be fixed? Can it be > made into a sub-tool, or does it need its own executable for the > wxApp? > > Cheers, > > John > > > ___ > Mailing list: https://launchpad.net/~kicad-developers > Post to : kicad-developers@lists.launchpad.net > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp > ___ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
[Kicad-developers] [PATCH] Further QA consolidation
Hi, Here are a few more patches to finish up consolidating most of the rest of the QA tools. 1) Adds some very basic dev-docs about the utility programs 2) Housekeeping in qa_utils (hide some code in KI_TEST) 3) qa_shape_factor_refactor is now only SHAPE_POLY_SET tests (the CPolyline stuff is gone), so move to qa_common where pure geom tests belong. Kill off this test executable. 4) Reinstate the polygon triangulation util under qa_pcbnew_tools 5) qa_pcbnew_tools: reuse common board reading code (useful when quickly prototyping with utilities) The only outstanding broken PCB-related QA things now should be: * pcb_test_window: what is this for and can it be fixed? Can it be made into a sub-tool, or does it need its own executable for the wxApp? Cheers, John From 8efadbfef50cd441f624f0ef3db9e2915924209e Mon Sep 17 00:00:00 2001 From: John Beard Date: Thu, 24 Jan 2019 11:33:22 + Subject: [PATCH 1/6] Docs: Describe QA util programs in the testing docs --- Documentation/development/testing.md | 35 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Documentation/development/testing.md b/Documentation/development/testing.md index 6030d986d..5130dad0a 100644 --- a/Documentation/development/testing.md +++ b/Documentation/development/testing.md @@ -39,7 +39,7 @@ Common useful patterns: * ` -t "Utf8/UniIterNull"` runs only a single test in a specific suite. * ` -l all` adds more verbose debugging to the output. * ` --list_content` lists the test suites and test cases within the -test program. You can use these for arguments to `-l`. +test program. You can use these for arguments to `-t`. You can rebuild just a specific test with CMake to avoid rebuilding everything when working on a small area, e.g. `make qa_common`. @@ -149,6 +149,30 @@ You can run the tests in GDB to trace this: If the test segfaults, you will get a familiar backtrace, just like if you were running pcbnew under GDB. +# Utility programs {#utility-programs} + +KiCad includes some utility programs that can be used for debugging, profiling, +analysing or developing certain parts of the code without having to invoke the full +GUI program. + +Generally, they are part of the `qa_*_tools` QA executables, each one containing +the relevant tools for that library. To list the tools in a given program, pass +the `-l` parameter. Most tools provide help with the `-h` argument. +To invoke a program: + +qa__tools [-h] [tool arguments] + +Below is a brief outline of some available tools. For full information and command-line +parameters, refer to the tools' usage test (`-h`). + +* `common_tools` (the common library and core functions): +* `coroutine`: A simple coroutine example +* `io_benchmark`: Show relative speeds of reading files using various IO techniques. +* `qa_pcbnew_tools` (pcbnew-related functions): +* `drc`: Run and benchmark certain DRC functions on a user-provided `.kicad_pcb` files +* `pcb_parser`: Parse user-provided `.kicad_pcb` files +* `polygon_generator`: Dump polygons found on a PCB to the console + # Fuzz testing {#fuzz-testing} It is possible to run fuzz testing on some parts of KiCad. To do this for a @@ -164,12 +188,13 @@ For example, to use the [AFL fuzzing tool][], you will need: * To compile this executable with an AFL compiler, to enable the instrumentation that allows the fuzzer to detect the fuzzing state. -For example, the `qa_pcb_parse_input` executable can be compiled like this: +For example, the `qa_pcbnew_tools` executable (which contains `pcb_parser`, +a fuzz testing tool for `.kicad_pcb` file parsing) can be compiled like this: mkdir build cd build cmake -DCMAKE_CXX_COMPILER=/usr/bin/afl-clang-fast++ -DCMAKE_C_COMPILER=/usr/bin/afl-clang-fast ../kicad_src -make qa_pcb_parse_input +make qa_pcbnew_tools You may need to disable core dumps and CPU frequency scaling on your system (AFL will warn you if you should do this). For example, as root: @@ -177,9 +202,9 @@ will warn you if you should do this). For example, as root: # echo core >/proc/sys/kernel/core_pattern # echo performance | tee cpu*/cpufreq/scaling_governor -To fuzz: +To fuzz, run the executable via `afl-fuzz`: -afl-fuzz -i fuzzin -o fuzzout -m500 qa/pcb_parse_input/qa_pcb_parse_input +afl-fuzz -i fuzzin -o fuzzout -m500 qa/pcbnew_tools/qa_pcbnew_tools pcb_parser where: -- 2.20.1 From 0871074a1d09a80a8225ba22178fbc62c4acf1fd Mon Sep 17 00:00:00 2001 From: John Beard Date: Thu, 24 Jan 2019 12:12:25 + Subject: [PATCH 2/6] QA: Put UTILITY_PROGRAM in KI_TEST Also expand some documentation of some other KI_TEST functions. --- qa/common_tools/main.cpp | 4 +-- .../tools/coroutines/coroutine_tools.h| 2 +- .../tools/coroutines/coroutines.cpp | 6 ++-- .../tools/io_benchmark/io_benchmark.cpp | 6 ++-- .../tools/io_benchmark/io_benchmark.h | 2 +-