[Insight-developers] How to run the tests: itkGDCMImageIOTest3

Mark Roden mmroden at gmail.com
Mon Mar 7 19:11:09 EST 2011


Hi Luis,

Wow, you think using an IDE slows down development, and you have to go
through all of this to debug something?  I think you and I need to
discuss how to use IDE tools over a beer at the next conference.
Something about hitting 'f5' and just having it work is pretty sweet.
Especially if that test is hardcoded somewhere using relative paths,
which definitely looks like a possibility if the test can be run from
the command line directly.

In any event, when I run the program, I get:

Starting program:
/Users/mmroden/Documents/src/itk/itk-build-unix/bin/IOCxxTests
"itkGDCMImageIOTest"
"/Users/mmroden/Documents/src/itk/ITK/Testing/Data/Input/012345.002.050"
"/Users/mmroden/Documents/src/itk/itk-build-unix/Testing/Temporary/itkGDCMImageIOTest3.dcm"
"/Users/mmroden/Documents/src/itk/itk-build-unix/Testing/Temporary/itkGDCMImageIOTest3.png"
"/Users/mmroden/Documents/src/itk/itk-build-unix/Testing/Temporary/itkGDCMRescaleImageIOTest3.dcm"

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000050
0x0000000100740d85 in gdcm::JPEGCodec::Decode ()

That's a very different stack trace than what you were reporting.

I'm going to wrestle with this a bit more, but this just hurts.  Is
there no way to have a direct command line application that a) reads
in whatever files are used by the ctest app so that I don't have to
manually enter all the command line stuff (all it is is another
opportunity for error) and b) let's me trace right in there?  Maybe
IDE development has made me soft by thinking I could debug something
in ten minutes or less :)

Mark



On Mon, Mar 7, 2011 at 3:13 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Mark
>
> On Mon, Mar 7, 2011 at 5:54 PM, Mark Roden <mmroden at gmail.com> wrote:
>> Hi Luis,
>>
>> I can see the failing test, now that I'm in the right place.
>>
>> How did you get the stack trace there?
>
>
> 1) Type
>
>    gdb     /home/ibanez/bin/ITK/Release/bin/IOCxxTests
>
>
> (of course, with your own path to   IOCxxTests...)
>
> 2)  Once you get the gdb prompt,  type
>
>
> run  "itkGDCMImageIOTest"
> "/home/ibanez/src/ITK/Testing/Data/Input/012345.002.050"
> "/home/ibanez/bin/ITK/Release/Testing/Temporary/itkGDCMImageIOTest3.dcm"
> "/home/ibanez/bin/ITK/Release/Testing/Temporary/itkGDCMImageIOTest3.png"
> "/home/ibanez/bin/ITK/Release/Testing/Temporary/itkGDCMRescaleImageIOTest3.dcm"
>
> (again, with your own paths...)
>
> You will find the correct paths by doing
>
>    ctest -R itkGDCMImageIOTest3   -V   -N
>
>
>
>> I'm used to using IDEs, I
>> haven't really done command line debugging for a long while.  XCode
>> doesn't play nice with CTest, in that I can't figure out how to run
>> the test via XCode, which is how I'd normall debug this.
>>
>
>
> I would think that is possible to run GDB from XCode,...
> but I don't use IDEs since they just slow down development.    :-)
>
>
>> As far as I know, it's building in the default for CMake (debug,
>> right?).  Debug is set to just have the switch -g, as well as all of
>> Bradley's compiler warning switches.
>>
>
>
> In order to Debug, you need to select
>
>                 CMAKE_BUILD_TYPE = Debug
>
> when you configure ITK with CMake.
>
>
>> Right now, the test output looks like:
>>
>> Mark-Rodens-MacBook-Pro:itk-build-unix mmroden$ ctest -R
>> itkGDCMImageIOTest3 -V -n
>> UpdateCTestConfiguration  from
>> :/Users/mmroden/Documents/src/itk/itk-build-unix/DartConfiguration.tcl
>> Parse Config file:/Users/mmroden/Documents/src/itk/itk-build-unix/DartConfiguration.tcl
>>  Add coverage exclude regular expressions.
>>  Add coverage exclude: /CMakeFiles/CMakeTmp/
>>  Add coverage exclude: .*/Testing/.*
>>  Add coverage exclude: .*/Wrapping/.*
>>  Add coverage glob: Source/.*/*.h
>>  Add coverage glob: Source/.*/*.txx
>>  Add coverage glob: Source/.*/*.cxx
>> UpdateCTestConfiguration  from
>> :/Users/mmroden/Documents/src/itk/itk-build-unix/DartConfiguration.tcl
>> Parse Config file:/Users/mmroden/Documents/src/itk/itk-build-unix/DartConfiguration.tcl
>> Test project /Users/mmroden/Documents/src/itk/itk-build-unix
>> Constructing a list of tests
>> Done constructing a list of tests
>> Checking test dependency graph...
>> test 1212
>>    Start 1212: itkGDCMImageIOTest3
>>
>> 1212: Test command:
>> /Users/mmroden/Documents/src/itk/itk-build-unix/bin/IOCxxTests
>> "itkGDCMImageIOTest"
>> "/Users/mmroden/Documents/src/itk/itk/Testing/Data/Input/012345.002.050"
>> "/Users/mmroden/Documents/src/itk/itk-build-unix/Testing/Temporary/itkGDCMImageIOTest3.dcm"
>> "/Users/mmroden/Documents/src/itk/itk-build-unix/Testing/Temporary/itkGDCMImageIOTest3.png"
>> "/Users/mmroden/Documents/src/itk/itk-build-unix/Testing/Temporary/itkGDCMRescaleImageIOTest3.dcm"
>> 1212: Test timeout computed to be: 1500
>> 1/1 Test #1212: itkGDCMImageIOTest3 ..............***Exception:
>> SegFault  0.23 sec
>>
>> 0% tests passed, 1 tests failed out of 1
>>
>> Total Test time (real) =   0.52 sec
>>
>> The following tests FAILED:
>>        1212 - itkGDCMImageIOTest3 (SEGFAULT)
>> Errors while running CTest
>>
>
>
> Yeap,once you run it in GDB, you will find that
> in your patch, there is a recursive call to the
> same method, that saturates the stack.
>
> There is a polymorphism flaw in the way those
> methods are dispatched, (which is somehow,
> the risk that the warnings where bringing up in
> the first place).
>
>
>       Luis
>
>
> --------------------------------------
>>
>> Thanks,
>> Mark
>>
>> On Mon, Mar 7, 2011 at 2:44 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>> Hi Mark,
>>>
>>>
>>> When you downloaded ITK...
>>> did you follow the instruction in:
>>>
>>>   http://www.itk.org/Wiki/ITK/Git/Develop    ?
>>>
>>>
>>>
>>> In particular, did you run the script:
>>>
>>>     ./Utilities/SetupForDevelopment.sh
>>>
>>> as described in the instructions ?
>>>
>>>
>>> --
>>>
>>> If you go to the source tree of ITK,
>>> do you have a directory:
>>>
>>>            ITK/Testing/Data     ?
>>>
>>> Is there anything inside that directory ?
>>>
>>> If not, it means that you didn't run that
>>> script, or that something went wrong
>>> when you ran it.
>>>
>>>
>>>
>>>      Luis
>>>
>>>
>>> ----------------------------------------------
>>> On Mon, Mar 7, 2011 at 5:33 PM, Mark Roden <mmroden at gmail.com> wrote:
>>>> Hi Luis,
>>>>
>>>> 0) Good, I thought so.
>>>>
>>>> 1) When I do that, after building 'testing', I get the following:
>>>> Mark-Rodens-MacBook-Pro:bin mmroden$ ctest -R itkGDCMImageIOTest3
>>>> Test project /Users/mmroden/Documents/src/itk/itk-build-unix/bin
>>>> No tests were found!!!
>>>>
>>>> That's what's causing me some consternation.  Is there something else
>>>> I need to do to bring those tests out?  Because when I run the IOTests
>>>> under xcode, which brings up a testing app, that test isn't listed
>>>> either.  I do see it in the cmakelists, I just don't know how to get
>>>> there from here.
>>>>
>>>> Thanks,
>>>> Mark
>>>>
>>>> On Mon, Mar 7, 2011 at 2:30 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>>>> Hi Mark,
>>>>>
>>>>> 0) You don't need GDCM data to run this test.
>>>>>
>>>>>   The input file that is uses is in:
>>>>>
>>>>>       ITK/Testing/Data/Input/012345.002.050
>>>>>
>>>>>    For details please look at lines 1057-1061 of
>>>>>    the file  ITK/Testing/Code/IO/CMakeLists.txt:
>>>>>
>>>>> add_test(itkGDCMImageIOTest3 ${TestDriver} itkGDCMImageIOTest
>>>>>        ${ITK_DATA_ROOT}/Input/012345.002.050
>>>>>        ${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOTest3.dcm
>>>>>        ${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOTest3.png
>>>>>        ${ITK_TEST_OUTPUT_DIR}/itkGDCMRescaleImageIOTest3.dcm)
>>>>>
>>>>>
>>>>> 1) To run this single test you can "cd" into
>>>>>     the ITK binary directory and type:
>>>>>
>>>>>            ctest   -R      itkGDCMImageIOTest3
>>>>>
>>>>> 2) If you want the actual command line that
>>>>>     directly executes this test, type:
>>>>>
>>>>>       ctest -R itkGDCMImageIOTest3 -V -N
>>>>>
>>>>> you will get something like:
>>>>>
>>>>> ITK_BINARY_DIR/bin/IOCxxTests "itkGDCMImageIOTest"
>>>>> "/home/ibanez/src/ITK/Testing/Data/Input/012345.002.050"
>>>>> "/home/ibanez/bin/ITK/Release/Testing/Temporary/itkGDCMImageIOTest3.dcm"
>>>>> "/home/ibanez/bin/ITK/Release/Testing/Temporary/itkGDCMImageIOTest3.png"
>>>>> "/home/ibanez/bin/ITK/Release/Testing/Temporary/itkGDCMRescaleImageIOTest3.dcm"
>>>>>
>>>>> 4) Here is the link to the same tests as it is executed
>>>>>     in the Dashboard machines:
>>>>>
>>>>> http://www.cdash.org/CDash/testSummary.php?project=2&name=itkGDCMImageIOTest3&date=2011-03-07
>>>>>
>>>>>
>>>>>       Luis
>>>>>
>>>>>
>>>>> -------------------------------------------
>>>>> On Sat, Mar 5, 2011 at 7:50 PM, Mark Roden <mmroden at gmail.com> wrote:
>>>>>> Hi Luis,
>>>>>>
>>>>>> OK, now I've spent quite a bit of time trying to fix this patch and
>>>>>> this failing test with no luck. There has to be a better way.
>>>>>>
>>>>>> How can I find just this test to run it from the command line?  I've
>>>>>> cmade everything using unix makefiles on my mac using Bradley
>>>>>> Lowecamp's switches to expose warnings:
>>>>>>
>>>>>> Cxx : -Wall -Wextra -Wunused -Wpointer-arith -Winvalid-pch
>>>>>> -Wcast-align -Woverloaded-virtual -Wshadow -Wwrite-strings
>>>>>> -Wstrict-null-sentinel
>>>>>> C: -Wall -Wextra -Wunused -Wpointer-arith -Winvalid-pch -Wcast-align
>>>>>> -Wno-deprecated-declarations -Wno-uninitialized
>>>>>>
>>>>>> I then run make with default options on, as well as testing and
>>>>>> examples.  Everything builds, no tests are produced (or are they in
>>>>>> some directory that I don't know about).
>>>>>>
>>>>>> In what may not be a related error, if I turn on anything in gdcm (ie,
>>>>>> gdcm testing), I'll get these cmake errors:
>>>>>>
>>>>>> CMake Error at Utilities/gdcm/CMakeLists.txt:510 (SUBDIRS):
>>>>>>  subdirs Incorrect SUBDIRS command.  Directory: Testing does not exists.
>>>>>>
>>>>>>
>>>>>> If you want to build the test suite, you must set GDCM_DATA_ROOT
>>>>>> (advanced option) to the full path name of the gdcmData directory; if
>>>>>> you don't want, disable GDCM_BUILD_TESTING.
>>>>>> What is gdcmData? Please read:
>>>>>> http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=General_questions#What_is_gdcmData_.3F
>>>>>> CMake Error at Utilities/gdcm/Utilities/CMakeLists.txt:54 (SUBDIRS):
>>>>>>  subdirs Incorrect SUBDIRS command.  Directory: gdcmmd5 does not exists.
>>>>>>
>>>>>>
>>>>>> Configuring incomplete, errors occurred!
>>>>>>
>>>>>> The second error makes sense, since I haven't put the gdcm testing
>>>>>> data in their yet (do I need that for the failing test for this
>>>>>> patch?).  But what's the deal with that first error?  The 'Testing'
>>>>>> directory does 'exists' (sic) in the cmake target directory.
>>>>>>
>>>>>> If I set the testing directory to be the directory from the gdcm root,
>>>>>> CMake now reports:
>>>>>> CMake Error at Utilities/gdcm/CMakeLists.txt:510 (SUBDIRS):
>>>>>>  subdirs Incorrect SUBDIRS command.  Directory: Testing does not exists.
>>>>>>
>>>>>>
>>>>>> CMake Error at Utilities/gdcm/Utilities/CMakeLists.txt:54 (SUBDIRS):
>>>>>>  subdirs Incorrect SUBDIRS command.  Directory: gdcmmd5 does not exists.
>>>>>>
>>>>>>
>>>>>> Configuring incomplete, errors occurred!
>>>>>>
>>>>>> If this is related to the failing test, then I'll need to fix it in
>>>>>> order to fix the test, right?
>>>>>>
>>>>>> I'd like to just run  directly so that I can fix that particular test
>>>>>> (and perhaps develop further tests that check codecs other than jpeg).
>>>>>>
>>>>>> Thanks,
>>>>>> Mark
>>>>>>
>>>>>>
>>>>>> On Fri, Mar 4, 2011 at 9:58 AM, Code Review <review at kitware.com> wrote:
>>>>>>> From Mathieu Malaterre <mathieu.malaterre at gmail.com>:
>>>>>>>
>>>>>>> Mathieu Malaterre has posted comments on this change.
>>>>>>>
>>>>>>> Change subject: COMP: attempts to fix gdcm function hiding warnings
>>>>>>> ......................................................................
>>>>>>>
>>>>>>>
>>>>>>> Patch Set 1: Fails; I would prefer that you didn't submit this
>>>>>>>
>>>>>>> --
>>>>>>> To view, visit http://review.source.kitware.com/1120
>>>>>>> To unsubscribe, visit http://review.source.kitware.com/settings
>>>>>>>
>>>>>>> Gerrit-MessageType: comment
>>>>>>> Gerrit-Change-Id: I413102b25d1c9eee60eace2585c2f857ad564a67
>>>>>>> Gerrit-PatchSet: 1
>>>>>>> Gerrit-Project: ITK
>>>>>>> Gerrit-Branch: master
>>>>>>> Gerrit-Owner: Mark Roden <mmroden at gmail.com>
>>>>>>> Gerrit-Reviewer: Hans J. Johnson <hans-johnson at uiowa.edu>
>>>>>>> Gerrit-Reviewer: Luis Ibanez <luis.ibanez at kitware.com>
>>>>>>> Gerrit-Reviewer: Mathieu Malaterre <mathieu.malaterre at gmail.com>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>


More information about the Insight-developers mailing list