GNU bug report logs - #77038
[PATCH 0/3] Update uftrace to v0.17 and enable its tests

Previous Next

Package: guix-patches;

Reported by: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>

Date: Sat, 15 Mar 2025 16:09:02 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77038 in the body.
You can then email your comments to 77038 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#77038; Package guix-patches. (Sat, 15 Mar 2025 16:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arseniy Zaostrovnykh <necto.ne <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 15 Mar 2025 16:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
Subject: [PATCH 0/3] Update uftrace to v0.17 and enable its tests
Date: Sat, 15 Mar 2025 14:44:48 +0100
Date: Sat, 15 Mar 2025 13:25:17 +0100
Message-ID: <cover.1742041517.git.necto.ne <at> gmail.com>
base-commit: 92124591eedf27e988c84f75acd4b4d99ff43122
From de35530f377cc2bcc3a68efa55d28ee3e42703fb Mon Sep 17 00:00:00 2001
This patch series takes care of updating uftrace to the most recent version
v0.17 and enables the run of all tests, not just the unit tests. To that end I
had to also add explicit dependencies on python and luajit because some tests
test this optional functionality.

uftrace loads the libpython and libluajit libraries dynamically with dlload,
which fails to find them in the user .guix-profile, so their /gnu/store paths
have to be hardcoded at the build stage. I made these depencencies, which are
arguable rather large, optional in a sense that a user can define a package
variant that excludes them and it will build properly. Let me know if there is
a better way to manage optional dependencies.

 gnu/packages/instrumentation.scm             | 67 ++++++++++++++------
 gnu/packages/patches/uftrace-fix-tests.patch | 32 ++++++++++
 2 files changed, 79 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/uftrace-fix-tests.patch

Arseniy Zaostrovnykh (3):
  gnu: uftrace: Enable python and lua scripting and fix tests
  gnu: uftrace: Update to 0.17
  gnu: uftrace: Make python and luajit inputs optional


-- 
2.48.1




Information forwarded to guix-patches <at> gnu.org:
bug#77038; Package guix-patches. (Sun, 16 Mar 2025 12:10:08 GMT) Full text and rfc822 format available.

Message #8 received at 77038 <at> debbugs.gnu.org (full text, mbox):

From: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
To: 77038 <at> debbugs.gnu.org
Cc: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
Subject: [PATCH 1/3] gnu: uftrace: Enable python and lua scripting and fix
 tests
Date: Sat, 15 Mar 2025 18:56:25 +0100
* gnu/packages/patches/uftrace-fix-tests.patch: New file
* gnu/packages/instrumentation.scm (uftrace): Enable scripting & fix tests
    [source]: use the new patch to fix some stale expectations
    <#:phases>: Adjust shebang embedded in onf of the tests and remove
    tests that expect network capability
    [inputs]: add python and luajit to enable uftrace script

Change-Id: Id3047753a1bb1e41e637004b4b8e4a4865bb3188
---
 gnu/packages/instrumentation.scm             | 34 +++++++++++++----
 gnu/packages/patches/uftrace-fix-tests.patch | 40 ++++++++++++++++++++
 2 files changed, 66 insertions(+), 8 deletions(-)
 create mode 100644 gnu/packages/patches/uftrace-fix-tests.patch

diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm
index b42aaa2e2f..b2d65f790e 100644
--- a/gnu/packages/instrumentation.scm
+++ b/gnu/packages/instrumentation.scm
@@ -577,7 +577,8 @@ (define-public uftrace
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
-               (base32 "0gk0hv3rnf5czvazz1prg21rf9qlniz42g5b389n8a29hqj4q6xr"))))
+               (base32 "0gk0hv3rnf5czvazz1prg21rf9qlniz42g5b389n8a29hqj4q6xr"))
+              (patches (search-patches "uftrace-fix-tests.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -587,10 +588,7 @@ (define-public uftrace
       #:make-flags
       #~(list
          (string-append "CC=" #$(cc-for-target)))
-      ;; runtest hangs at some point -- probably due to
-      ;; failed socket connection -- but we want to keep the
-      ;; unit tests.  Change the target to "test" when fixed.
-      #:test-target "unittest"
+      #:test-target "test"
       #:phases
       #~(modify-phases %standard-phases
           (replace 'configure
@@ -606,13 +604,34 @@ (define-public uftrace
                 (when target
                   (setenv "CROSS_COMPILE" (string-append target "-"))))
               (setenv "SHELL" (which "sh"))
+              (let ((python #$(this-package-input "python"))
+                    (luajit #$(this-package-input "luajit")))
+                (setenv "LDFLAGS" (string-append "-Wl," "-rpath=" python "/lib"
+                                                 ":" luajit "/lib")))
               (invoke "./configure"
                       (string-append "--prefix="
-                                     #$output)))))))
+                                     #$output))))
+          (add-before 'check 'fix-shebang
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "tests/t220_trace_script.py"
+                (("/bin/sh")
+                 (search-input-file inputs "bin/sh")))))
+          (add-after 'unpack 'delete-network-tests
+            (lambda _
+              ;; These tests require network capability (localhost)
+              (for-each delete-file
+                        '("tests/t141_recv_basic.py"
+                          "tests/t142_recv_multi.py"
+                          "tests/t143_recv_kernel.py"
+                          "tests/t150_recv_event.py"
+                          "tests/t151_recv_runcmd.py"
+                          "tests/t167_recv_sched.py")))))))
     (inputs
      (list capstone
            elfutils
            libunwind
+           python ;; libpython3.10.so for python scripting
+           luajit ;; libluajit-5.1.so for lua scripting
            ncurses))
     (native-inputs
      (list luajit
@@ -625,6 +644,5 @@ (define-public uftrace
 programs written in C/C++.  It is heavily inspired by the ftrace framework of
 the Linux kernel, while supporting userspace programs.  It supports various
 kind of commands and filters to help analysis of the program execution and
-performance.  It provides the command @command{uftrace}.  User that want to do
-scripting need to install python-3 or luajit in their profile.")
+performance.  It provides the command @command{uftrace}.")
     (license license:gpl2)))
diff --git a/gnu/packages/patches/uftrace-fix-tests.patch b/gnu/packages/patches/uftrace-fix-tests.patch
new file mode 100644
index 0000000000..c95610e308
--- /dev/null
+++ b/gnu/packages/patches/uftrace-fix-tests.patch
@@ -0,0 +1,40 @@
+Adjust test expectations to match the guix platform
+--- a/tests/t192_lib_name.py
++++ b/tests/t192_lib_name.py
+@@ -44,4 +44,4 @@ class TestCase(TestBase):
+         ver = v.split('\n')[0].split(') ')[1]
+         ver.strip()
+ 
+-        return re.sub("libc-[\d.]+.so", "libc-%s.so" % ver, result)
++        return re.sub("libc-2.26.so", "libc.so.6", result)
+--- a/tests/t251_exception4.py
++++ b/tests/t251_exception4.py
+@@ -5,16 +5,18 @@ from runtest import TestBase
+ class TestCase(TestBase):
+     def __init__(self):
+         TestBase.__init__(self, 'libexcept-main', lang='C++', result="""
+-# DURATION    TID     FUNCTION
+-            [423633] | main() {
+-            [423633] |   XXX::XXX() {
+-  30.679 us [423633] |     XXX::XXX();
+-  31.490 us [423633] |   } /* XXX::XXX */
+-            [423633] |   YYY::YYY() {
+-   0.509 us [423633] |     __cxa_allocate_exception();
+-   0.541 us [423633] |     std::runtime_error::runtime_error();
+-   5.670 us [423633] |   } /* YYY::YYY */
+-  42.354 us [423633] | } /* main */
++# DURATION     TID     FUNCTION
++            [ 39887] | main() {
++            [ 39887] |   XXX::XXX() {
++  35.591 us [ 39887] |     XXX::XXX();
++  36.215 us [ 39887] |   } /* XXX::XXX */
++   5.617 us [ 39887] |   std::runtime_error::~runtime_error();
++            [ 39887] |   YYY::YYY() {
++   0.291 us [ 39887] |     __cxa_allocate_exception();
++   0.399 us [ 39887] |     std::runtime_error::runtime_error();
++   3.683 us [ 39887] |   } /* YYY::YYY */
++   0.122 us [ 39887] |   std::runtime_error::~runtime_error();
++  48.809 us [ 39887] | } /* main */
+ """)
+ 
+     def build(self, name, cflags='', ldflags=''):
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77038; Package guix-patches. (Sun, 16 Mar 2025 12:10:09 GMT) Full text and rfc822 format available.

Message #11 received at 77038 <at> debbugs.gnu.org (full text, mbox):

From: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
To: 77038 <at> debbugs.gnu.org
Cc: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
Subject: [PATCH 2/3] gnu: uftrace: Update to 0.17
Date: Sat, 15 Mar 2025 18:56:26 +0100
* gnu/packages/instrumentation.scm (uftrace): Update to 0.17
* gnu/packages/patches/uftrace-fix-tests.patch: Drop the patch for
t192_lib_name.py that has been fixed in the mean time

Change-Id: I80dc540adabbbbbec8ac5f0c096e7e973e230b27
---
 gnu/packages/instrumentation.scm             | 4 ++--
 gnu/packages/patches/uftrace-fix-tests.patch | 8 --------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm
index b2d65f790e..05e74b6f4f 100644
--- a/gnu/packages/instrumentation.scm
+++ b/gnu/packages/instrumentation.scm
@@ -569,7 +569,7 @@ (define-public systemtap
 (define-public uftrace
   (package
     (name "uftrace")
-    (version "0.11")
+    (version "0.17")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -577,7 +577,7 @@ (define-public uftrace
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
-               (base32 "0gk0hv3rnf5czvazz1prg21rf9qlniz42g5b389n8a29hqj4q6xr"))
+               (base32 "0p1iy70hc4vl3j16j9vvlh5amvk06l3m35iic2crpavm240dw7y7"))
               (patches (search-patches "uftrace-fix-tests.patch"))))
     (build-system gnu-build-system)
     (arguments
diff --git a/gnu/packages/patches/uftrace-fix-tests.patch b/gnu/packages/patches/uftrace-fix-tests.patch
index c95610e308..0253ed2616 100644
--- a/gnu/packages/patches/uftrace-fix-tests.patch
+++ b/gnu/packages/patches/uftrace-fix-tests.patch
@@ -1,12 +1,4 @@
 Adjust test expectations to match the guix platform
---- a/tests/t192_lib_name.py
-+++ b/tests/t192_lib_name.py
-@@ -44,4 +44,4 @@ class TestCase(TestBase):
-         ver = v.split('\n')[0].split(') ')[1]
-         ver.strip()
- 
--        return re.sub("libc-[\d.]+.so", "libc-%s.so" % ver, result)
-+        return re.sub("libc-2.26.so", "libc.so.6", result)
 --- a/tests/t251_exception4.py
 +++ b/tests/t251_exception4.py
 @@ -5,16 +5,18 @@ from runtest import TestBase
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77038; Package guix-patches. (Sun, 16 Mar 2025 12:10:11 GMT) Full text and rfc822 format available.

Message #14 received at 77038 <at> debbugs.gnu.org (full text, mbox):

From: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
To: 77038 <at> debbugs.gnu.org
Cc: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
Subject: [PATCH 3/3] gnu: uftrace: Make python and luajit inputs optional
Date: Sat, 15 Mar 2025 18:56:27 +0100
gnu/packages/instrumentation.scm (uftrace): Make scripting inputs
optional. If user removes these inputs they will still be able to enjoy
uftrace except for the scripting part.

Change-Id: Ice8f9ce8aba38322ff34a38f112512186bd98c1d
---
 gnu/packages/instrumentation.scm | 47 +++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm
index 05e74b6f4f..09314519a9 100644
--- a/gnu/packages/instrumentation.scm
+++ b/gnu/packages/instrumentation.scm
@@ -604,10 +604,22 @@ (define-public uftrace
                 (when target
                   (setenv "CROSS_COMPILE" (string-append target "-"))))
               (setenv "SHELL" (which "sh"))
-              (let ((python #$(this-package-input "python"))
-                    (luajit #$(this-package-input "luajit")))
-                (setenv "LDFLAGS" (string-append "-Wl," "-rpath=" python "/lib"
-                                                 ":" luajit "/lib")))
+              (let* ((python #$(this-package-input "python"))
+                     (luajit #$(this-package-input "luajit"))
+                     (libs (cond
+                             ((and python luajit)
+                              (list "-Wl,-rpath="
+                                    python
+                                    "/lib"
+                                    ":"
+                                    luajit
+                                    "/lib"))
+                             (python (list "-Wl,-rpath=" python "/lib"))
+                             (luajit (list "-Wl,-rpath=" luajit "/lib"))
+                             (#t #f))))
+                (when libs
+                  (setenv "LDFLAGS"
+                          (apply string-append libs))))
               (invoke "./configure"
                       (string-append "--prefix="
                                      #$output))))
@@ -616,7 +628,7 @@ (define-public uftrace
               (substitute* "tests/t220_trace_script.py"
                 (("/bin/sh")
                  (search-input-file inputs "bin/sh")))))
-          (add-after 'unpack 'delete-network-tests
+          (add-before 'check 'delete-network-tests
             (lambda _
               ;; These tests require network capability (localhost)
               (for-each delete-file
@@ -626,23 +638,20 @@ (define-public uftrace
                           "tests/t150_recv_event.py"
                           "tests/t151_recv_runcmd.py"
                           "tests/t167_recv_sched.py")))))))
-    (inputs
-     (list capstone
-           elfutils
-           libunwind
-           python ;; libpython3.10.so for python scripting
-           luajit ;; libluajit-5.1.so for lua scripting
-           ncurses))
-    (native-inputs
-     (list luajit
-           pandoc
-           pkg-config
-           python-wrapper))
+    (inputs (list capstone
+                  elfutils
+                  libunwind
+                  python ;(optional) libpython3.10.so for python scripting
+                  luajit ;(optional) libluajit-5.1.so for lua scripting
+                  ncurses))
+    (native-inputs (list luajit pandoc pkg-config python-wrapper))
     (home-page "https://github.com/namhyung/uftrace")
     (synopsis "Function graph tracer for C/C++/Rust")
-    (description "uftrace is a tool for tracing and analyzing the execution of
+    (description
+     "uftrace is a tool for tracing and analyzing the execution of
 programs written in C/C++.  It is heavily inspired by the ftrace framework of
 the Linux kernel, while supporting userspace programs.  It supports various
 kind of commands and filters to help analysis of the program execution and
-performance.  It provides the command @command{uftrace}.")
+performance.  It provides the command @command{uftrace}.  By default, it is
+bundled with python-3 and luajit that you can delete in a package variant.")
     (license license:gpl2)))
-- 
2.48.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 02 Apr 2025 14:54:02 GMT) Full text and rfc822 format available.

Notification sent to Arseniy Zaostrovnykh <necto.ne <at> gmail.com>:
bug acknowledged by developer. (Wed, 02 Apr 2025 14:54:02 GMT) Full text and rfc822 format available.

Message #19 received at 77038-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Arseniy Zaostrovnykh <necto.ne <at> gmail.com>
Cc: 77038-done <at> debbugs.gnu.org
Subject: Re: [bug#77038] [PATCH 0/3] Update uftrace to v0.17 and enable its
 tests
Date: Wed, 02 Apr 2025 16:53:34 +0200
Hi,

Arseniy Zaostrovnykh <necto.ne <at> gmail.com> skribis:

>   gnu: uftrace: Enable python and lua scripting and fix tests
>   gnu: uftrace: Update to 0.17
>   gnu: uftrace: Make python and luajit inputs optional

Applied.  I modified the first patch to add ‘uftrace-fix-tests.patch’ to
‘gnu/local.mk’.

Thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 01 May 2025 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 107 days ago.

Previous Next


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