Re: [PATCH v2] Testsuite for inttypes methods

2017-08-27 Thread Gedare Bloom
I'm pretty sure the error code is returned via 'errno', not as a
return value. Re-read the specification again.

On Sat, Aug 26, 2017 at 3:38 PM, Joel Sherrill  wrote:
>
>
> On Fri, Aug 25, 2017 at 9:05 AM, Gedare Bloom  wrote:
>>
>> Merge this with the previous commits to only provide 1 single commit
>> adding this new test.
>>
>> On Wed, Aug 23, 2017 at 3:35 PM, Aditya Upadhyay 
>> wrote:
>> > ---
>> >  testsuites/psxtests/Makefile.am|  5 --
>> >  testsuites/psxtests/configure.ac   |  5 --
>> >  testsuites/psxtests/psxinttypes01/init.c   | 66
>> > +++---
>> >  .../psxtests/psxinttypes01/psxinttypes01.scn   |  8 +++
>> >  4 files changed, 66 insertions(+), 18 deletions(-)
>> >
>> > diff --git a/testsuites/psxtests/Makefile.am
>> > b/testsuites/psxtests/Makefile.am
>> > index cda0061..5d3d41d 100644
>> > --- a/testsuites/psxtests/Makefile.am
>> > +++ b/testsuites/psxtests/Makefile.am
>> > @@ -59,11 +59,6 @@ _SUBDIRS += psxintrcritical01
>> >  _SUBDIRS += psxitimer
>> >  endif
>> >  _SUBDIRS += psxinttypes01
>> > -_SUBDIRS += psxinttypes02
>> > -_SUBDIRS += psxinttypes03
>> > -_SUBDIRS += psxinttypes04
>> > -_SUBDIRS += psxinttypes05
>> > -_SUBDIRS += psxinttypes06
>> >  _SUBDIRS += psxkey01
>> >  _SUBDIRS += psxkey02
>> >  _SUBDIRS += psxkey03
>> > diff --git a/testsuites/psxtests/configure.ac
>> > b/testsuites/psxtests/configure.ac
>> > index dd5f23f..b2b00b7 100644
>> > --- a/testsuites/psxtests/configure.ac
>> > +++ b/testsuites/psxtests/configure.ac
>> > @@ -163,11 +163,6 @@ psximfs01/Makefile
>> >  psximfs02/Makefile
>> >  psxintrcritical01/Makefile
>> >  psxinttypes01/Makefile
>> > -psxinttypes02/Makefile
>> > -psxinttypes03/Makefile
>> > -psxinttypes04/Makefile
>> > -psxinttypes05/Makefile
>> > -psxinttypes06/Makefile
>> >  psxitimer/Makefile
>> >  psxkey01/Makefile
>> >  psxkey02/Makefile
>> > diff --git a/testsuites/psxtests/psxinttypes01/init.c
>> > b/testsuites/psxtests/psxinttypes01/init.c
>> > index ad41a6d..72f036a 100644
>> > --- a/testsuites/psxtests/psxinttypes01/init.c
>> > +++ b/testsuites/psxtests/psxinttypes01/init.c
>> > @@ -1,5 +1,6 @@
>> >  /*
>> > - *  This is the test for inttypes imaxabs method.
>> > + *  This is the test for inttypes library. It covers these functions :
>> > + *  imaxabs(), imaxdiv(), strtoimax(), strtoumax(), wcstoimax(),
>> > wcstoumax().
>> >   */
>> >
>> >  #ifdef HAVE_CONFIG_H
>> > @@ -11,8 +12,6 @@
>> >  #include 
>> >  #include 
>> >  #include 
>> > -#include 
>> > -#include 
>> >  #include 
>> >  #include 
>> >
>> > @@ -32,11 +31,63 @@ rtems_task Init(
>> >  {
>> >rtems_print_printer_printf(&rtems_test_printer);
>> >rtems_test_begin();
>> > -
>> > -  intmax_t a = -1234;
>> >
>> > -  intmax_t b = imaxabs(a);
>> > -  printf( "imaxabs_value = %jd\n", b);
>> > +  char* endptr, *nptr;
>> > +
>> > +  uintmax_t j, k;
>> > +
>> > +  int base = 10;
>> > +  rtems_test_assert (base == EINVAL);
>> I don't know why this is being asserted.
>>
>> > +
>> > +  wchar_t *nptr1, *endptr1;
>> > +
>> > +  intmax_t m, n;
>> > +
>> > +  nptr1 = L"10110134932";
>> > +  nptr  = "20690239864abc";
>> > +
>> > +  /* Test for wcstoimax */
>> > +
>> > +  m = wcstoimax(nptr1, &endptr1, base);
>> > +  rtems_test_assert (m == ERANGE);
>> > +  rtems_test_assert (m == EINVAL);
>> > +
>> I don't understand these two asserts, Perhaps you meant to check errno?
>>
>> Is it possible to check the correctness of the return value 'm' in an
>> rtems_test_assert() to automate verification of the return?
>>
>
> I don't see how both of those assert's would ever pass. m cannot
> equal both those values. Is it "m == ERANGE || m == EINVAL"?
> Don't we know the single error case it is trying to exercise?
>
>>
>> These same comments apply to the other tests below.
>>
>> You should also add some other boundary condition tests, e.g., NULL
>> endptr, base != 10, and some invalid cases too.
>>
>> > +  printf( "wcstoimax = %jd\n", m );
>> > +
>> > +  /* test for strtoumax */
>> > +
>> > +  j = strtoumax (nptr, &endptr, base);
>> > +  rtems_test_assert (j == ERANGE);
>> > +  rtems_test_assert (j == EINVAL);
>> > +
>> > +  printf( "strtoumax = %ju ( base %d )\n", j, base );
>> > +  printf( "Stopped scan at %s\n\n", endptr );
>> > +
>> > +  /*test for wcstoumax */
>> > +
>> > +  k = wcstoumax (nptr1, &endptr1, base);
>> > +  rtems_test_assert (k == ERANGE);
>> > +  rtems_test_assert (k == EINVAL);
>> > +
>> > +  printf( "wcstoumax = %ju\n", k );
>> > +
>> > +  /*Test for imaxdiv */
>> > +
>> > +  imaxdiv_t retrival = imaxdiv ( 27, 4 );
>> > +  printf( "imax div value = %jd\n", retrival.rem );
>> > +
>> > +  /*Test for imaxabs  */
>> > +
>> > +  printf( "imaxabs_value = %jd\n", imaxabs (-1234));
>> > +
>> > +  /*Test for strtoimax */
>> > +
>> > +  n = strtoimax ("", &endptr, 2);
>> > +  rtems_test_assert (n == ERANGE);
>> > +  rtems_test_assert (n == EINVAL);
>> > +
>> > +  printf( "strtoimax value = %jd\n", n);
>> > +
>> >
>> >rte

GSoC 2017 RTEMS for HiFive1: The Final Report

2017-08-27 Thread Denis Obrezkov
The Final Report of my GSoC project is ready!
https://embeddedden.blogspot.de/2017/08/gsoc-2017-results-rtems-for-hifive1.html

Criticism appreciated.

-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: GSoC 2017 RTEMS for HiFive1: The Final Report

2017-08-27 Thread Gedare Bloom
You might like to use the following link somewhere to identify your
specific contributions:
https://github.com/embeddedden/rtems-riscv/commits/hifive1?author=embeddedden

On Sun, Aug 27, 2017 at 10:54 AM, Denis Obrezkov
 wrote:
> The Final Report of my GSoC project is ready!
> https://embeddedden.blogspot.de/2017/08/gsoc-2017-results-rtems-for-hifive1.html
>
> Criticism appreciated.
>
> --
> Regards, Denis Obrezkov
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: GSoC 2017 RTEMS for HiFive1: The Final Report

2017-08-27 Thread Denis Obrezkov
2017-08-27 17:50 GMT+02:00 Gedare Bloom :

> You might like to use the following link somewhere to identify your
> specific contributions:
> https://github.com/embeddedden/rtems-riscv/commits/hifive1?author=
> embeddedden
>
> On Sun, Aug 27, 2017 at 10:54 AM, Denis Obrezkov
>  wrote:
> > The Final Report of my GSoC project is ready!
> > https://embeddedden.blogspot.de/2017/08/gsoc-2017-results-
> rtems-for-hifive1.html
> >
> > Criticism appreciated.
> >
> > --
> > Regards, Denis Obrezkov
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
Thank you, it much better identifies my contribution.


-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/2] main_dd.c: Eliminate no prototype warning for swab()

2017-08-27 Thread Joel Sherrill
---
 cpukit/libmisc/shell/main_dd.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/cpukit/libmisc/shell/main_dd.c b/cpukit/libmisc/shell/main_dd.c
index e9c8bf3..6ae4abb 100644
--- a/cpukit/libmisc/shell/main_dd.c
+++ b/cpukit/libmisc/shell/main_dd.c
@@ -73,6 +73,17 @@ __FBSDID("$FreeBSD: src/bin/dd/dd.c,v 1.43 2004/08/15 
19:10:05 rwatson Exp $");
 #include 
 #include 
 
+#ifdef __rtems__
+/*
+ * We should be able to define _XOPEN_SOURCE=900 to get a prototype for
+ * swab() but if that is defined before including , then the RTEMS
+ * headers don't compile. If defined after including , then
+ * it still doesn't trip the include. Thus this prototype.
+ */
+
+void swab(const void *from, void *to, ssize_t n);
+#endif
+
 #include "dd.h"
 #include "extern-dd.h"
 
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel