GNU bug report logs - #74670
[PATCH] tests: pack: Fix AppImage tests.

Previous Next

Package: guix-patches;

Reported by: Noé Lopez <noe <at> xn--no-cja.eu>

Date: Tue, 3 Dec 2024 15:13:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Noé Lopez <noe <at> xn--no-cja.eu>
Subject: bug#74670: closed (Re: [bug#74670] [PATCH v4 0/2] tests: pack:
 Fix AppImage tests.)
Date: Fri, 24 Jan 2025 22:53:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#74670: [PATCH] tests: pack: Fix AppImage tests.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 74670 <at> debbugs.gnu.org.

-- 
74670: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74670
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Noé Lopez <noe <at> xn--no-cja.eu>
Cc: 74670-done <at> debbugs.gnu.org, Noé Lopez <noelopez <at> free.fr>
Subject: Re: [bug#74670] [PATCH v4 0/2] tests: pack: Fix AppImage tests.
Date: Fri, 24 Jan 2025 23:52:35 +0100
[Message part 3 (text/plain, inline)]
Hi,

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

> Here is a working version of the tests, though I don’t really understand why
> the tests are GEXPs?

The tests build derivations, each of which runs Guile code; that Guile
code is represented as gexps because it is staged to be executed when
those derivations get built.

> What is the point of using #$output and checking outside of the gexp instead
> of just using assert? And why do I need to use #$output in order for the test
> to run?

If you do (gexp->derivation "foo" #~(display "hi!")), you end up with a
derivation with zero outputs.  In that case, its builder is never
executed because we know in advance that it won’t produce anything.

If you do (gexp->derivation "bar" #~(pk #$output)), then the resulting
derivation has one output, “out”.

>   pack: Support localstatedir in AppImage format.
>   tests: pack: Improve AppImage tests.

Applied with the cosmetic change below.

Thanks!

Ludo’.

[Message part 4 (text/x-patch, inline)]
diff --git a/tests/pack.scm b/tests/pack.scm
index 1651fa4440..9c7e0a50ba 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -393,7 +393,6 @@ (define rpm-for-tests
          (check   (gexp->derivation
                    "check-appimage-with-localstatedir"
                    #~(begin
-                       (use-modules (rnrs base))
                        (system* #$image "--appimage-extract-and-run" "-c"
                                 (object->string
                                  `(call-with-output-file #$output
@@ -401,7 +400,7 @@ (define rpm-for-tests
                                       (display "Hello from Guile!\n"
                                                port)))))
                        (system* #$image "--appimage-extract")
-                       (assert (file-exists? "squashfs-root/var/guix/db/db.sqlite"))))))
+                       (exit (file-exists? "squashfs-root/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)
[Message part 5 (message/rfc822, inline)]
From: Noé Lopez <noe <at> xn--no-cja.eu>
To: guix-patches <at> gnu.org
Cc: Noé Lopez <noe <at> xn--no-cja.eu>
Subject: [PATCH] tests: pack: Fix AppImage tests.
Date: Tue,  3 Dec 2024 16:13:24 +0100
From: Noé Lopez <noelopez <at> 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 <at> gnu.org>
+;;; Copyright © 2017-2021, 2023, 2024 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2021, 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2023 Oleg Pykhalov <go.wigust <at> 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




This bug report was last modified 115 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.