diff options
| author | Maxim Cournoyer <maxim@guixotic.coop> | 2025-10-20 22:36:44 +0900 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2025-10-29 11:51:24 +0900 |
| commit | 79dcb79e1f36a87550d6f00a66343dd024d14ef3 (patch) | |
| tree | f87019b3488a00727d802c39147d3334c6418133 /tests | |
| parent | cbc35fd9aa08a6da9df1ce8463779ad7decaf12a (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>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ld-wrapper.scm | 56 |
1 files changed, 56 insertions, 0 deletions
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) | ||
