aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-03-24 14:36:01 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-05-23 18:46:29 +0200
commit266a269af97fe60febe979fc02edda9e541c9c0c (patch)
tree06f6278122c582ea8012af0f061afd9f3d1f5935 /scripts
parent6d394a3f9629783772922abfc54e1db731e64361 (diff)
downloadhardware_replicant_libsamsung-ipc-266a269af97fe60febe979fc02edda9e541c9c0c.tar.gz
hardware_replicant_libsamsung-ipc-266a269af97fe60febe979fc02edda9e541c9c0c.tar.bz2
hardware_replicant_libsamsung-ipc-266a269af97fe60febe979fc02edda9e541c9c0c.zip
Autotools: add support for Valgrind for checks
This enables contributors to run Valgrind when running 'make check' for instance before sending patches. The --enable-valgrind option was used instead of using --enable-checking=valgrind like GCC uses as the code for that is much easier to get right. As Valgrind is very slow, I had to increase the timeouts in the ipc-modem tests. For now I settled on 60 seconds to have some margin for machines or setups that are potentially slower than the one I use. For the guix.scm, with Guix 1.3.0, Valgrind needs the ld.so .symtab to work, so as Valgrind doesn't know where to find them, so we had to use --extra-debuginfo-path for that. This is also why we pass '-v' to valgrind as it prints message explaining the issue when it doesn't find the required symbols. And we also needed a trick mentioned in the Guix mailing list[1] to find the right path for the debug information as the glibc being used by packages isn't exported publicly. [1]https://lists.gnu.org/archive/html/help-guix/2022-03/msg00036.html The proper fix will be merged in the next Guix release (merging it now is not possible since it would require to rebuild everything, and that is only possible with new releases). A temporary workaround with 4d1a88312cbebb10d47905d6d023953ac85bcd04 (gnu: valgrind: Allow ld.so symbols to be found.) was also merged in the current Guix so it is possible to get it with guix pull, but here it's probably better to stick with a workaround in the guix.scm for now as this also enables to use older guix revisions for testing. Thanks to the people on #guix on Liberachat for helping me to solve this Valgrind issue. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/PKGBUILD7
-rw-r--r--scripts/guix.scm22
2 files changed, 23 insertions, 6 deletions
diff --git a/scripts/PKGBUILD b/scripts/PKGBUILD
index 6f70c19..7deae5e 100644
--- a/scripts/PKGBUILD
+++ b/scripts/PKGBUILD
@@ -20,7 +20,8 @@ makedepends=('autoconf'
'pkg-config'
'python'
'python-sh'
- 'sed')
+ 'sed'
+ 'valgrind')
depends=('openssl')
pkgver() {
@@ -39,7 +40,9 @@ pkgver() {
build() {
../../autogen.sh
- ../../configure --prefix=/usr --enable-debug
+ ../../configure \
+ --prefix=/usr \
+ --enable-debug --enable-valgrind-tests
make
}
diff --git a/scripts/guix.scm b/scripts/guix.scm
index b723b7a..b8e5bef 100644
--- a/scripts/guix.scm
+++ b/scripts/guix.scm
@@ -53,13 +53,15 @@
(guix packages)
(gnu packages android)
(gnu packages autotools)
+ (gnu packages commencement)
(gnu packages disk)
(gnu packages linux)
(gnu packages llvm)
(gnu packages pkg-config)
(gnu packages python)
(gnu packages python-xyz)
- (gnu packages tls))
+ (gnu packages tls)
+ (gnu packages valgrind))
(define %common-strict-cflags
(string-append
@@ -103,10 +105,12 @@
`(("autoreconf" ,autoconf)
("aclocal" ,automake)
("ddrescue", ddrescue)
+ ("libc:debug", (@@ (gnu packages commencement) glibc-final) "debug")
("libtool" ,libtool)
("pkgconfig" ,pkg-config)
("python" ,python)
- ("python-sh" ,python-sh)))
+ ("python-sh" ,python-sh)
+ ("valgrind" ,valgrind)))
(inputs
`(("openssl" ,openssl)))
(arguments
@@ -116,9 +120,19 @@
(lambda _
(substitute* (find-files "." ".*\\.py$")
(("/usr/bin/env python") (which "python3")))
- #t)))
+ #t))
+ (add-after 'patch-python 'fix-valgrind
+ (lambda _
+ (substitute* (find-files "." ".*\\.py$")
+ (("'--leak-check=full',")
+ (string-append
+ "'--leak-check=full', '--extra-debuginfo-path="
+ (assoc-ref %build-inputs "libc:debug")
+ "/lib/debug',")))
+ #t)))
#:configure-flags
- (list "--enable-debug")))
+ (list "--enable-debug"
+ "--enable-valgrind-tests")))
(synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol")
(description
"libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol,