;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (test-debug-link) #:use-module (guix elf) #:use-module (guix build utils) #:use-module (guix build debug-link) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix tests) #:use-module (guix monads) #:use-module (guix derivations) #:use-module (gnu packages bootstrap) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) #:use-module (ice-9 match)) (define %guile-executable (match (false-if-exception (readlink "/proc/self/exe")) ((? string? program) (and (file-exists? program) (elf-file? program) program)) (_ #f))) (define read-elf (compose parse-elf get-bytevector-all)) (test-begin "debug-link") (unless %guile-executable (test-skip 1)) (test-assert "elf-debuglink" (let ((elf (call-with-input-file %guile-executable read-elf))) (match (call-with-values (lambda () (elf-debuglink elf)) list) ((#f #f) ;no '.gnu_debuglink' section (pk 'no-debuglink #t)) (((? string? file) (? integer? crc)) (string-suffix? ".debug" file))))) ;; Since we need %BOOTSTRAP-GCC and co., we have to skip the following tests ;; when networking is unreachable because we'd fail to download it. (unless (network-reachable?) (test-skip 1)) (test-assertm "elf-debuglink" ;; Check whether we can compute the CRC just like objcopy, and whether we ;; can retrieve it. (let* ((code (plain-file "test.c" "int main () { return 42; }")) (exp (with-imported-modules '((guix build utils) 2021-06-08gnu: python2-hdf4: Remove package....zimoun 2021-06-08gnu: python2-gridmap: Remove package....zimoun 2021-06-08gnu: python2-fastimport: Remove package....zimoun 2021-06-08gnu: python2-bigfloat: Remove package....zimoun 2021-06-08gnu: soapyhackrf: Update to 0.3.3-1.fa83fac....Guillaume Le Vaillant 2021-06-08gnu: Add julia-itertools....Efraim Flashner 2021-06-08gnu: Add julia-simpletraits....Efraim Flashner 2021-06-08gnu: Add julia-rotations....Efraim Flashner 2021-06-08gnu: Add julia-stringdistances....Efraim Flashner 2021-06-08gnu: Add julia-distances....Efraim Flashner 2021-06-08gnu: Add julia-axisalgorithms....Efraim Flashner 2021-06-08gnu: Add julia-woodburymatrices....Efraim Flashner 2021-06-08gnu: Add julia-ratios....Efraim Flashner 2021-06-08gnu: Add julia-identityranges....Efraim Flashner 2021-06-08gnu: Add julia-showoff....Efraim Flashner 2021-06-08gnu: Add julia-blockbandedmatrices....Efraim Flashner 2021-06-08gnu: Add julia-blockarrays....Efraim Flashner 2021-06-08