unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#74670] [PATCH] tests: pack: Fix AppImage tests.
@ 2024-12-03 15:13 Noé Lopez via Guix-patches via
  2024-12-12 21:58 ` Ludovic Courtès
  2024-12-12 21:59 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Noé Lopez via Guix-patches via @ 2024-12-03 15:13 UTC (permalink / raw)
  To: 74670; +Cc: Noé Lopez, Ludovic Courtès

From: Noé Lopez <noelopez@free.fr>

* tests/pack.scm: Add glibc to AppImage tests’ profiles.

Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c
---
Hi,

This patch fixes the tests failing for AppImage pack.  I believe the issue was
that without the AppImage runtime (--appimage-extract-and-run), the glibc is
not available to the AppRun binary, causing a file not found error.

This is an issue caused because AppRun is built using the relocatable runtime,
which requires (or at least is built with) the glibc.

This is not an issue when using the AppImage runtime with FUSE, since it
correctly mounts the store payload before starting the AppRun.

Have a nice day,
Noé

 tests/pack.scm | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/tests/pack.scm b/tests/pack.scm
index 1c1e312557..2cb643f136 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017-2021, 2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2023 Oleg Pykhalov <go.wigust@gmail.com>
@@ -34,7 +34,7 @@ (define-module (test-pack)
   #:use-module ((guix build utils) #:select (%store-directory))
   #:use-module (gnu packages)
   #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target
-                                              hello))
+                                              hello glibc))
   #:use-module (gnu packages bootstrap)
   #:use-module ((gnu packages package-management) #:select (rpm))
   #:use-module ((gnu packages compression) #:select (squashfs-tools))
@@ -347,36 +347,53 @@ (define rpm-for-tests
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile -> (profile
-                      (content (packages->manifest (list %bootstrap-guile hello)))
+                      (content (packages->manifest (list %bootstrap-guile hello glibc)))
                       (hooks '())
                       (locales? #f)))
          (image   (self-contained-appimage "hello-appimage" profile
                                            #:entry-point "bin/hello"
                                            #:extra-options
-                                           (list #:relocatable? #t)))
+                                           '(#:relocatable? #t)))
          (check   (gexp->derivation
                    "check-appimage"
-                   #~(invoke #$image))))
-      (built-derivations (list check))))
+                   (with-imported-modules '((guix build utils))
+                     #~(begin
+                         (use-modules (ice-9 popen)
+                                      (guix build utils))
+                         (let ((pipe (open-pipe* OPEN_READ
+                                                 #$image "--appimage-extract-and-run")))
+                           (call-with-output-file #$output
+                             (lambda (port)
+                               (dump-port pipe port)))
+                           (exit (status:exit-val (close-pipe pipe)))))))))
+      (built-derivations (list (pk 'APPIMAGE-drv check)))))
 
   (unless store (test-skip 1))
   (test-assertm "appimage + localstatedir"
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile -> (profile
-                      (content (packages->manifest (list %bootstrap-guile hello)))
+                      (content (packages->manifest (list %bootstrap-guile hello glibc)))
                       (hooks '())
                       (locales? #f)))
          (image   (self-contained-appimage "hello-appimage" profile
                                            #:entry-point "bin/hello"
                                            #:localstatedir? #t
                                            #:extra-options
-                                           (list #:relocatable? #t)))
+                                           '(#:relocatable? #t)))
          (check   (gexp->derivation
                    "check-appimage"
-                   #~(begin
-                       (invoke #$image)))))
-      (built-derivations (list check))))
+                   (with-imported-modules '((guix build utils))
+                     #~(begin
+                         (use-modules (ice-9 popen)
+                                      (guix build utils))
+                         (let ((pipe (open-pipe* OPEN_READ
+                                                 #$image "--appimage-extract-and-run")))
+                           (call-with-output-file #$output
+                             (lambda (port)
+                               (dump-port pipe port)))
+                           (exit (status:exit-val (close-pipe pipe)))))))))
+      (built-derivations (list (pk 'APPIMAGE-drv check)))))
 
   (unless store (test-skip 1))
   (test-assertm "deb archive with symlinks and control files"

base-commit: bb8a6f0ac47296d3a18e1e0a26ea3a833eb77c4a
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#74670] [PATCH] tests: pack: Fix AppImage tests.
  2024-12-03 15:13 [bug#74670] [PATCH] tests: pack: Fix AppImage tests Noé Lopez via Guix-patches via
@ 2024-12-12 21:58 ` Ludovic Courtès
  2024-12-12 21:59 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2024-12-12 21:58 UTC (permalink / raw)
  To: Noé Lopez; +Cc: 74670

[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]

Hi Noé,

Noé Lopez <noe@noé.eu> skribis:

> From: Noé Lopez <noelopez@free.fr>
>
> * tests/pack.scm: Add glibc to AppImage tests’ profiles.
>
> Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c
> ---
> Hi,
>
> This patch fixes the tests failing for AppImage pack.  I believe the issue was
> that without the AppImage runtime (--appimage-extract-and-run), the glibc is
> not available to the AppRun binary, causing a file not found error.
>
> This is an issue caused because AppRun is built using the relocatable runtime,
> which requires (or at least is built with) the glibc.

Hmm, that further limits the applicability of AppImage, but OK.  (Not
our fault!)

I noticed that the tests were not going very far, so I tried the patch
below to: (1) check the output of ‘hello’ in the first test, (2) change
the second test to check for the existence of /var/guix/db/db.sqlite.

The second test doesn’t work though, because where’s that file supposed
to live?  The image is apparently extracted in an unguessable directory,
so cannot tell where it is.  Am I right?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4798 bytes --]

diff --git a/tests/pack.scm b/tests/pack.scm
index 2cb643f136..7fcae1ec1f 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -39,9 +39,10 @@ (define-module (test-pack)
   #:use-module ((gnu packages package-management) #:select (rpm))
   #:use-module ((gnu packages compression) #:select (squashfs-tools))
   #:use-module ((gnu packages debian) #:select (dpkg))
-  #:use-module ((gnu packages guile) #:select (guile-sqlite3))
+  #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0))
   #:use-module ((gnu packages gnupg) #:select (guile-gcrypt))
   #:use-module ((gnu packages linux) #:select (fakeroot))
+  #:use-module ((ice-9 textual-ports) #:select (get-string-all))
   #:use-module (srfi srfi-64))
 
 (define %store
@@ -347,7 +348,9 @@ (define rpm-for-tests
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile -> (profile
-                      (content (packages->manifest (list %bootstrap-guile hello glibc)))
+                      ;; When using '--appimage-extract-and-run', the dynamic
+                      ;; linker is necessary, hence glibc below.
+                      (content (packages->manifest (list hello glibc)))
                       (hooks '())
                       (locales? #f)))
          (image   (self-contained-appimage "hello-appimage" profile
@@ -366,34 +369,46 @@ (define rpm-for-tests
                              (lambda (port)
                                (dump-port pipe port)))
                            (exit (status:exit-val (close-pipe pipe)))))))))
-      (built-derivations (list (pk 'APPIMAGE-drv check)))))
+      (mbegin %store-monad
+        (built-derivations (list (pk 'APPIMAGE-drv check)))
+        (return (string=? (call-with-input-file (derivation->output-path check)
+                            get-string-all)
+                          "Hello, world!\n")))))
 
   (unless store (test-skip 1))
   (test-assertm "appimage + localstatedir"
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile -> (profile
-                      (content (packages->manifest (list %bootstrap-guile hello glibc)))
+                      ;; When using '--appimage-extract-and-run', the dynamic
+                      ;; linker is necessary, hence glibc below.
+                      (content (packages->manifest (list guile-3.0 glibc)))
                       (hooks '())
                       (locales? #f)))
-         (image   (self-contained-appimage "hello-appimage" profile
-                                           #:entry-point "bin/hello"
+         (image   (self-contained-appimage "guile-appimage" profile
+                                           #:entry-point "bin/guile"
                                            #:localstatedir? #t
                                            #:extra-options
                                            '(#:relocatable? #t)))
          (check   (gexp->derivation
-                   "check-appimage"
-                   (with-imported-modules '((guix build utils))
-                     #~(begin
-                         (use-modules (ice-9 popen)
-                                      (guix build utils))
-                         (let ((pipe (open-pipe* OPEN_READ
-                                                 #$image "--appimage-extract-and-run")))
-                           (call-with-output-file #$output
-                             (lambda (port)
-                               (dump-port pipe port)))
-                           (exit (status:exit-val (close-pipe pipe)))))))))
-      (built-derivations (list (pk 'APPIMAGE-drv check)))))
+                   "check-appimage-with-localstatedir"
+                   #~(begin
+                       (system* #$image "--appimage-extract-and-run" "-c"
+                                (object->string
+                                 `(call-with-output-file #$output
+                                    (lambda (port)
+                                      (display "Hello from Guile!\n"
+                                               port)))))
+                       (execl #$image #$image "--appimage-extract-and-run" "-c"
+                              (object->string
+                               '(exit
+                                 (pk 'db? (getcwd)
+                                     (file-exists? "var/guix/db/db.sqlite")))))))))
+      (mbegin %store-monad
+        (built-derivations (list (pk 'APPIMAGE-drv check)))
+        (return (string=? (call-with-input-file (derivation->output-path check)
+                            get-string-all)
+                          "Hello from Guile!\n")))))
 
   (unless store (test-skip 1))
   (test-assertm "deb archive with symlinks and control files"

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#74670] [PATCH] tests: pack: Fix AppImage tests.
  2024-12-03 15:13 [bug#74670] [PATCH] tests: pack: Fix AppImage tests Noé Lopez via Guix-patches via
  2024-12-12 21:58 ` Ludovic Courtès
@ 2024-12-12 21:59 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2024-12-12 21:59 UTC (permalink / raw)
  To: Noé Lopez; +Cc: 74670

[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]

Hi Noé,

Noé Lopez <noe@noé.eu> skribis:

> From: Noé Lopez <noelopez@free.fr>
>
> * tests/pack.scm: Add glibc to AppImage tests’ profiles.
>
> Change-Id: I7890b902f65a2944ae8fa03db8a964deda3c725c
> ---
> Hi,
>
> This patch fixes the tests failing for AppImage pack.  I believe the issue was
> that without the AppImage runtime (--appimage-extract-and-run), the glibc is
> not available to the AppRun binary, causing a file not found error.
>
> This is an issue caused because AppRun is built using the relocatable runtime,
> which requires (or at least is built with) the glibc.

Hmm, that further limits the applicability of AppImage, but OK.  (Not
our fault!)

I noticed that the tests were not going very far, so I tried the patch
below to: (1) check the output of ‘hello’ in the first test, (2) change
the second test to check for the existence of /var/guix/db/db.sqlite.

The second test doesn’t work though, because where’s that file supposed
to live?  The image is apparently extracted in an unguessable directory,
so cannot tell where it is.  Am I right?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4798 bytes --]

diff --git a/tests/pack.scm b/tests/pack.scm
index 2cb643f136..7fcae1ec1f 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -39,9 +39,10 @@ (define-module (test-pack)
   #:use-module ((gnu packages package-management) #:select (rpm))
   #:use-module ((gnu packages compression) #:select (squashfs-tools))
   #:use-module ((gnu packages debian) #:select (dpkg))
-  #:use-module ((gnu packages guile) #:select (guile-sqlite3))
+  #:use-module ((gnu packages guile) #:select (guile-sqlite3 guile-3.0))
   #:use-module ((gnu packages gnupg) #:select (guile-gcrypt))
   #:use-module ((gnu packages linux) #:select (fakeroot))
+  #:use-module ((ice-9 textual-ports) #:select (get-string-all))
   #:use-module (srfi srfi-64))
 
 (define %store
@@ -347,7 +348,9 @@ (define rpm-for-tests
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile -> (profile
-                      (content (packages->manifest (list %bootstrap-guile hello glibc)))
+                      ;; When using '--appimage-extract-and-run', the dynamic
+                      ;; linker is necessary, hence glibc below.
+                      (content (packages->manifest (list hello glibc)))
                       (hooks '())
                       (locales? #f)))
          (image   (self-contained-appimage "hello-appimage" profile
@@ -366,34 +369,46 @@ (define rpm-for-tests
                              (lambda (port)
                                (dump-port pipe port)))
                            (exit (status:exit-val (close-pipe pipe)))))))))
-      (built-derivations (list (pk 'APPIMAGE-drv check)))))
+      (mbegin %store-monad
+        (built-derivations (list (pk 'APPIMAGE-drv check)))
+        (return (string=? (call-with-input-file (derivation->output-path check)
+                            get-string-all)
+                          "Hello, world!\n")))))
 
   (unless store (test-skip 1))
   (test-assertm "appimage + localstatedir"
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile -> (profile
-                      (content (packages->manifest (list %bootstrap-guile hello glibc)))
+                      ;; When using '--appimage-extract-and-run', the dynamic
+                      ;; linker is necessary, hence glibc below.
+                      (content (packages->manifest (list guile-3.0 glibc)))
                       (hooks '())
                       (locales? #f)))
-         (image   (self-contained-appimage "hello-appimage" profile
-                                           #:entry-point "bin/hello"
+         (image   (self-contained-appimage "guile-appimage" profile
+                                           #:entry-point "bin/guile"
                                            #:localstatedir? #t
                                            #:extra-options
                                            '(#:relocatable? #t)))
          (check   (gexp->derivation
-                   "check-appimage"
-                   (with-imported-modules '((guix build utils))
-                     #~(begin
-                         (use-modules (ice-9 popen)
-                                      (guix build utils))
-                         (let ((pipe (open-pipe* OPEN_READ
-                                                 #$image "--appimage-extract-and-run")))
-                           (call-with-output-file #$output
-                             (lambda (port)
-                               (dump-port pipe port)))
-                           (exit (status:exit-val (close-pipe pipe)))))))))
-      (built-derivations (list (pk 'APPIMAGE-drv check)))))
+                   "check-appimage-with-localstatedir"
+                   #~(begin
+                       (system* #$image "--appimage-extract-and-run" "-c"
+                                (object->string
+                                 `(call-with-output-file #$output
+                                    (lambda (port)
+                                      (display "Hello from Guile!\n"
+                                               port)))))
+                       (execl #$image #$image "--appimage-extract-and-run" "-c"
+                              (object->string
+                               '(exit
+                                 (pk 'db? (getcwd)
+                                     (file-exists? "var/guix/db/db.sqlite")))))))))
+      (mbegin %store-monad
+        (built-derivations (list (pk 'APPIMAGE-drv check)))
+        (return (string=? (call-with-input-file (derivation->output-path check)
+                            get-string-all)
+                          "Hello from Guile!\n")))))
 
   (unless store (test-skip 1))
   (test-assertm "deb archive with symlinks and control files"

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-03 15:13 [bug#74670] [PATCH] tests: pack: Fix AppImage tests Noé Lopez via Guix-patches via
2024-12-12 21:58 ` Ludovic Courtès
2024-12-12 21:59 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).