summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-06-06 23:01:48 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-06-06 23:01:48 +0200
commit87096247567ac0d4aac3fc5a7a1e150d307c5b80 (patch)
treec974ba45c8c82b98ddc83b6b2ecfdd224e0bc3b6 /tests
parent116ca65b583ba4e404289f1481dc3a3ffef1c3dd (diff)
parent5e6bd3ebdcfad2bdb5c65427b5ebfe44a9e436d8 (diff)
downloadgnu-guix-87096247567ac0d4aac3fc5a7a1e150d307c5b80.tar
gnu-guix-87096247567ac0d4aac3fc5a7a1e150d307c5b80.tar.gz
Merge branch 'origin/core-updates-next' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/gremlin.scm35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/gremlin.scm b/tests/gremlin.scm
index 2885554967..1b47d5c384 100644
--- a/tests/gremlin.scm
+++ b/tests/gremlin.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,12 +18,14 @@
(define-module (test-gremlin)
#:use-module (guix elf)
+ #:use-module ((guix utils) #:select (call-with-temporary-directory))
#:use-module (guix build utils)
#:use-module (guix build gremlin)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-64)
#:use-module (rnrs io ports)
+ #:use-module (ice-9 popen)
#:use-module (ice-9 match))
(define %guile-executable
@@ -37,6 +39,9 @@
(define read-elf
(compose parse-elf get-bytevector-all))
+(define c-compiler
+ (or (which "gcc") (which "cc") (which "g++")))
+
(test-begin "gremlin")
@@ -63,4 +68,32 @@
"../${ORIGIN}/bar/$ORIGIN/baz"
"ORIGIN/foo")))
+(unless c-compiler
+ (test-skip 1))
+(test-equal "strip-runpath"
+ "hello\n"
+ (call-with-temporary-directory
+ (lambda (directory)
+ (with-directory-excursion directory
+ (call-with-output-file "t.c"
+ (lambda (port)
+ (display "int main () { puts(\"hello\"); }" port)))
+ (invoke c-compiler "t.c"
+ "-Wl,-rpath=/foo" "-Wl,-rpath=/bar")
+ (let* ((dyninfo (elf-dynamic-info
+ (parse-elf (call-with-input-file "a.out"
+ get-bytevector-all))))
+ (old (elf-dynamic-info-runpath dyninfo))
+ (new (strip-runpath "a.out"))
+ (new* (strip-runpath "a.out")))
+ (validate-needed-in-runpath "a.out")
+ (and (member "/foo" old) (member "/bar" old)
+ (not (member "/foo" new))
+ (not (member "/bar" new))
+ (equal? new* new)
+ (let* ((pipe (open-input-pipe "./a.out"))
+ (str (get-string-all pipe)))
+ (close-pipe pipe)
+ str)))))))
+
(test-end "gremlin")