Randomized tests in CppunitTest_basegfx

Stephan Bergmann sbergman at redhat.com
Wed Feb 22 10:54:40 UTC 2023


<https://ci.libreoffice.org//job/lo_ubsan/2691> failed 
CppunitTest_basegfx with

> /basegfx/source/polygon/b2dtrapezoid.cxx:179:68: runtime error: division by zero
>     #0 0x7fe03ea50e6c in basegfx::trapezoidhelper::(anonymous namespace)::TrDeEdgeEntry::getCutPointForGivenY(double) const /basegfx/source/polygon/b2dtrapezoid.cxx:179:68
>     #1 0x7fe03ea43ad9 in basegfx::trapezoidhelper::(anonymous namespace)::TrapezoidSubdivider::Subdivide(std::__debug::vector<basegfx::B2DTrapezoid, std::allocator<basegfx::B2DTrapezoid> >&) /basegfx/source/polygon/b2dtrapezoid.cxx:668:46
>     #2 0x7fe03ea40bfc in basegfx::utils::trapezoidSubdivide(std::__debug::vector<basegfx::B2DTrapezoid, std::allocator<basegfx::B2DTrapezoid> >&, basegfx::B2DPolyPolygon const&) /basegfx/source/polygon/b2dtrapezoid.cxx:940:34
>     #3 0x7fe03f5a5f29 in basegfx::b2dpolypolygon::testTrapezoidHelper() /basegfx/test/B2DPolyPolygonTest.cxx:64:9
>     #4 0x7fe03f5ab267 in void std::__invoke_impl<void, void (basegfx::b2dpolypolygon::*&)(), basegfx::b2dpolypolygon*&>(std::__invoke_memfun_deref, void (basegfx::b2dpolypolygon::*&)(), basegfx::b2dpolypolygon*&) /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/invoke.h:73:14
>     #5 0x7fe03f5aaed4 in std::__invoke_result<void (basegfx::b2dpolypolygon::*&)(), basegfx::b2dpolypolygon*&>::type std::__invoke<void (basegfx::b2dpolypolygon::*&)(), basegfx::b2dpolypolygon*&>(void (basegfx::b2dpolypolygon::*&)(), basegfx::b2dpolypolygon*&) /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/invoke.h:95:14
>     #6 0x7fe03f5aad50 in void std::_Bind<void (basegfx::b2dpolypolygon::* (basegfx::b2dpolypolygon*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/functional:467:11
>     #7 0x7fe03f5aaa24 in void std::_Bind<void (basegfx::b2dpolypolygon::* (basegfx::b2dpolypolygon*))()>::operator()<void>() /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/functional:549:17
>     #8 0x7fe03f5a9c3c in std::_Function_handler<void (), std::_Bind<void (basegfx::b2dpolypolygon::* (basegfx::b2dpolypolygon*))()> >::_M_invoke(std::_Any_data const&) /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_function.h:316:2
>     #9 0x7fe03f532561 in std::function<void ()>::operator()() const /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_function.h:706:14
>     #10 0x7fe03f5a9028 in CppUnit::TestCaller<basegfx::b2dpolypolygon>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7
>     #11 0x7fe04bb5de8b in CppUnit::TestCaseMethodFunctor::operator()() const (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x296e8b)
>     #12 0x7fe04bacf172 in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x208172)
>     #13 0x7fe04bb3266c in CppUnit::ProtectorChain::ProtectFunctor::operator()() const (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x26b66c)
>     #14 0x7fe04bb2c958 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x265958)
>     #15 0x7fe04bbc166d in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::string const&) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x2fa66d)
>     #16 0x7fe04bb5c2a7 in CppUnit::TestCase::run(CppUnit::TestResult*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x2952a7)
>     #17 0x7fe04bb60411 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x299411)
>     #18 0x7fe04bb5f668 in CppUnit::TestComposite::run(CppUnit::TestResult*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x298668)
>     #19 0x7fe04bb60411 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x299411)
>     #20 0x7fe04bb5f668 in CppUnit::TestComposite::run(CppUnit::TestResult*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x298668)
>     #21 0x7fe04bbeb936 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x324936)
>     #22 0x7fe04bbc012e in CppUnit::TestResult::runTest(CppUnit::Test*) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x2f912e)
>     #23 0x7fe04bbec7f2 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::string const&) (/workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.15.so.1+0x3257f2)
>     #24 0x5062ee in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:333:20
>     #25 0x502ce7 in main2() /sal/cppunittester/cppunittester.cxx:483:16
>     #26 0x50114e in sal_main() /sal/cppunittester/cppunittester.cxx:622:14
>     #27 0x500f9e in main /sal/cppunittester/cppunittester.cxx:617:1
>     #28 0x7fe049c4c554 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:266
>     #29 0x425854 in _start (/workdir/LinkTarget/Executable/cppunittester+0x425854)

in testTrapezoidHelper that had originally been introduced in 
<https://git.libreoffice.org/core/+/82b56544a7a53528970632d086c3cfd8ef879335%5E!/> 
"basegfx: accelerate Trapezoid subdivision by avoiding allocations" and 
apparently uses random data (via basegfx2d::getRandomOrdinal, defined in 
basegfx/test/boxclipper.cxx), so that runs of CppunitTest_basegfx are 
not reproducible (so that there's no good way to reproduce and fix the 
above division by zero error).  Can that test be made reproducible please?



More information about the LibreOffice mailing list