diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-09-19 14:04:41 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-09-19 17:28:46 +0200 |
commit | 49a1203d67a90a6a7ce4e4537697a6da96ceb213 (patch) | |
tree | 3f3f111ef4ab78bcbcc43e5cef197d8bb28362fa /tests | |
parent | e0f31baacc6ad30096a332b69433c85f5830bb2c (diff) | |
download | guix-49a1203d67a90a6a7ce4e4537697a6da96ceb213.tar.gz guix-49a1203d67a90a6a7ce4e4537697a6da96ceb213.zip |
gremlin: Add 'set-file-runpath', 'file-runpath', and 'file-needed'.
* guix/build/gremlin.scm (file-dynamic-info, file-runpath, file-needed):
New procedures.
(&missing-runpath-error, &runpath-too-long-error): New condition types.
(set-file-runpath): New procedure.
* tests/gremlin.scm ("set-file-runpath + file-runpath"): New test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gremlin.scm | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/gremlin.scm b/tests/gremlin.scm index b0bb7a8e49..f191adb8b3 100644 --- a/tests/gremlin.scm +++ b/tests/gremlin.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015, 2018, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +23,7 @@ #:use-module (guix build gremlin) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-34) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) #:use-module (ice-9 popen) @@ -96,4 +97,31 @@ (close-pipe pipe) str))))))) +(unless c-compiler + (test-skip 1)) +(test-equal "set-file-runpath + file-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,--enable-new-dtags" "-Wl,-rpath=/xxxxxxxxx") + + (let ((original-runpath (file-runpath "a.out"))) + (and (member "/xxxxxxxxx" original-runpath) + (guard (c ((runpath-too-long-error? c) + (string=? "a.out" (runpath-too-long-error-file c)))) + (set-file-runpath "a.out" (list (make-string 777 #\y)))) + (let ((runpath (delete "/xxxxxxxxx" original-runpath))) + (set-file-runpath "a.out" runpath) + (equal? runpath (file-runpath "a.out"))) + (let* ((pipe (open-input-pipe "./a.out")) + (str (get-string-all pipe))) + (close-pipe pipe) + str))))))) + (test-end "gremlin") |