aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm6
-rw-r--r--tests/gremlin.scm33
2 files changed, 36 insertions, 3 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 5d049cd5fc..380b83509a 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -654,11 +654,11 @@
(drv (imported-files files)))
(define (file=? file1 file2)
;; Assume deduplication is in place.
- (= (stat:ino (lstat file1))
- (stat:ino (lstat file2))))
+ (= (stat:ino (stat file1))
+ (stat:ino (stat file2))))
(mbegin %store-monad
- (built-derivations (list drv))
+ (built-derivations (list (pk 'drv drv)))
(mlet %store-monad ((dir -> (derivation->output-path drv))
(plain* (text-file "foo" "bar!"))
(q-scm* (interned-file q-scm "c")))
diff --git a/tests/gremlin.scm b/tests/gremlin.scm
index f1089e7da6..77a5dc1998 100644
--- a/tests/gremlin.scm
+++ b/tests/gremlin.scm
@@ -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")