[packages/FreeCAD] Fix some tests
arekm
arekm at pld-linux.org
Mon Sep 28 23:43:56 CEST 2026
commit 9957f61b119764d941f778264ca9c45175a2ee25
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Mon Sep 28 23:40:58 2026 +0200
Fix some tests
FreeCAD.spec | 15 ++++++++++++++-
fileinfo-extension.patch | 31 +++++++++++++++++++++++++++++++
unit-pow-round.patch | 12 ++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
---
diff --git a/FreeCAD.spec b/FreeCAD.spec
index 14d4742..beab04d 100644
--- a/FreeCAD.spec
+++ b/FreeCAD.spec
@@ -29,6 +29,8 @@ Patch1: external-E57Format.patch
Patch2: FreeCAD-netgen.patch
Patch3: test-lineformat.patch
Patch4: cam-offset-occ793.patch
+Patch5: fileinfo-extension.patch
+Patch6: unit-pow-round.patch
URL: https://freecad.org/
BuildRequires: Coin-devel
# 7.8 cmake exports linked draco, FreeImage, freetype, tk, X11 by path/name; 7.9 exports only OCC and VTK targets
@@ -162,6 +164,8 @@ GUI instancji FreeCAD-a tak, jak innych widżetów Qt.
%patch -P2 -p1
%patch -P3 -p1
%patch -P4 -p1
+%patch -P5 -p1
+%patch -P6 -p1
# don't force color diagnostics if output is not terminal
%{__sed} -i -e 's/-fdiagnostics-color //' cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake
@@ -198,8 +202,17 @@ GUI instancji FreeCAD-a tak, jak innych widżetów Qt.
# user config and caches go to $HOME
export HOME=$(pwd)/build/tests-home
export QT_QPA_PLATFORM=offscreen
-ctest --test-dir build --output-on-failure %{?_smp_mflags} -E FileInfoTest
# FileInfoTest cases share one scratch dir, https://github.com/FreeCAD/FreeCAD/issues/28737
+ctest_exclude='FileInfoTest'
+%ifarch %{ix86}
+# exact floating point comparisons that x87 excess precision does not meet
+ctest_exclude="$ctest_exclude|^BaseQuantityLoc\.psi_|^Vector\.TestIsNormal$|^SMesh\.testMefisto$"
+%endif
+%ifarch x32
+# shiboken6 segfaults in PyStaticMethod_New when these tests start PySide
+ctest_exclude="$ctest_exclude|^(Assistant|CameraPrecalculatedQuaternions|CameraRotation|StyleParametersApplicationTest)\.|^(DlgVersionMigrator|QuantitySpinBox)_Tests_run$"
+%endif
+ctest --test-dir build --output-on-failure %{?_smp_mflags} -E "$ctest_exclude"
ctest --test-dir build --output-on-failure -R FileInfoTest
build/bin/FreeCADCmd -t 0
%endif
diff --git a/fileinfo-extension.patch b/fileinfo-extension.patch
new file mode 100644
index 0000000..4affa71
--- /dev/null
+++ b/fileinfo-extension.patch
@@ -0,0 +1,31 @@
+# extension()/completeExtension() searched the whole path, so a dot in a directory name
+# (e.g. /tmp/B.xyz/target) yielded a bogus extension for files without one
+--- a/src/Base/FileInfo.cpp 2026-09-28 23:42:16.837030524 +0200
++++ b/src/Base/FileInfo.cpp 2026-09-28 23:42:16.911231473 +0200
+@@ -258,20 +258,22 @@
+
+ std::string FileInfo::extension() const
+ {
+- std::string::size_type pos = FileName.find_last_of('.');
++ std::string name = fileName();
++ std::string::size_type pos = name.find_last_of('.');
+ if (pos == std::string::npos) {
+ return {};
+ }
+- return FileName.substr(pos + 1);
++ return name.substr(pos + 1);
+ }
+
+ std::string FileInfo::completeExtension() const
+ {
+- std::string::size_type pos = FileName.find_first_of('.');
++ std::string name = fileName();
++ std::string::size_type pos = name.find_first_of('.');
+ if (pos == std::string::npos) {
+ return {};
+ }
+- return FileName.substr(pos + 1);
++ return name.substr(pos + 1);
+ }
+
+ bool FileInfo::hasExtension(const char* Ext) const
diff --git a/unit-pow-round.patch b/unit-pow-round.patch
new file mode 100644
index 0000000..8e470a6
--- /dev/null
+++ b/unit-pow-round.patch
@@ -0,0 +1,12 @@
+# truncating val * exp gives 0 instead of 1 for 3 * (1.0 / 3) with x87 excess precision (i686)
+--- a/src/Base/Unit.cpp 2026-09-28 22:12:48.203002723 +0200
++++ b/src/Base/Unit.cpp 2026-09-28 22:12:48.277269019 +0200
+@@ -215,7 +215,7 @@
+ throw UnitsMismatchError("pow() of unit not possible");
+ }
+
+- return static_cast<decltype(val)>(val * exp);
++ return static_cast<decltype(val)>(std::round(num));
+ };
+
+ UnitExponents res {};
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/FreeCAD.git/commitdiff/9957f61b119764d941f778264ca9c45175a2ee25
More information about the pld-cvs-commit
mailing list