diff --git a/config_host.mk.in b/config_host.mk.in index 78874b1ee149..4b7bf923a4b9 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -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@ diff --git a/configure.ac b/configure.ac index c02897469211..2a1063232fa4 100644 --- a/configure.ac +++ b/configure.ac @@ -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 =================================================================== diff --git a/sal/CppunitTest_sal_rtl.mk b/sal/CppunitTest_sal_rtl.mk index e856e8bc8fee..1a6e494bcef6 100644 --- a/sal/CppunitTest_sal_rtl.mk +++ b/sal/CppunitTest_sal_rtl.mk @@ -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: diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx index 8f669f265ecf..53b6827c818b 100644 --- a/sal/qa/rtl/math/test-rtl-math.cxx +++ b/sal/qa/rtl/math/test-rtl-math.cxx @@ -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(); }; diff --git a/sc/CppunitTest_sc_ucalc_formula2.mk b/sc/CppunitTest_sc_ucalc_formula2.mk index dc02436aa939..49dbc610c566 100644 --- a/sc/CppunitTest_sc_ucalc_formula2.mk +++ b/sc/CppunitTest_sc_ucalc_formula2.mk @@ -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: diff --git a/sc/CppunitTest_sc_ucalc_nanpayload.mk b/sc/CppunitTest_sc_ucalc_nanpayload.mk index 08900a217f6d..be93fe9f118c 100644 --- a/sc/CppunitTest_sc_ucalc_nanpayload.mk +++ b/sc/CppunitTest_sc_ucalc_nanpayload.mk @@ -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: diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx index b59536b9a4f8..0416e6c25845 100644 --- a/sc/qa/unit/ucalc_formula2.cxx +++ b/sc/qa/unit/ucalc_formula2.cxx @@ -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) diff --git a/sc/qa/unit/ucalc_nanpayload.cxx b/sc/qa/unit/ucalc_nanpayload.cxx index c64acd3f5bf4..34d09bc04f7e 100644 --- a/sc/qa/unit/ucalc_nanpayload.cxx +++ b/sc/qa/unit/ucalc_nanpayload.cxx @@ -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();