VirtualBox

Changeset 99801 in vbox


Ignore:
Timestamp:
May 15, 2023 10:58:23 PM (19 months ago)
Author:
vboxsync
Message:

Runtime/testcase/{Makefile.kmk,tstRTCRest-1}: Address two
Solaris-specific test failures in RTCRestDouble both of which involve
strtod(3C).

tstRTCRest-1.cpp:testDouble() calls RTJsonParseFromString() to parse
TST_DBL_MIN_STRING1 (a shortened, stringified value of float.h:DBL_MIN)
and ends up in strtod(3C) which fails on Solaris with VERR_OUT_OF_RANGE
(errno=ERANGE) as the value is smaller than the exact value of DBL_MIN
(2-1022). There is already code to handle expected failures for this
value on Linux which returns VERR_INVALID_PARAMETER (errno=EINVAL) so
include VERR_OUT_OF_RANGE for Solaris.

testDouble() also calls RTCRestDouble::fromString() with an argument of
" 0x42 " which is passed to strtod(3C) to convert the supplied string to
a floating-point number. On Solaris, calling strtod(3C) with a
hexadecimal value returns zero unless xpg6 has been set to include
_C99SUSv3_recognize_hexfp (0x1). This is set by the compiler when
C99/SUSv3 behaviour is requested (e.g. with -std=c99). Of the gcc
versions delivered with Solaris, gcc 10 is the first version to default
to C99 behaviour and thus it sets
xpg6 to _C99SUSv3_mode_ON
(0x0000ffff) by default by implicitly linking with values-xpg6.o. Thus
testDouble()'s call to fromString(&obj4, " 0x42 ", ...) can succeed or
fail on Solaris 11 depending on which compiler is used. Address this by
refining the test on Solaris to also check the gcc version.

Location:
trunk/src/VBox/Runtime/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/Makefile.kmk

    r99792 r99801  
    360360  tstRTCRest-1_TEMPLATE = VBoxR3TstExe
    361361  tstRTCRest-1_SOURCES = tstRTCRest-1.cpp
     362  if ("$(KBUILD_TARGET)" == "solaris" && $(VBOX_GCC_VERSION_CXX) <= 70500)
     363   tstRTCRest-1_DEFS = VBOX_SOLARIS_WITHOUT_XPG6_ENABLED
     364  endif
    362365 endif
    363366
  • trunk/src/VBox/Runtime/testcase/tstRTCRest-1.cpp

    r99775 r99801  
    774774    RTERRINFOSTATIC ErrInfo;
    775775    {
    776         /* Some linux systems and probably all solaris fail to parse the longer MIN string, so just detect and skip. */
     776        /* Some linux systems and probably all Solaris fail to parse the longer MIN string, so just detect and skip. */
    777777        bool fGroksMinString = true;
    778778#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
     
    780780        int rcTmp = RTJsonParseFromString(&hTmpValue, TST_DBL_MIN_STRING1, NULL);
    781781        RTJsonValueRelease(hTmpValue);
    782         if (rcTmp == VERR_INVALID_PARAMETER)
     782        if (rcTmp == VERR_INVALID_PARAMETER || rcTmp == VERR_OUT_OF_RANGE)
    783783            fGroksMinString = false;
    784784#endif
     
    890890        RTTESTI_CHECK_RC(fromString(&obj4, "false", NULL, RT_XSTR(__LINE__)), VERR_NO_DIGITS);
    891891
    892 #if (!defined(RT_OS_SOLARIS) && !defined(RT_OS_WINDOWS)) || RT_MSC_PREREQ(RT_MSC_VER_VS2015)
     892#if (!defined(RT_OS_WINDOWS) && !defined(VBOX_SOLARIS_WITHOUT_XPG6_ENABLED)) || RT_MSC_PREREQ(RT_MSC_VER_VS2015)
    893893        RTTESTI_CHECK_RC(fromString(&obj4, " 0x42 ", &ErrInfo, RT_XSTR(__LINE__)), VINF_SUCCESS);
    894894        RTTESTI_CHECK(obj4.m_rdValue == 66.0);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette