[pacman-dev] [PATCH] Add valgrind usage for testing purpose into the HACKING guide
Signed-off-by: Laszlo Papp <djszapi@archlinux.us> --- HACKING | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/HACKING b/HACKING index 09e782d..954d4b7 100644 --- a/HACKING +++ b/HACKING @@ -133,6 +133,16 @@ For pacman: #include "anythingelse.h" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +How to test pacman more using valgrind? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Try to run some commands using valgrind with a command like: + +valgrind --leak-check=full --trace-children=yes -- src/pacman/.libs/pacman -Syu + +Be careful, valgrind reports lots of errors, even some errors that may not be related to +pacman. You should have a little experience of valgrind to ignore the noise. + ///// vim: set ts=2 sw=2 syntax=asciidoc et: ///// -- 1.6.5
Laszlo Papp wrote:
Signed-off-by: Laszlo Papp <djszapi@archlinux.us> --- HACKING | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/HACKING b/HACKING index 09e782d..954d4b7 100644 --- a/HACKING +++ b/HACKING @@ -133,6 +133,16 @@ For pacman: #include "anythingelse.h" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+How to test pacman more using valgrind? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Try to run some commands using valgrind with a command like: + +valgrind --leak-check=full --trace-children=yes -- src/pacman/.libs/pacman -Syu + +Be careful, valgrind reports lots of errors, even some errors that may not be related to +pacman. You should have a little experience of valgrind to ignore the noise. + ///// vim: set ts=2 sw=2 syntax=asciidoc et: /////
Why would we provide instructions on how to use valgrind? That seems to be a job for the valgrind authors... Anyway, I believe the pactest suite is set up to use valgrind so you would be better using that to detect leaks. Also, we have a valgrind.supp file to suppress a lot of the false positives. Allan
On Sat, Nov 14, 2009 at 6:41 AM, Allan McRae <allan@archlinux.org> wrote:
Laszlo Papp wrote:
Signed-off-by: Laszlo Papp <djszapi@archlinux.us> --- HACKING | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/HACKING b/HACKING index 09e782d..954d4b7 100644 --- a/HACKING +++ b/HACKING @@ -133,6 +133,16 @@ For pacman: #include "anythingelse.h" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +How to test pacman more using valgrind? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Try to run some commands using valgrind with a command like: + +valgrind --leak-check=full --trace-children=yes -- src/pacman/.libs/pacman -Syu + +Be careful, valgrind reports lots of errors, even some errors that may not be related to +pacman. You should have a little experience of valgrind to ignore the noise. + ///// vim: set ts=2 sw=2 syntax=asciidoc et: /////
Why would we provide instructions on how to use valgrind? That seems to be a job for the valgrind authors...
Yeah, but git usage (e.g.) is described too on the wiki and in the documentations.
Anyway, I believe the pactest suite is set up to use valgrind so you would be better using that to detect leaks. Also, we have a valgrind.supp file to suppress a lot of the false positives.
Allan
I didn't know pactest suite can check all the facilities that valgrind can services, but maybe it's better for valgrind users to use it, as they use it daily, than debug/test which pactest suite does this task. Maybe it's quicker to use directly valgrind in a given situation sometimes than doing a full pactest suite, or deciding which one is good for the current requirement. In summary it's an attention for the developers/users they can use valgrind too, so it's not a change for pactest suites, but more facility to debug/test the application. It's not a pactest suite vs. valgrind question. The person who aren't interested in using/learning pactest suite, but he knows valgrind, he can take valgrind-like testings/debuggings too, which could be very useful too. Best Regards, Laszlo Papp
On Sat, Nov 14, 2009 at 6:41 AM, Allan McRae <allan@archlinux.org> wrote:
Why would we provide instructions on how to use valgrind? That seems to be a job for the valgrind authors...
I am always going back to Dan's blog to find how to run valgrind :) http://www.toofishes.net/blog/using-valgrind-c-programming/
Anyway, I believe the pactest suite is set up to use valgrind so you would be better using that to detect leaks. Also, we have a valgrind.supp file to suppress a lot of the false positives.
Actually both are useful, sometimes we want to run valgrind on a pactest to test a more specific codepath, sometimes we just want to check a normal operation. Or also an operation which is not available, like -Sy. Dan's article is still more complete, since it gives instructions for both cases, and for valgrind/massif/callgrind. But I think having some of that in HACKING is perfectly fine.
On Fri, Nov 13, 2009 at 5:29 PM, Laszlo Papp <djszapi2@gmail.com> wrote:
Signed-off-by: Laszlo Papp <djszapi@archlinux.us> --- HACKING | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/HACKING b/HACKING index 09e782d..954d4b7 100644 --- a/HACKING +++ b/HACKING @@ -133,6 +133,16 @@ For pacman: #include "anythingelse.h" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+How to test pacman more using valgrind? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Try to run some commands using valgrind with a command like: + +valgrind --leak-check=full --trace-children=yes -- src/pacman/.libs/pacman -Syu + +Be careful, valgrind reports lots of errors, even some errors that may not be related to +pacman. You should have a little experience of valgrind to ignore the noise.
1. Try it without trace-children; you'll be surprised at how clean it is...[1] 2. Running src/pacman/.libs/pacman will cause you to use the libalpm installed on the system and not the one built in the source tree. You need to run lt-pacman instead. I've taken the jist of this patch and put it into the HACKING file, but made it a bit more general and correct. Thanks! -Dan [1] $ sudo valgrind --leak-check=full ./src/pacman/.libs/lt-pacman -Sy Password: ==29264== /home/dmcgee/.valgrindrc was not read as it is world writeable or not owned by the current user ==29264== Memcheck, a memory error detector ==29264== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==29264== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==29264== Command: ./src/pacman/.libs/lt-pacman -Sy ==29264== :: Synchronizing package databases... testing 7.9K 36.6K/s 00:00:00 [####################################################################################] 100% core 34.8K 98.8K/s 00:00:00 [####################################################################################] 100% extra 438.5K 132.0K/s 00:00:03 [####################################################################################] 100% community-testing 1.9K 164.0K/s 00:00:00 [####################################################################################] 100% community 369.2K 136.5K/s 00:00:03 [####################################################################################] 100% ==29264== ==29264== HEAP SUMMARY: ==29264== in use at exit: 0 bytes in 0 blocks ==29264== total heap usage: 145,140 allocs, 145,140 frees, 166,708,494 bytes allocated ==29264== ==29264== All heap blocks were freed -- no leaks are possible ==29264== ==29264== For counts of detected and suppressed errors, rerun with: -v ==29264== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 7)
I've taken the jist of this patch and put it into the HACKING file, but made it a bit more general and correct.
Thanks!
Thanks Dan, really. Best Regards, Laszlo Papp
participants (5)
-
Allan McRae
-
Dan McGee
-
Laszlo Papp
-
Laszlo Papp
-
Xavier