summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim@guixotic.coop>2025-10-20 22:36:44 +0900
committerMaxim Cournoyer <maxim@guixotic.coop>2025-10-29 11:51:24 +0900
commit79dcb79e1f36a87550d6f00a66343dd024d14ef3 (patch)
treef87019b3488a00727d802c39147d3334c6418133
parentcbc35fd9aa08a6da9df1ce8463779ad7decaf12a (diff)
tests: New ld-wrapper test.
* tests/ld-wrapper.scm: New file. * Makefile.am (SCM_TESTS): Register it. Change-Id: I3cef5ff363226a3ceee2599d4906f107d6ae7151 Reviewed-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--Makefile.am3
-rw-r--r--tests/ld-wrapper.scm56
2 files changed, 58 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index e0db4c9412b..a4e7277d6d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@
14# Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> 14# Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
15# Copyright © 2018 Alex Vong <alexvong1995@gmail.com> 15# Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
16# Copyright © 2019, 2023 Efraim Flashner <efraim@flashner.co.il> 16# Copyright © 2019, 2023 Efraim Flashner <efraim@flashner.co.il>
17# Copyright © 2020, 2021, 2023 Maxim Cournoyer <maxim@guixotic.coop> 17# Copyright © 2020, 2021, 2023, 2025 Maxim Cournoyer <maxim@guixotic.coop>
18# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com> 18# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
19# Copyright © 2021 Andrew Tropin <andrew@trop.in> 19# Copyright © 2021 Andrew Tropin <andrew@trop.in>
20# Copyright © 2023 Clément Lassieur <clement@lassieur.org> 20# Copyright © 2023 Clément Lassieur <clement@lassieur.org>
@@ -590,6 +590,7 @@ SCM_TESTS = \
590 tests/http-client.scm \ 590 tests/http-client.scm \
591 tests/inferior.scm \ 591 tests/inferior.scm \
592 tests/ipfs.scm \ 592 tests/ipfs.scm \
593 tests/ld-wrapper.scm \
593 tests/lint.scm \ 594 tests/lint.scm \
594 tests/modules.scm \ 595 tests/modules.scm \
595 tests/monads.scm \ 596 tests/monads.scm \
diff --git a/tests/ld-wrapper.scm b/tests/ld-wrapper.scm
new file mode 100644
index 00000000000..58958a8d0ce
--- /dev/null
+++ b/tests/ld-wrapper.scm
@@ -0,0 +1,56 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2025 Maxim Cournoyer <maxim@guixotic.coop>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(use-modules (guix tests)
20 (srfi srfi-26)
21 (srfi srfi-64))
22
23(define %project-root
24 (dirname (dirname (canonicalize-path (or (current-filename))))))
25
26;;; Load the ld-wrapper module and expose some internals, for white-box
27;;; testing.
28(load (string-append %project-root "/gnu/packages/ld-wrapper.in"))
29(define ld-wrapper-module (resolve-module '(gnu build-support ld-wrapper)))
30(define library-files-linked (module-ref ld-wrapper-module 'library-files-linked))
31
32(define %dummy-library-prefix "/gnu/store/...-dummy-0.0.0/lib")
33
34(test-begin "ld-wrapper")
35
36(define lugaru-link-arguments
37 '("-Wall" "-Wextra" "-Wno-parentheses" "-pedantic" "--std=gnu++11" "-O2" "-g"
38 "-DNDEBUG" "-rdynamic" "-Wl,--dependency-file=CMakeFiles/lugaru.dir/link.d"
39 "CMakeFiles/lugaru.dir/Source/main.cpp.o"
40 "CMakeFiles/lugaru.dir/Source/Animation/Animation.cpp.o"
41 "-o" "lugaru" "-lopenal" "-lpng" "-ljpeg" "-lz" "-lSDL2"
42 "-lGL" "-lGLU" "-lvorbisfile" "-logg"))
43
44(define lugaru-link-libraries
45 (map (cut string-append "lib" <> ".so")
46 '("openal" "png" "jpeg" "z" "SDL2" "GL" "GLU" "vorbisfile" "ogg")))
47
48(test-equal "library files linked"
49 (map (cut string-append %dummy-library-prefix "/" <>)
50 lugaru-link-libraries)
51 (mock ((guile) search-path
52 (lambda (_ library)
53 (string-append %dummy-library-prefix "/" library)))
54 (library-files-linked lugaru-link-arguments "dummy:library:path")))
55
56(test-end)