diff options
| -rw-r--r-- | tests/pack.scm | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/tests/pack.scm b/tests/pack.scm index 1c1e3125575..9c7e0a50baa 100644 --- a/tests/pack.scm +++ b/tests/pack.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2017-2021, 2023 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> | 3 | ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> |
| 4 | ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com> | 4 | ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
| 5 | ;;; Copyright © 2023 Oleg Pykhalov <go.wigust@gmail.com> | 5 | ;;; Copyright © 2023 Oleg Pykhalov <go.wigust@gmail.com> |
| @@ -34,14 +34,15 @@ | |||
| 34 | #:use-module ((guix build utils) #:select (%store-directory)) | 34 | #:use-module ((guix build utils) #:select (%store-directory)) |
| 35 | #:use-module (gnu packages) | 35 | #:use-module (gnu packages) |
| 36 | #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target | 36 | #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target |
| 37 | hello)) | 37 | hello glibc)) |
| 38 | #:use-module (gnu packages bootstrap) | 38 | #:use-module (gnu packages bootstrap) |
| 39 | #:use-module ((gnu packages package-management) #:select (rpm)) | 39 | #:use-module ((gnu packages package-management) #:select (rpm)) |
| 40 | #:use-module ((gnu packages compression) #:select (squashfs-tools)) | 40 | #:use-module ((gnu packages compression) #:select (squashfs-tools)) |
| 41 | #:use-module ((gnu packages debian) #:select (dpkg)) | 41 | #:use-module ((gnu packages debian) #:select (dpkg)) |
| 42 | #:use-module ((gnu packages guile) #:select (guile-sqlite3)) | 42 | #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0)) |
| 43 | #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) | 43 | #:use-module ((gnu packages gnupg) #:select (guile-gcrypt)) |
| 44 | #:use-module ((gnu packages linux) #:select (fakeroot)) | 44 | #:use-module ((gnu packages linux) #:select (fakeroot)) |
| 45 | #:use-module ((ice-9 textual-ports) #:select (get-string-all)) | ||
| 45 | #:use-module (srfi srfi-64)) | 46 | #:use-module (srfi srfi-64)) |
| 46 | 47 | ||
| 47 | (define %store | 48 | (define %store |
| @@ -347,36 +348,64 @@ | |||
| 347 | (mlet* %store-monad | 348 | (mlet* %store-monad |
| 348 | ((guile (set-guile-for-build (default-guile))) | 349 | ((guile (set-guile-for-build (default-guile))) |
| 349 | (profile -> (profile | 350 | (profile -> (profile |
| 350 | (content (packages->manifest (list %bootstrap-guile hello))) | 351 | ;; When using '--appimage-extract-and-run', the dynamic |
| 352 | ;; linker is necessary, hence glibc below. | ||
| 353 | (content (packages->manifest (list hello glibc))) | ||
| 351 | (hooks '()) | 354 | (hooks '()) |
| 352 | (locales? #f))) | 355 | (locales? #f))) |
| 353 | (image (self-contained-appimage "hello-appimage" profile | 356 | (image (self-contained-appimage "hello-appimage" profile |
| 354 | #:entry-point "bin/hello" | 357 | #:entry-point "bin/hello" |
| 355 | #:extra-options | 358 | #:extra-options |
| 356 | (list #:relocatable? #t))) | 359 | '(#:relocatable? #t))) |
| 357 | (check (gexp->derivation | 360 | (check (gexp->derivation |
| 358 | "check-appimage" | 361 | "check-appimage" |
| 359 | #~(invoke #$image)))) | 362 | (with-imported-modules '((guix build utils)) |
| 360 | (built-derivations (list check)))) | 363 | #~(begin |
| 364 | (use-modules (ice-9 popen) | ||
| 365 | (guix build utils)) | ||
| 366 | (let ((pipe (open-pipe* OPEN_READ | ||
| 367 | #$image "--appimage-extract-and-run"))) | ||
| 368 | (call-with-output-file #$output | ||
| 369 | (lambda (port) | ||
| 370 | (dump-port pipe port))) | ||
| 371 | (exit (status:exit-val (close-pipe pipe))))))))) | ||
| 372 | (mbegin %store-monad | ||
| 373 | (built-derivations (list (pk 'APPIMAGE-drv check))) | ||
| 374 | (return (string=? (call-with-input-file (derivation->output-path check) | ||
| 375 | get-string-all) | ||
| 376 | "Hello, world!\n"))))) | ||
| 361 | 377 | ||
| 362 | (unless store (test-skip 1)) | 378 | (unless store (test-skip 1)) |
| 363 | (test-assertm "appimage + localstatedir" | 379 | (test-assertm "appimage + localstatedir" |
| 364 | (mlet* %store-monad | 380 | (mlet* %store-monad |
| 365 | ((guile (set-guile-for-build (default-guile))) | 381 | ((guile (set-guile-for-build (default-guile))) |
| 366 | (profile -> (profile | 382 | (profile -> (profile |
| 367 | (content (packages->manifest (list %bootstrap-guile hello))) | 383 | ;; When using '--appimage-extract-and-run', the dynamic |
| 384 | ;; linker is necessary, hence glibc below. | ||
| 385 | (content (packages->manifest (list guile-3.0 glibc))) | ||
| 368 | (hooks '()) | 386 | (hooks '()) |
| 369 | (locales? #f))) | 387 | (locales? #f))) |
| 370 | (image (self-contained-appimage "hello-appimage" profile | 388 | (image (self-contained-appimage "guile-appimage" profile |
| 371 | #:entry-point "bin/hello" | 389 | #:entry-point "bin/guile" |
| 372 | #:localstatedir? #t | 390 | #:localstatedir? #t |
| 373 | #:extra-options | 391 | #:extra-options |
| 374 | (list #:relocatable? #t))) | 392 | '(#:relocatable? #t))) |
| 375 | (check (gexp->derivation | 393 | (check (gexp->derivation |
| 376 | "check-appimage" | 394 | "check-appimage-with-localstatedir" |
| 377 | #~(begin | 395 | #~(begin |
| 378 | (invoke #$image))))) | 396 | (system* #$image "--appimage-extract-and-run" "-c" |
| 379 | (built-derivations (list check)))) | 397 | (object->string |
| 398 | `(call-with-output-file #$output | ||
| 399 | (lambda (port) | ||
| 400 | (display "Hello from Guile!\n" | ||
| 401 | port))))) | ||
| 402 | (system* #$image "--appimage-extract") | ||
| 403 | (exit (file-exists? "squashfs-root/var/guix/db/db.sqlite")))))) | ||
| 404 | (mbegin %store-monad | ||
| 405 | (built-derivations (list (pk 'APPIMAGE-drv check))) | ||
| 406 | (return (string=? (call-with-input-file (derivation->output-path check) | ||
| 407 | get-string-all) | ||
| 408 | "Hello from Guile!\n"))))) | ||
| 380 | 409 | ||
| 381 | (unless store (test-skip 1)) | 410 | (unless store (test-skip 1)) |
| 382 | (test-assertm "deb archive with symlinks and control files" | 411 | (test-assertm "deb archive with symlinks and control files" |
