summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseniy Zaostrovnykh <necto.ne@gmail.com>2025-03-15 18:56:25 +0100
committerLudovic Courtès <ludo@gnu.org>2025-04-02 20:50:14 +0200
commit6b10633062931e7fc765824012f7cd57e97efd73 (patch)
treee2603ffa48cb099e3a6de7640acbae90341d0f97
parent3237806a39a9fbff3f17341e029ca0de64ad8467 (diff)
gnu: uftrace: Enable python and lua scripting and fix tests.
* gnu/packages/patches/uftrace-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * 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 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Modified-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/instrumentation.scm34
-rw-r--r--gnu/packages/patches/uftrace-fix-tests.patch40
3 files changed, 67 insertions, 8 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 8a5f38f4bb7..acc1a2bfa74 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2341,6 +2341,7 @@ dist_patch_DATA = \
%D%/packages/patches/u-boot-nintendo-nes-serial.patch \
%D%/packages/patches/u-boot-rockchip-inno-usb.patch \
%D%/packages/patches/ucx-tcp-iface-ioctl.patch \
+ %D%/packages/patches/uftrace-fix-tests.patch \
%D%/packages/patches/ultrastar-deluxe-no-freesans.patch \
%D%/packages/patches/ungoogled-chromium-extension-search-path.patch \
%D%/packages/patches/ungoogled-chromium-ffmpeg-compat.patch \
diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm
index b42aaa2e2fa..b2d65f790e4 100644
--- a/gnu/packages/instrumentation.scm
+++ b/gnu/packages/instrumentation.scm
@@ -577,7 +577,8 @@ whole-system symbolic access, and can also handle simple tracing jobs.")
(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 @@ whole-system symbolic access, and can also handle simple tracing jobs.")
#: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 @@ whole-system symbolic access, and can also handle simple tracing jobs.")
(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 @@ whole-system symbolic access, and can also handle simple tracing jobs.")
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 00000000000..c95610e308a
--- /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=''):