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.

Full log


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





This bug report was last modified 111 days ago.

Previous Next


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