[PATCH] added fesetexeptflag() test to the psxfenv test

Eshan Dhawan eshandhawan51 at gmail.com
Mon Feb 24 15:55:01 UTC 2020


I have added test for fegetflagexept and fesetflagexept in psxfenv test
suite
can someone check the test case for the correctness
it runs fine in riscv
also i have sent another patch to change assert() back to
rtems_test_assert()

On Mon, Feb 24, 2020 at 9:18 PM Eshan dhawan <eshandhawan51 at gmail.com>
wrote:

> ---
>  testsuites/psxtests/psxfenv01/init.c | 36 ++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 5 deletions(-)
>
> diff --git a/testsuites/psxtests/psxfenv01/init.c
> b/testsuites/psxtests/psxfenv01/init.c
> index cdb0fa596e..8ffb9395b9 100644
> --- a/testsuites/psxtests/psxfenv01/init.c
> +++ b/testsuites/psxtests/psxfenv01/init.c
> @@ -46,6 +46,9 @@
>  #include <string.h>
>  #include <rtems/test.h>
>  #include <tmacros.h>
> +#include <assert.h>
> +
> +#define rtems_test_assert(x) assert(x)
>
>  const char rtems_test_name[] = "PSXFENV 01";
>
> @@ -71,19 +74,19 @@ rtems_task Init(rtems_task_argument ignored)
>      r = fesetenv(FE_DFL_ENV);
>      if (r)
>        printf("fesetenv ==> %d\n", r);
> -    rtems_test_assert( r == 0 );
> +    assert( r == 0 );
>
>      /* Test 'feclearexcept()' and 'fetestexcept()' in one go. */
>      puts( "feclearexcept(FE_ALL_EXCEPT)." );
>      r = feclearexcept(FE_ALL_EXCEPT);
>      if (r)
>        printf("feclearexcept ==> 0x%x\n", r);
> -    rtems_test_assert( r == 0 );
> +    assert( r == 0 );
>
>      r = fetestexcept( FE_ALL_EXCEPT );
>      if (r)
>        printf("fetestexcept ==> 0x%x\n", r);
> -    rtems_test_assert( r == 0 );
> +    assert( r == 0 );
>
>      /* Test 'FE_DIVBYZERO' */
>      puts( "Divide by zero and confirm fetestexcept()" );
> @@ -91,12 +94,22 @@ rtems_task Init(rtems_task_argument ignored)
>      b = 1.0;
>      c = b/a;
>      (void) c;
> +    /* Test fegetexceptflag() and fesetexceptflag().*/
> +    r=fegetexceptflag(&excepts,FE_ALL_EXCEPT);
> +    if(r)
> +      printf("fegetexceptflag ==> 0x%x\n", r);
> +    assert(r == 0);
> +
> +    r=fesetexceptflag(&excepts, FE_ALL_EXCEPT);
> +    if(r)
> +      printf("fesetexceptflag ==> 0x%x\n", r);
> +    assert(r == 0);
> +
>
> -    fegetexceptflag(&excepts,FE_ALL_EXCEPT);
>
>  #ifdef FE_DIVBYZERO
>      r = feraiseexcept(FE_DIVBYZERO);
> -    rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
> +    assert( fetestexcept( FE_DIVBYZERO ) );
>  #endif
>
>      /* Test 'FE_INEXACT' */
> @@ -125,3 +138,16 @@ rtems_task Init(rtems_task_argument ignored)
>  #define CONFIGURE_INIT
>  #include <rtems/confdefs.h>
>  /* end of file */
> +
> +
> +/*
> +    fegetenv()
> +
> +    fegetround()
> +    feholdexcept()
> +
> +    fesetexceptflag()
> +    fesetround()
> +
> +    feupdateenv()
> +*/
> --
> 2.17.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200224/892e7a9e/attachment-0001.html>


More information about the devel mailing list