Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Mattias Ellert
e8626580cf Fixes for gcc 16 2026-01-12 00:03:45 +01:00
Mattias Ellert
27b349be2a Fix test for stricter syntax in numpy 2.4.0 (backport) 2025-12-25 17:38:55 +01:00
5 changed files with 205 additions and 8 deletions

View file

@ -0,0 +1,82 @@
From d5135f7869406396b3ba8e944c71dbdd67d3ea01 Mon Sep 17 00:00:00 2001
From: Jonas Rembser <jonas.rembser@cern.ch>
Date: Tue, 23 Dec 2025 19:04:45 +0100
Subject: [PATCH] [Python] Fix TF1 Pythonization test for NumPy 2.4.0
The new NumPy 2.4.0 is more strict when implicitly converting 1-element
arrays to scalars. It doesn't do that anymore, causing the TF1
Pythonization tests to fail (see log below).
This actually pointed to a real mistake in setting up the test, where a
2D array was used to define the TFormula parameters while it should be a
1D array.
```txt
962/3718 Test #93: pyunittests-bindings-pyroot-pythonizations-pyroot-pyz-tf-pycallables ..............................***Failed 3.05 sec
test_callable (tf_pycallables.TF1.test_callable)
Test function provided as callable ... ok
test_evalpar (tf_pycallables.TF1.test_evalpar)
Test the 2D Numpy array pythonizations for TF1::EvalPar ... ERROR
test_evalpar_dynamic (tf_pycallables.TF1.test_evalpar_dynamic)
Test the 2D NumPy pythonizations with dynamic TF1 data dimensions ... ok
test_fitgauss (tf_pycallables.TF1.test_fitgauss)
Test fitting a histogram to a Python function ... ok
test_identity (tf_pycallables.TF1.test_identity)
Test simple function without parameters ... ok
test_params (tf_pycallables.TF1.test_params)
Test function with parameters ... ok
test_params (tf_pycallables.TF2.test_params)
Test function with parameters ... ok
test_params (tf_pycallables.TF3.test_params)
Test function with parameters ... ok
======================================================================
ERROR: test_evalpar (tf_pycallables.TF1.test_evalpar)
Test the 2D Numpy array pythonizations for TF1::EvalPar
----------------------------------------------------------------------
Traceback (most recent call last):
File "/github/home/ROOT-CI/src/bindings/pyroot/pythonizations/test/tf_pycallables.py", line 129, in test_evalpar
expected_value = pyf_tf1_coulomb(x[i, ::2], params)
File "/github/home/ROOT-CI/src/bindings/pyroot/pythonizations/test/tf_pycallables.py", line 33, in pyf_tf1_coulomb
return p[1] * x[0] * x[1] / (p[0]**2) * math.exp(-p[2] / p[0])
~~~~~~~~^^^^^^^^^^^^^^
TypeError: only 0-dimensional arrays can be converted to Python scalars
----------------------------------------------------------------------
Ran 8 tests in 1.469s
FAILED (errors=1)
CMake Error at /github/home/ROOT-CI/src/cmake/modules/RootTestDriver.cmake:232 (message):
error code: 1
```
---
.../pyroot/pythonizations/test/tf_pycallables.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/bindings/pyroot/pythonizations/test/tf_pycallables.py b/bindings/pyroot/pythonizations/test/tf_pycallables.py
index 2a7d6b72462..5a223030ec9 100644
--- a/bindings/pyroot/pythonizations/test/tf_pycallables.py
+++ b/bindings/pyroot/pythonizations/test/tf_pycallables.py
@@ -116,11 +116,13 @@ class TF1(unittest.TestCase):
[3.0, 10, 4.0]
])
- params = np.array([
- [1.0], # Distance between charges r
- [8.99e9], # Coulomb constant k (in N·m²/C²)
- [0.1] # Additional factor for modulation
- ])
+ params = np.array(
+ [
+ 1.0, # Distance between charges r
+ 8.99e9, # Coulomb constant k (in N·m²/C²)
+ 0.1, # Additional factor for modulation
+ ]
+ )
# Slice to avoid the dummy column of 10's
res = rtf1_coulomb.EvalPar(x[:, ::2], params)
--
2.52.0

View file

@ -0,0 +1,50 @@
From e1f42658629ad67ce7cb224a1379d133f61f2e35 Mon Sep 17 00:00:00 2001
From: Jonas Rembser <jonas.rembser@cern.ch>
Date: Sun, 11 Jan 2026 10:25:51 +0100
Subject: [PATCH] [RF] Use TRandom3 in test RooFuncWrapper
Use TRandom3 instead of the `<random>` to get compiler-independent,
reproducible behavior.
---
roofit/roofitcore/test/testRooFuncWrapper.cxx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/roofit/roofitcore/test/testRooFuncWrapper.cxx b/roofit/roofitcore/test/testRooFuncWrapper.cxx
index 2ebdf95333f..189e8f2e266 100644
--- a/roofit/roofitcore/test/testRooFuncWrapper.cxx
+++ b/roofit/roofitcore/test/testRooFuncWrapper.cxx
@@ -34,12 +34,12 @@
#include <RooWorkspace.h>
#include <ROOT/StringUtils.hxx>
+#include <TMath.h>
#include <TROOT.h>
+#include <TRandom3.h>
#include <TSystem.h>
-#include <TMath.h>
#include <functional>
-#include <random>
#include "gtest_wrapper.h"
@@ -66,13 +66,13 @@ double getNumDerivative(const RooAbsReal &pdf, RooRealVar &var, const RooArgSet
void randomizeParameters(const RooArgSet &parameters)
{
+ TRandom3 rng(1337);
+
double lowerBound = -0.1;
double upperBound = 0.1;
- std::uniform_real_distribution<double> unif(lowerBound, upperBound);
- std::default_random_engine re;
for (auto *param : parameters) {
- double mul = unif(re);
+ double mul = rng.Uniform(lowerBound, upperBound);
auto par = dynamic_cast<RooAbsRealLValue *>(param);
if (!par)
--
2.52.0

View file

@ -1,4 +1,4 @@
From b5735870eb7e65a8c840643540a0676ab40697e0 Mon Sep 17 00:00:00 2001
From 4d450f306a8ab8220f43675c70f399d89e5a4a03 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Sat, 11 May 2024 20:09:47 +0200
Subject: [PATCH] Use system fonts via fontconfig
@ -9,13 +9,13 @@ Subject: [PATCH] Use system fonts via fontconfig
graf2d/asimage/src/TASImage.cxx | 91 +++++++-
graf2d/graf/CMakeLists.txt | 1 +
graf2d/graf/inc/TTF.h | 3 +-
graf2d/graf/src/TTF.cxx | 291 +++++++++++++++++---------
graf2d/graf/src/TTF.cxx | 295 +++++++++++++++++---------
graf2d/postscript/CMakeLists.txt | 1 +
graf2d/postscript/src/TPostScript.cxx | 106 +++++-----
graf2d/postscript/src/TPostScript.cxx | 106 ++++-----
graf3d/gl/CMakeLists.txt | 1 +
graf3d/gl/src/TGLFontManager.cxx | 123 ++++++++++-
graf3d/gl/src/TGLText.cxx | 56 +++--
11 files changed, 493 insertions(+), 192 deletions(-)
11 files changed, 495 insertions(+), 194 deletions(-)
diff --git a/core/base/src/TApplication.cxx b/core/base/src/TApplication.cxx
index f0d2124a8f6..41ad4c73020 100644
@ -207,7 +207,7 @@ index 864ce06b4f0..050796d1ded 100644
static TTF::TTGlyph fgGlyphs[kMaxGlyphs]; ///< glyphs
static Bool_t fgHinting; ///< use hinting (true by default)
diff --git a/graf2d/graf/src/TTF.cxx b/graf2d/graf/src/TTF.cxx
index 758bb98c192..7b1b06cd0ed 100644
index 758bb98c192..c90d0ac70a9 100644
--- a/graf2d/graf/src/TTF.cxx
+++ b/graf2d/graf/src/TTF.cxx
@@ -25,6 +25,8 @@ Interface to the freetype 2 library.
@ -453,9 +453,12 @@ index 758bb98c192..7b1b06cd0ed 100644
Error("TTF::SetTextFont", "error loading font %s", ttfont);
delete [] ttfont;
if (tface) FT_Done_Face(tface);
@@ -453,19 +573,20 @@ Int_t TTF::SetTextFont(const char *fontname, Int_t italic)
delete [] ttfont;
@@ -450,24 +570,25 @@ Int_t TTF::SetTextFont(const char *fontname, Int_t italic)
}
}
- delete [] ttfont;
-
fgFontName[fgFontCount] = StrDup(basename);
+ fgFontIdx[fgFontCount] = ttindex;
+ fgFontIta[fgFontCount] = italic;
@ -476,7 +479,11 @@ index 758bb98c192..7b1b06cd0ed 100644
+ FT_Set_Transform( fgFace[fgCurFontIdx], &slantMat, nullptr );
}
+ delete [] ttfont;
+
return 0;
}
@@ -494,70 +615,50 @@ Int_t TTF::SetTextFont(const char *fontname, Int_t italic)
void TTF::SetTextFont(Font_t fontnumber)

View file

@ -0,0 +1,32 @@
From 7b1632f5602a1bb6e6278d66c25640349c852ab1 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Fri, 9 Jan 2026 00:32:27 +0100
Subject: [PATCH] Starting with gcc 16, libstdc++ links to libatomic. Add to
whitelist.
$ ldd /lib64/libstdc++.so.6
linux-vdso.so.1 (0x00007f3cb4c13000)
libm.so.6 => /lib64/libm.so.6 (0x00007f3cb4afc000)
libatomic.so.1 => /lib64/libatomic.so.1 (0x00007f3cb4af1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f3cb460d000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f3cb4ac5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3cb4c15000)
---
bindings/pyroot/pythonizations/test/import_load_libs.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/bindings/pyroot/pythonizations/test/import_load_libs.py b/bindings/pyroot/pythonizations/test/import_load_libs.py
index 63feeca89ba..18906ff921e 100644
--- a/bindings/pyroot/pythonizations/test/import_load_libs.py
+++ b/bindings/pyroot/pythonizations/test/import_load_libs.py
@@ -77,6 +77,7 @@ class ImportLoadLibs(unittest.TestCase):
"ld.*",
"libffi",
"libgcc_s",
+ "libatomic",
# AddressSanitizer runtime and ROOT configuration
"libclang_rt.asan-.*",
"libROOTSanitizerConfig",
--
2.52.0

View file

@ -39,7 +39,7 @@
Name: root
Version: 6.38.00
%global libversion %(cut -d. -f 1-2 <<< %{version})
Release: 4%{?dist}
Release: 6%{?dist}
Summary: Numerical data analysis framework
License: LGPL-2.1-or-later
@ -100,6 +100,16 @@ Patch13: %{name}-cppyy-Remove-code-related-to-finding-CPyCppyy-API-he.patch
# Don't install the python modules twice
# https://github.com/root-project/root/pull/20753
Patch14: %{name}-PyROOT-Don-t-install-the-python-modules-twice.patch
# Fix test for stricter syntax in numpy 2.4.0 (backport)
# https://github.com/root-project/root/pull/20775
Patch15: %{name}-Python-Fix-TF1-Pythonization-test-for-NumPy-2.4.0.patch
# Starting with gcc 16, libstdc++ links to libatomic
# https://github.com/root-project/root/pull/20826
Patch16: %{name}-gcc-16-libstdc-links-to-libatomic.patch
# Test fails with gcc 16 (which uses c++20 as default)
# https://github.com/root-project/root/issues/20831
# https://github.com/root-project/root/pull/20841
Patch17: %{name}-RF-Use-TRandom3-in-test-RooFuncWrapper.patch
BuildRequires: gcc-c++
BuildRequires: gcc-gfortran
@ -1905,6 +1915,9 @@ This package contains a library for histogramming in ROOT 7.
%patch -P12 -p1
%patch -P13 -p1
%patch -P14 -p1
%patch -P15 -p1
%patch -P16 -p1
%patch -P17 -p1
# Remove bundled sources in order to be sure they are not used
# * afterimage
@ -2471,6 +2484,7 @@ gtest-roofit-roofitcore-testLikelihoodGradientJob"
# - gtest-tree-ntuple-ntuple-join-table
# - gtest-tree-ntuple-ntuple-largefile2
# - gtest-tree-ntuple-ntuple-merger
# - gtest-tree-ntuple-ntuple-metrics
# - gtest-tree-ntuple-ntuple-model
# - gtest-tree-ntuple-ntuple-modelext
# - gtest-tree-ntuple-ntuple-multi-column
@ -2527,6 +2541,7 @@ gtest-tree-ntuple-ntuple-extended|\
gtest-tree-ntuple-ntuple-join-table|\
gtest-tree-ntuple-ntuple-largefile2|\
gtest-tree-ntuple-ntuple-merger|\
gtest-tree-ntuple-ntuple-metrics|\
gtest-tree-ntuple-ntuple-model\$\$|\
gtest-tree-ntuple-ntuple-modelext|\
gtest-tree-ntuple-ntuple-multi-column|\
@ -2594,6 +2609,9 @@ gtest-math-matrix-testMatrixTSparse"
# Filter out parts of tests that require remote network access
# RNTuple.StdAtomic fails on ix86 (different alignment 64 bit (non)atomic)
# TH3D.FillThreadSafe and RDFHelpers.Histo3DThreadSafe fail on ix86
# due to alignment issues with std::atomic_ref
# https://github.com/root-project/root/issues/20834
# InterpreterTest.Evaluate fails on s390x
# TClingDataMemberInfo.Offset fails on s390x
# https://github.com/root-project/root/issues/14512
@ -2603,6 +2621,8 @@ gtest-math-matrix-testMatrixTSparse"
export GTEST_FILTER=-\
%ifarch %{ix86}
RNTuple.StdAtomic:\
TH3D.FillThreadSafe:\
RDFHelpers.Histo3DThreadSafe:\
%endif
%ifarch s390x
InterpreterTest.Evaluate:\
@ -3456,6 +3476,12 @@ fi
%endif
%changelog
* Mon Jan 12 2026 Mattias Ellert <mattias.ellert@physics.uu.se> - 6.38.00-6
- Fixes for gcc 16
* Thu Dec 25 2025 Mattias Ellert <mattias.ellert@physics.uu.se> - 6.38.00-5
- Fix test for stricter syntax in numpy 2.4.0 (backport)
* Fri Dec 19 2025 Mattias Ellert <mattias.ellert@physics.uu.se> - 6.38.00-4
- Exclude tests for Fedora 43+ on s390x that fail due to hardware
acceleration in the zlib-ng library.