Re: [PATCH] Testsuite for inttypes methods.

2017-09-06 Thread Sebastian Huber

On 06/09/17 08:53, Aditya Upadhyay wrote:


---
  testsuites/psxtests/psxinttypes01/Makefile.am  |  22 +
  testsuites/psxtests/psxinttypes01/init.c   | 107 +
  .../psxtests/psxinttypes01/psxinttypes01.scn   |  11 +++
  3 files changed, 140 insertions(+)
  create mode 100644 testsuites/psxtests/psxinttypes01/Makefile.am
  create mode 100644 testsuites/psxtests/psxinttypes01/init.c
  create mode 100644 testsuites/psxtests/psxinttypes01/psxinttypes01.scn

diff --git a/testsuites/psxtests/psxinttypes01/Makefile.am 
b/testsuites/psxtests/psxinttypes01/Makefile.am
new file mode 100644
index 000..90608d4
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes01
+psxinttypes01_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxinttypes01.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+#AM_CPPFLAGS = -I$(top_srcdir)/include
+#AM_CPPFLAGS = -I$(top_srcdir)/../support/include$(psxinttypes01_LDADD)
+
+LINK_OBJS = $(psxinttypes01_OBJECTS)
+LINK_LIBS = $(psxinttypes01_LDLIBS)
+
+psxinttypes01$(EXEEXT): $(psxinttypes01_OBJECTS) $(psxinttypes01_DEPENDENCIES)
+   @rm -f psxinttypes01$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes01/init.c 
b/testsuites/psxtests/psxinttypes01/init.c
new file mode 100644
index 000..43d49f6
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/init.c
@@ -0,0 +1,107 @@
+/*
+ *  This is the test for inttypes library. It covers these functions :
+ *  imaxabs(), imaxdiv(), strtoimax(), strtoumax(), wcstoimax(), wcstoumax().
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 01";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_print_printer_printf(&rtems_test_printer);
+  rtems_test_begin();


Please don't use the printer explicitly. Use the TEST_BEGIN() and 
TEST_END() marcos.



+
+  char* endptr, *nptr;
+
+  uintmax_t j, k;
+
+  int base = 10;
+
+  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 != 0);
+  rtems_test_assert (!(*endptr1));
+
+  printf( "wcstoimax = %jd\n", m );
+
+  /* test for strtoumax */
+
+  j = strtoumax (nptr, &endptr, base);
+  rtems_test_assert (j != 0);
+  rtems_test_assert (*endptr);
+
+  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 != 0);
+  rtems_test_assert (!(*endptr1));
+
+  printf( "wcstoumax = %ju\n", k );
+
+  /*Test for imaxdiv */
+
+  imaxdiv_t retrival = imaxdiv ( 27, 4 );
+  printf( "imax div value = %jd\n", retrival.rem );


Did you check that a function call is generated? The compiler may 
replace this with a constant. Better add -fno-builtin to the compiler 
flags. See


testsuites/benchmarks/linpack/Makefile.am


+
+  /*Test for imaxabs  */
+
+  printf( "imaxabs_value = %jd\n", imaxabs (-1234));
+
+  /*Test for strtoimax */
+
+  n = strtoimax ("-123junk", &endptr, base);
+  rtems_test_assert (n != 0);
+  rtems_test_assert (*endptr);
+
+  printf( "strtoimax value = %jd\n", n);
+
+
+  rtems_test_end();
+  exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include 
diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn 
b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
new file mode 100644
index 000..79553be
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
@@ -0,0 +1,11 @@
+*** BEGIN OF TEST PSXINTTYPES 01 ***
+wcstoimax = 10110134932
+strtoumax = 20690239864 ( base 10 )
+Stopped scan at abc
+
+wcstoumax = 10110134932
+imax div value = 3
+imaxabs_value = 1234
+strtoimax value = -123
+*** END OF TEST PSXINTTYPES 01 ***
+


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org

3rd party package build system

2017-09-06 Thread Nicolas Tsiogkas
Hi,

I'm trying to integrate SOEM with RTEMS (https://devel.rtems.org/ticket/3120
)

As I am trying to create the appropriate bset and cfg files I noticed that
all the packages built are based on autoconf to be built.

SOEM on the other hand is only providing CMake as a build tool.

I have found instructions on using CMake with RTEMS (
https://lists.rtems.org/pipermail/devel/2016-March/013800.html)

The question is if it would be more sensible to create a build environment
for SOEM based on autotools or try to use CMake somehow?

I doubt that changing the build system will be easily accepted upstream.

Any thoughts?

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

GSoC 2017 is over!

2017-09-06 Thread Denis Obrezkov
Hello all,
the GSoC is over, I wanted only to ask - is it true that one of our
students hasn't passed the final evaluation?

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

Re: 3rd party package build system

2017-09-06 Thread Chris Johns
On 06/09/2017 19:56, Nicolas Tsiogkas wrote:
> I'm trying to integrate SOEM with RTEMS (https://devel.rtems.org/ticket/3120
> )

Thank you for creating the ticket.

> As I am trying to create the appropriate bset and cfg files I noticed that all
> the packages built are based on autoconf to be built.

This reflects the nature of the packages we currently support and nothing more.

> SOEM on the other hand is only providing CMake as a build tool. 

This should be fine if the implementation in SOEM is ok.

> I have found instructions on using CMake with RTEMS
> (https://lists.rtems.org/pipermail/devel/2016-March/013800.html)
> 
> The question is if it would be more sensible to create a build environment for
> SOEM based on autotools or try to use CMake somehow?

I do not think there is a need. The upstream project has selected cmake and we
should respect that.

> I doubt that changing the build system will be easily accepted upstream.

Agreed.

The RSB scripts will invoke cmake so this bit is easy. The part you need to work
with the upstream project is getting a cross-complier build to work. How well
this works depends on how the cmake build scripts in the project are
implemented. Carefully constructed cmake build scripts and the judicious use of
the command line `-D` options can be used to configure and/or build the package.

I should warn you, use the cmake gui and tui tool at your own risk, if you step
in there you may never return as the same person.

The key file in the RSB is rtems-bsp.cfg [1]. It wraps a private package config
implementation that parses an installed BSP's build configuration [2] and
updates the internal RSB data [3].

I suggest you get the package to build from the command line for a BSP. This
will be the compiler name and cflags. What you end up with will be available in
the macros in rtems-bsp.cfg.

Have a look in the BSP installed .pc file for the flags to use, ie do a `find .
-name \*.pc` from the RTEMS installed prefix path.

My (publicly denied) cmake experience with RTEMS is configure header tests can
be fragile if there is cmake nesting.

Chris

[1] https://git.rtems.org/rtems-source-builder/tree/rtems/config/rtems-bsp.cfg
[2] 
https://git.rtems.org/rtems-source-builder/tree/rtems/config/rtems-bsp.cfg#n64
[3] 
https://git.rtems.org/rtems-source-builder/tree/rtems/config/rtems-bsp.cfg#n81
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel