tdf#152943: Add configure option to disable NaN payload related tests

Because some architecture(such as riscv64) does not support NaN
  payload (NaN propagation), skipping the related tests might be a
  good choice for builders who has already known the risk of lacking
  NaN payload support.

  Currently the tests that could be skipped via --disable-nan-tests are:

  - rtl_math: test_payloadNaN
  - sc_ucalc_formula2: testExternalRefFunctions
  - sc_ucalc_formula2: testFuncGCD
  - sc_ucalc_formula2: testFuncLCM
  - sc_ucalc_nanpayload: testNanPayload

Change-Id: Ia8834595a8b469d8c542809b3e580a3f6316ef20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174801
Reviewed-by: René Engelhard <rene@debian.org>
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: René Engelhard <rene@debian.org>
This commit is contained in:
Sakura286 2024-10-11 11:19:37 +08:00 committed by René Engelhard
parent 8d7272141f
commit d17a495c5c
8 changed files with 52 additions and 0 deletions

View file

@ -134,6 +134,7 @@ export DCONF_LIBS=@DCONF_LIBS@
export DEFAULT_BRAND_IMAGES=@DEFAULT_BRAND_IMAGES@
export DICT_SYSTEM_DIR=@DICT_SYSTEM_DIR@
export DISABLE_CVE_TESTS=@DISABLE_CVE_TESTS@
DISABLE_NAN_TESTS=@DISABLE_NAN_TESTS@
export DISABLE_DYNLOADING=@DISABLE_DYNLOADING@
export DISABLE_PYTHON=@DISABLE_PYTHON@
export DOCDIR=@DOCDIR@

View file

@ -1895,6 +1895,11 @@ libo_FUZZ_ARG_ENABLE(cve-tests,
[Prevent CVE tests to be executed]),
,)
libo_FUZZ_ARG_ENABLE(nan-tests,
AS_HELP_STRING([--disable-nan-tests],
[Prevent NaN payload tests to be executed]),
,)
AC_ARG_ENABLE(build-opensymbol,
AS_HELP_STRING([--enable-build-opensymbol],
[Do not use the prebuilt opens___.ttf. Build it instead. This needs
@ -11538,6 +11543,18 @@ else
AC_MSG_RESULT([yes])
fi
dnl ===================================================================
dnl Check for disabling nan_tests
dnl ===================================================================
AC_MSG_CHECKING([whether to execute NaN payload tests])
if test "$enable_nan_tests" = "no"; then
AC_MSG_RESULT([no])
DISABLE_NAN_TESTS=TRUE
AC_SUBST(DISABLE_NAN_TESTS)
else
AC_MSG_RESULT([yes])
fi
dnl ===================================================================
dnl Check for system openssl
dnl ===================================================================

View file

@ -71,4 +71,12 @@ ifeq ($(ENABLE_CIPHER_OPENSSL_BACKEND),TRUE)
$(eval $(call gb_CppunitTest_add_defs,sal_rtl,-DLIBO_CIPHER_OPENSSL_BACKEND))
endif
# test_payloadNaN may fail on some arch(e.g. riscv64) that does not
# support part of IEEE 754 voluntary standards
ifeq ($(DISABLE_NAN_TESTS),TRUE)
$(eval $(call gb_CppunitTest_add_defs,sal_rtl,\
-DDISABLE_NAN_TESTS \
))
endif
# vim: set noet sw=4 ts=4:

View file

@ -686,7 +686,9 @@ public:
CPPUNIT_TEST(test_acosh);
CPPUNIT_TEST(test_asinh);
CPPUNIT_TEST(test_atanh);
#ifndef DISABLE_NAN_TESTS
CPPUNIT_TEST(test_payloadNaN);
#endif
CPPUNIT_TEST_SUITE_END();
};

View file

@ -11,4 +11,12 @@
$(eval $(call sc_ucalc_test,_formula2))
# some testes related to NaN payload may fail on some arch(e.g. riscv64)
# that does not support part of IEEE 754 voluntary standards
ifeq ($(DISABLE_NAN_TESTS),TRUE)
$(eval $(call gb_CppunitTest_add_defs,sc_ucalc_formula2,\
-DDISABLE_NAN_TESTS \
))
endif
# vim: set noet sw=4 ts=4:

View file

@ -11,4 +11,12 @@
$(eval $(call sc_ucalc_test,_nanpayload))
# some testes related to NaN payload may fail on some arch(e.g. riscv64)
# that does not support part of IEEE 754 voluntary standards
ifeq ($(DISABLE_NAN_TESTS),TRUE)
$(eval $(call gb_CppunitTest_add_defs,sc_ucalc_nanpayload,\
-DDISABLE_NAN_TESTS \
))
endif
# vim: set noet sw=4 ts=4:

View file

@ -1827,6 +1827,7 @@ void TestFormula2::testExtRefConcat(ScDocument* pDoc, ScDocument& rExtDoc)
CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRefFunctions)
{
#ifndef DISABLE_NAN_TESTS
ScDocShellRef xExtDocSh = new ScDocShell;
OUString aExtDocName(u"file:///extdata.fake"_ustr);
SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
@ -1925,6 +1926,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRefFunctions)
!findLoadedDocShellByName(aExtDocName));
m_pDoc->DeleteTab(0);
#endif
}
CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRefUnresolved)
@ -3173,6 +3175,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncSUMX2MY2)
CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncGCD)
{
#ifndef DISABLE_NAN_TESTS
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, u"GCDTest"_ustr);
@ -3267,10 +3270,12 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncGCD)
u"#VALUE!"_ustr, aVal);
m_pDoc->DeleteTab(0);
#endif
}
CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncLCM)
{
#ifndef DISABLE_NAN_TESTS
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, u"LCMTest"_ustr);
@ -3365,6 +3370,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncLCM)
u"#VALUE!"_ustr, aVal);
m_pDoc->DeleteTab(0);
#endif
}
CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncSUMSQ)

View file

@ -16,10 +16,12 @@ class TestNanPayload : public ScUcalcTestBase
CPPUNIT_TEST_FIXTURE(TestNanPayload, testNanPayload)
{
#ifndef DISABLE_NAN_TESTS
// Some tests, such as testExternalRefFunctions, testFuncGCD, and testFuncGCD, evaluates
// spreadsheet functions' error code, which need NaN payload feature of the hardware
NanPayloadTest nanTest;
CPPUNIT_ASSERT_MESSAGE(nanTest.getMessage(), nanTest.getIfSupported());
#endif
}
CPPUNIT_PLUGIN_IMPLEMENT();