[CMake] Dart / ExperimentalMemCheck -- leaks not reported

Tristan Carel tristan.carel at gmail.com
Sun Apr 22 10:39:33 EDT 2007


Hi,

I have made a ctest script to run the ExperimentalMemCheck task on a
C++ test project which has memory leaks.
The CTest process works fine: compilation alright, valgrind is run,
finds leaks and reports are submited to the server. But unfortunatly
the `DynamicAnalysis.xml' does not contain the leaks :/

Here is the ctest file:

$ cat ExperimentalMemCheck.cmake
SET (CTEST_SOURCE_DIRECTORY "$ENV{PWD}")
SET (CTEST_BINARY_DIRECTORY "/tmp/experimental/$ENV{PROJECT_NAME}/memcheck")

SET (CTEST_CVS_COMMAND "/usr/bin/svn")
SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} co $ENV{PROJECT_SVNURL}
${CTEST_SOURCE_DIRECTORY}")

# which ctest command to use for running the dashboard
SET (CTEST_COMMAND "ctest -VV -D ExperimentalBuild -D
ExperimentalMemCheck -D ExperimentalSubmit")

# what cmake command to use for configuring this dashboard
SET (CTEST_CMAKE_COMMAND "cmake")

# should ctest wipe the binary tree before running
SET (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)

# this is the initial cache to use for the binary tree, be careful to escape
# any quotes inside of this string if you use it
SET (CTEST_INITIAL_CACHE "
MEMORYCHECK_COMMAND:FILEPATH=/usr/bin/valgrind
")

# set any extra envionment variables here
SET (CTEST_ENVIRONMENT
  "CC=gcc"
  "CXX=g++"
  "CXXFLAGS=-g -O0 -Wall -W -Wshadow -Wunused-variable
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs
-ftest-coverage"
  "CFLAGS=-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"
  "LDFLAGS=-fprofile-arcs -ftest-coverage"
)


Here is an overview of the output
$ PROJECT_NAME=cmake_dart ctest ExperimentalMemCheck.cmake
[...] // Valgrind is run and find the leaks
  5/  7 Memory Check helloworld_5args              Memory check
command: /usr/bin/valgrind -q --tool=memcheck --leak-check=yes
--show-reachable=yes --workaround
-gcc296-bugs=yes --num-callers=100

MemCheck command: /tmp/experimental/cmake_dart/memcheck/src/HelloWorld a b c d e
--9497-- DWARF2 CFI reader: unhandled CFI instruction 0:50
--9497-- DWARF2 CFI reader: unhandled CFI instruction 0:50
a
b
c
d
e
==9497==
==9497== 31 (4 direct, 27 indirect) bytes in 1 blocks are definitely
lost in loss record 1 of 2
==9497==    at 0x401CC55: operator new(unsigned) (vg_replace_malloc.c:163)
==9497==    by 0x804A28F: main (main.cc:49)
==9497==
==9497==
==9497== 27 bytes in 1 blocks are indirectly lost in loss record 2 of 2
==9497==    at 0x401CC55: operator new(unsigned) (vg_replace_malloc.c:163)
==9497==    by 0x40B7E6A: std::string::_Rep::_S_create(unsigned, unsigned, std::
allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.8)
==9497==    by 0x40B8C64: (within /usr/lib/libstdc++.so.6.0.8)
==9497==    by 0x40B8E78: std::string::string(char const*, std::allocator<char>
const&) (in /usr/lib/libstdc++.so.6.0.8)
==9497==    by 0x804A2CA: main (main.cc:49)
-- Process completed
   Passed
[...]
100% tests passed, 0 tests failed out of 7
-- Processing memory checking output:
Memory checking results:
Submit files (using http)
   Using HTTP submit method
   Drop site: http://dashboard.fantasy.homelinux.com/cmake_dart/submitreport
   Upload file:
/tmp/experimental/cmake_dart/memcheck/Testing/20070422-1422/Build.xml
to http://dashboard.fantasy.homelinux.com/cmake_dart/submitreport?FileName=titan___Linux-g%2B%2B___20070422-1422-Experimental___XML___Build.xml
Size: 1106
   Uploaded: /tmp/experimental/cmake_dart/memcheck/Testing/20070422-1422/Build.xml
   Upload file:
/tmp/experimental/cmake_dart/memcheck/Testing/20070422-1422/DynamicAnalysis.xml
to http://dashboard.fantasy.homelinux.com/cmake_dart/submitreport?FileName=titan___Linux-g%2B%2B___20070422-1422-Experimental___XML___DynamicAnalysis.xml
Size: 684
   Uploaded: /tmp/experimental/cmake_dart/memcheck/Testing/20070422-1422/DynamicAnalysis.xml
   Using HTTP trigger method
   Trigger site:
http://dashboard.fantasy.homelinux.com/cgi-bin/Submit-Random-TestingResults.cgi
   Trigger url:
http://dashboard.fantasy.homelinux.com/cgi-bin/Submit-Random-TestingResults.cgi?xmlfile=titan___Linux-g%2B%2B___20070422-1422-Experimental___XML___Build.xml

   Trigger url:
http://dashboard.fantasy.homelinux.com/cgi-bin/Submit-Random-TestingResults.cgi?xmlfile=titan___Linux-g%2B%2B___20070422-1422-Experimental___XML___DynamicAnalysis.xml

   Dart server triggered...
   Submission successful
$

The log shows that:
- Valgrind properly finds the leaks,
- The end of the log contains:

      -- Processing memory checking output:
      Memory checking results:
      Submit files (using http)

... which doesn't sound good :)


So as expected here is the XML log:

$ cat titan___Linux-g++___20070422-1422-Experimental___XML___DynamicAnalysis.xml
<?xml version="1.0" encoding="UTF-8"?>
<Site BuildName="Linux-g++" BuildStamp="20070422-1422-Experimental"
Name="titan" Generator="ctest2.4-patch 6">
<DynamicAnalysis Checker="Valgrind">
        <StartDateTime>Apr 22 16:22 CEST</StartDateTime>
        <TestList>
                <Test>./tests/helloworld_noarg</Test>
                <Test>./tests/helloworld_1arg</Test>
                <Test>./tests/helloworld_help1</Test>
                <Test>./tests/helloworld_help2</Test>
                <Test>./tests/helloworld_5args</Test>
                <Test>./tests/helloworld_6args</Test>
                <Test>./tests/helloworld_6argshelp</Test>
        </TestList>
        <DefectList>
        </DefectList>
        <EndDateTime>Apr 22 16:22 CEST</EndDateTime>
<ElapsedMinutes>0.1</ElapsedMinutes>
</DynamicAnalysis>
</Site>
$


I don't really know what is wrong in my configuration, I suppose the
valgrind output is not properly parsed or not written on the
appropriate file descriptor.

Here are the tools I use
$ valgrind --version
valgrind-3.2.3-Debian
$ cmake --version
cmake version 2.4-patch 6
$ ctest --version
ctest version 2.4-patch 6
$

If you have already encountered this problem or see something wrong, I
would be glad to have some feedback (or any clues for my
investigations).
You can find the full ctest log in attachment.

BTW: my thanks to Dart crew, it needs some time to understand the
philosophy, but it is really worth to.

Thank you by advance
Cheers
-- 
Tristan Carel
Music with dinner is an insult both to the cook and the violinist.
http://www.tristan-carel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: experimentalmemcheck.log.bz2
Type: application/x-bzip2
Size: 2430 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070422/dca78070/experimentalmemcheck.log.bin


More information about the CMake mailing list