← Back to team overview

kicad-developers team mailing list archive

Re: [RFC] Pcbnew tests/utils

 

John,

I merged your patch.

Thanks,

Wayne

On 1/23/2019 6:10 PM, John Beard wrote:
> Hi Wayne,
> 
> Great, glad it's working OK. Here are a couple of follow-up patches
> (they've already been though Jenkins):
> 
> 1) Reinstate the polygon_generator tool, but as a subunit of
> pcbnew_tools. This utility has been non-compiled since the eeschema
> GAL landed. I imagine that's because of some CMake breakage in that
> merge. With the pcbnew_tools framework, it's easy to slot in now
> without any extra CMake (other than the file listing).
> 2) Add a simple unit test on co-routines - basically a simple
> automated version of the common_tools coroutine utility. I'm not
> really sure of the test coverage it provides, but it seems like a
> decent, simple, high-level test. Perhaps the CERN folks have ideas for
> good ways to exercise the co-routine code?
> 
> Cheers,
> 
> John
> 
> On Wed, Jan 23, 2019 at 6:36 PM Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
>>
>> Hey John,
>>
>> I don't know which dependency versions the Jenkins msys2 builder is
>> using so that may have something to do with it.  Either the gcc and/or
>> boost versions are the likely culprit.
>>
>> In any event, your changes resolved the issue so I merged your patch set.
>>
>> Thanks,
>>
>> Wayne
>>
>> On 1/23/2019 12:48 PM, John Beard wrote:
>>> Hi Wayne,
>>>
>>> Hmm, odd, I wonder how I ever got that building on Jenkins Msys2!
>>>
>>> This patch set is updated to use a method of building that I think
>>> will work. It's basically the same method as currently used by
>>> pnsrouter, connectivity and friends, where the intermediate library
>>> does not declare its own target_link_libraries but the end executable
>>> does. It's still not quite ideal (but with the current units code, it
>>> can't be), but it seems to work and it's somewhat consistent with
>>> existing practice. So it seems rather tidier now.
>>>
>>> Perhaps we'll run into more build issues, but for now at least,
>>> Jenkins is happy...
>>>
>>> Cheers,
>>>
>>> John
>>>
>>>
>>> On Wed, Jan 23, 2019 at 4:10 PM Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
>>>>
>>>> Hey John,
>>>>
>>>> I'm getting a bunch of build errors on windows.  It looks like it's
>>>> having issues finding std::set.
>>>>
>>>> In file included from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:28:0:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:
>>>> In function 'void KI_TEST::CheckUnorderedMatches(const EXP_CONT&, const
>>>> FOUND_CONT&, MATCH_PRED)':
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:10:
>>>> error: 'set' is not a member of 'std'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>           ^~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:10:
>>>> note: suggested alternative: 'get'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>           ^~~
>>>>           get
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:14:
>>>> error: expected primary-expression before 'const'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>               ^~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:133:17:
>>>> error: 'matched' was not declared in this scope
>>>>                  matched.insert( &expected );
>>>>                  ^~~~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:133:17:
>>>> note: suggested alternative: 'matherr'
>>>>                  matched.insert( &expected );
>>>>                  ^~~~~~~
>>>>                  matherr
>>>> In file included from
>>>> C:/msys64/mingw32/include/boost/test/test_tools.hpp:45:0,
>>>>                  from C:/msys64/mingw32/include/boost/test/unit_test.hpp:18,
>>>>                  from
>>>> C:/msys64/mingw32/include/boost/test/test_case_template.hpp:13,
>>>>                  from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:24:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:142:30:
>>>> error: 'matched' was not declared in this scope
>>>>          BOOST_CHECK_MESSAGE( matched.count( &exp ) > 0, "Expected item
>>>> was not found. Expected: \n"
>>>>                               ^
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:142:30:
>>>> note: suggested alternative: 'matherr'
>>>> In file included from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:28:0:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:147:33:
>>>> error: 'matched' was not declared in this scope
>>>>      for( const EXP_OBJ* found : matched )
>>>>                                  ^~~~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:147:33:
>>>> note: suggested alternative: 'matherr'
>>>>      for( const EXP_OBJ* found : matched )
>>>>                                  ^~~~~~~
>>>>                                  matherr
>>>> [ 66%] Built target qa_common_tools
>>>> In file included from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:28:0:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:
>>>> In function 'void KI_TEST::CheckUnorderedMatches(const EXP_CONT&, const
>>>> FOUND_CONT&, MATCH_PRED)':
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:10:
>>>> error: 'set' is not a member of 'std'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>           ^~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:10:
>>>> note: suggested alternative: 'get'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>           ^~~
>>>>           get
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:14:
>>>> error: expected primary-expression before 'const'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>               ^~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:133:17:
>>>> error: 'matched' was not declared in this scope
>>>>                  matched.insert( &expected );
>>>>                  ^~~~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:133:17:
>>>> note: suggested alternative: 'matherr'
>>>>                  matched.insert( &expected );
>>>>                  ^~~~~~~
>>>>                  matherr
>>>> In file included from
>>>> C:/msys64/mingw32/include/boost/test/test_tools.hpp:45:0,
>>>>                  from C:/msys64/mingw32/include/boost/test/unit_test.hpp:18,
>>>>                  from
>>>> C:/msys64/mingw32/include/boost/test/test_case_template.hpp:13,
>>>>                  from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:24:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:142:30:
>>>> error: 'matched' was not declared in this scope
>>>>          BOOST_CHECK_MESSAGE( matched.count( &exp ) > 0, "Expected item
>>>> was not found. Expected: \n"
>>>>                               ^
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:142:30:
>>>> note: suggested alternative: 'matherr'
>>>> In file included from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:28:0:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:147:33:
>>>> error: 'matched' was not declared in this scope
>>>>      for( const EXP_OBJ* found : matched )
>>>>                                  ^~~~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:147:33:
>>>> note: suggested alternative: 'matherr'
>>>>      for( const EXP_OBJ* found : matched )
>>>>                                  ^~~~~~~
>>>>                                  matherr
>>>> [ 66%] Linking CXX executable gerbview.exe
>>>> In file included from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:28:0:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:
>>>> In function 'void KI_TEST::CheckUnorderedMatches(const EXP_CONT&, const
>>>> FOUND_CONT&, MATCH_PRED)':
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:10:
>>>> error: 'set' is not a member of 'std'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>           ^~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:10:
>>>> note: suggested alternative: 'get'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>           ^~~
>>>>           get
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:124:14:
>>>> error: expected primary-expression before 'const'
>>>>      std::set<const EXP_OBJ*> matched;
>>>>               ^~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:133:17:
>>>> error: 'matched' was not declared in this scope
>>>>                  matched.insert( &expected );
>>>>                  ^~~~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:133:17:
>>>> note: suggested alternative: 'matherr'
>>>>                  matched.insert( &expected );
>>>>                  ^~~~~~~
>>>>                  matherr
>>>> In file included from
>>>> C:/msys64/mingw32/include/boost/test/test_tools.hpp:45:0,
>>>>                  from C:/msys64/mingw32/include/boost/test/unit_test.hpp:18,
>>>>                  from
>>>> C:/msys64/mingw32/include/boost/test/test_case_template.hpp:13,
>>>>                  from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:24:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:142:30:
>>>> error: 'matched' was not declared in this scope
>>>>          BOOST_CHECK_MESSAGE( matched.count( &exp ) > 0, "Expected item
>>>> was not found. Expected: \n"
>>>>                               ^
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:142:30:
>>>> note: suggested alternative: 'matherr'
>>>> In file included from
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/common/test_color4d.cpp:28:0:
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:147:33:
>>>> error: 'matched' was not declared in this scope
>>>>      for( const EXP_OBJ* found : matched )
>>>>                                  ^~~~~~~
>>>> C:/msys64/home/wstambaugh/src/kicad-trunk/qa/unit_test_utils/include/unit_test_utils/unit_test_utils.h:147:33:
>>>> note: suggested alternative: 'matherr'
>>>>      for( const EXP_OBJ* found : matched )
>>>>                                  ^~~~~~~
>>>>                                  matherr
>>>>
>>>>
>>>> On 1/22/2019 1:12 PM, John Beard wrote:
>>>>> Hi,
>>>>>
>>>>> Thanks Wayne for merging the utility program stuff.
>>>>>
>>>>> This brings me onto the subject of PCB utility programs in the same
>>>>> vein. Attached are some fun patches:
>>>>>
>>>>> 1) Some DRC-related groundwork
>>>>> 2) A Pcbnew unit test that can test a DRC function and the breaking
>>>>> out of the courtyard DRC functions. Also makes a so called
>>>>> "qa_pcbnew_utils" "library" *In theory* that can be shared between
>>>>> Pcbnew unit tests and Pcbnew utility programs.
>>>>> 3) A Pcbnew DRC util that allows to run the courtyard DRC (broken out
>>>>> in #2) from the command line. This is essentially what I used to
>>>>> generate the benchmarks the other day. Also can be used for fuzz
>>>>> testing, as well as debugging, developing and profiling.
>>>>> 4) Port the PCB parser utility over to the same executable.
>>>>>
>>>>> To run the DRC util, for example, with timing and marker information:
>>>>>
>>>>> $ qa/pcbnew_tools/qa_pcbnew_tools drc -vtm --courtyard-overlap
>>>>> --courtyard-missing /path/to/pcb.kicad_pcb
>>>>> Parsing: /path/to/pcb.kicad_pcb
>>>>> Running DRC check: Courtyard overlap
>>>>> Took: 1736us
>>>>> DRC markers: 1
>>>>> 0: ErrType(45): Courtyards overlap
>>>>>     @(24.500 mm, 20.000 mm): Footprint <no reference> on F.Cu
>>>>>     @(23.600 mm, 20.000 mm): Footprint <no reference> on F.Cu
>>>>> Running DRC check: Courtyard missing
>>>>> Took: 131us
>>>>> DRC markers: 0
>>>>>
>>>>> However, I have had the traditional difficulty getting this to link
>>>>> using a library for "qa_pcbnew_utils". What is in the patch #2 is a
>>>>> nasty and heinous hack that just about gets it working on
>>>>> Linux/Msys2/MSVC, but it's highly sub-optimal (it just puts the files
>>>>> and link_libraries in variables :s) So, that's why this is an "RFC":
>>>>> any ideas for getting this to work properly will be highly
>>>>> appreciated.
>>>>>
>>>>> Also, because this uses the same way of linking into pcbnew, it's even
>>>>> *more* brutal on the RAM needs at link-time: the targets "pcbnew",
>>>>> "qa_pcbnew" (unit tests) and "qa_pcbnew_tools" (the discussed utility
>>>>> tools) are all quite slow.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> John
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp


References