Re: select() on Serial Ports

2018-11-06 Thread Sebastian Huber

On 06/11/2018 00:26, Joel Sherrill wrote:

Hi

I recall this was added recently but not the details. Is this 
something that works on the master but not 4.11?


It is only available in RTEMS 5 (master).



Is this something that should work for all BSPs?


Yes, but only for interrupt driven drivers.

--
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
http://lists.rtems.org/mailman/listinfo/devel

Re: New Coverity Scan Results

2018-11-06 Thread Sebastian Huber

Hello Joel,

could you please do a new scan since I committed a couple of FTP server 
patches which should address some Coverity issues.


--
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
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/3] score: Simplify _Objects_Initialize_information()

2018-11-06 Thread Sebastian Huber
There is no need to make the minimum identifier dependent on the maximum
per allocation.
---
 cpukit/score/src/objectinitializeinformation.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/cpukit/score/src/objectinitializeinformation.c 
b/cpukit/score/src/objectinitializeinformation.c
index 23c7819bfa..9905349213 100644
--- a/cpukit/score/src/objectinitializeinformation.c
+++ b/cpukit/score/src/objectinitializeinformation.c
@@ -39,7 +39,6 @@ void _Objects_Do_initialize_information(
 )
 {
   static Objects_Control *null_local_table = NULL;
-  uint32_tminimum_index;
   Objects_Maximum maximum_per_allocation;
 
   information->the_api= the_api;
@@ -88,9 +87,8 @@ void _Objects_Do_initialize_information(
   /*
*  Calculate minimum and maximum Id's
*/
-  minimum_index = (maximum_per_allocation == 0) ? 0 : 1;
   information->minimum_id =
-_Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index 
);
+_Objects_Build_id( the_api, the_class, _Objects_Local_node, 1 );
 
   /*
*  Calculate the maximum name length
-- 
2.16.4

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


[PATCH 1/3] spconfig02: New test program

2018-11-06 Thread Sebastian Huber
---
 testsuites/sptests/Makefile.am   |   9 ++
 testsuites/sptests/configure.ac  |   1 +
 testsuites/sptests/spconfig02/init.c | 227 +++
 testsuites/sptests/spconfig02/spconfig02.doc |  23 +++
 testsuites/sptests/spconfig02/spconfig02.scn |   7 +
 5 files changed, 267 insertions(+)
 create mode 100644 testsuites/sptests/spconfig02/init.c
 create mode 100644 testsuites/sptests/spconfig02/spconfig02.doc
 create mode 100644 testsuites/sptests/spconfig02/spconfig02.scn

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 7a182430b0..80680dfe83 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -717,6 +717,15 @@ spconfig01_CPPFLAGS = $(AM_CPPFLAGS) 
$(TEST_FLAGS_spconfig01) \
$(support_includes)
 endif
 
+if TEST_spconfig02
+sp_tests += spconfig02
+sp_screens += spconfig02/spconfig02.scn
+sp_docs += spconfig02/spconfig02.doc
+spconfig02_SOURCES = spconfig02/init.c
+spconfig02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spconfig02) \
+   $(support_includes)
+endif
+
 if TEST_spconsole01
 sp_tests += spconsole01
 sp_screens += spconsole01/spconsole01.scn
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 36b3a17ecd..e725b39067 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -118,6 +118,7 @@ RTEMS_TEST_CHECK([spchain])
 RTEMS_TEST_CHECK([spclock_err01])
 RTEMS_TEST_CHECK([spclock_err02])
 RTEMS_TEST_CHECK([spconfig01])
+RTEMS_TEST_CHECK([spconfig02])
 RTEMS_TEST_CHECK([spconsole01])
 RTEMS_TEST_CHECK([spcontext01])
 RTEMS_TEST_CHECK([spcoverage])
diff --git a/testsuites/sptests/spconfig02/init.c 
b/testsuites/sptests/spconfig02/init.c
new file mode 100644
index 00..1bde941c74
--- /dev/null
+++ b/testsuites/sptests/spconfig02/init.c
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+
+#include 
+
+const char rtems_test_name[] = "SPCONFIG 2";
+
+static const rtems_name name = rtems_build_name('N', 'A', 'M', 'E');
+
+static void test_barrier(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id);
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_message_queue(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_message_queue_create(
+name,
+1,
+1,
+RTEMS_DEFAULT_ATTRIBUTES,
+&id
+  );
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_partition(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+  long buf[32];
+
+  sc = rtems_partition_create(
+name,
+buf,
+sizeof(buf),
+sizeof(buf),
+RTEMS_DEFAULT_ATTRIBUTES,
+&id
+  );
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_rate_monotonic(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_rate_monotonic_create(name, &id);
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_region(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+  long buf[32];
+
+  sc = rtems_region_create(
+name,
+buf,
+sizeof(buf),
+1,
+RTEMS_DEFAULT_ATTRIBUTES,
+&id
+  );
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_semaphore(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_semaphore_create(
+name,
+0,
+RTEMS_DEFAULT_ATTRIBUTES,
+0,
+&id
+  );
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_task(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_task_create(
+name,
+1,
+RTEMS_MINIMUM_STACK_SIZE,
+RTEMS_DEFAULT_MODES,
+RTEMS_DEFAULT_ATTRIBUTES,
+&id
+  );
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_timer(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_timer_create(name, &id);
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_user_extensions(void)
+{
+  rtems_status_code sc;
+  rtems_id id;
+  rtems_extensions_table table;
+
+  memset(&table, 0, sizeof(table));
+  sc = rtems_extension_create(name, &table, &id);
+  rtems_test_assert(sc == RTEMS_TOO_MANY);
+}
+
+static void test_id_to_name(rtems_id api, rtems_id cls, rtems_id idx, bool 
*found)
+{
+  rtems_status_code sc;
+  rtems_id id;
+  rtems_name name_of_id;
+
+  id = rtems_build_id(api, cls, 1, idx);
+  sc = rtems_object_get_classic_name(id, &name_of_id);
+
+  if (sc == RTEMS_SUCCESSFUL) {
+if (name_of_id == rtems_build_name('U', 'I', '1', ' ')) {
+  rtems_test_assert(id == rtems_task_self());
+  rtems_test_assert(!found[0]);
+  found[0] = true;
+} else 

[PATCH 3/3] config: Fix CONFIGURE_DISABLE_NEWLIB_REENTRANCY

2018-11-06 Thread Sebastian Huber
Move the __getreent() variant using the global reentrancy structure to
librtemscpu.a.  This avoids a definition of __getreent() in the
configuration module if CONFIGURE_DISABLE_NEWLIB_REENTRANCY is defined.
This avoids all the dependencies which would be exposed by a reference
to the global reentrancy structure.

This change is only possible since the default configuration moved to
librtemsdefaultconfig.a recently.
---
 cpukit/Makefile.am  |  1 +
 cpukit/include/rtems/confdefs.h | 14 +-
 cpukit/libcsupport/src/getreentglobal.c | 26 ++
 3 files changed, 32 insertions(+), 9 deletions(-)
 create mode 100644 cpukit/libcsupport/src/getreentglobal.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index b0d9088d44..786222bd81 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -151,6 +151,7 @@ librtemscpu_a_SOURCES += libcsupport/src/__getpid.c
 librtemscpu_a_SOURCES += libcsupport/src/getpid.c
 librtemscpu_a_SOURCES += libcsupport/src/getppid.c
 librtemscpu_a_SOURCES += libcsupport/src/getpwent.c
+librtemscpu_a_SOURCES += libcsupport/src/getreentglobal.c
 librtemscpu_a_SOURCES += libcsupport/src/getrusage.c
 librtemscpu_a_SOURCES += libcsupport/src/__gettod.c
 librtemscpu_a_SOURCES += libcsupport/src/getuid.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 64577b92d7..15d0947ea3 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2242,15 +2242,11 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
   #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
 #endif
 
-#if defined(RTEMS_NEWLIB)
-  struct _reent *__getreent(void)
-  {
-#ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
-  return _GLOBAL_REENT;
-#else
-  return _Thread_Get_executing()->libc_reent;
-#endif
-  }
+#if defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)
+struct _reent *__getreent(void)
+{
+  return _Thread_Get_executing()->libc_reent;
+}
 #endif
 
 #endif
diff --git a/cpukit/libcsupport/src/getreentglobal.c 
b/cpukit/libcsupport/src/getreentglobal.c
new file mode 100644
index 00..775b4462cc
--- /dev/null
+++ b/cpukit/libcsupport/src/getreentglobal.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if defined(RTEMS_NEWLIB)
+#include 
+
+struct _reent *__getreent(void)
+{
+  return _GLOBAL_REENT;
+}
+#endif
-- 
2.16.4

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


Re: [rtems commit] score: Optimize Objects_Information

2018-11-06 Thread Joel Sherrill
Just confirming that no fields changed names.

--joel

On Tue, Nov 6, 2018 at 6:37 AM Sebastian Huber  wrote:

> Module:rtems
> Branch:master
> Commit:878487b024578e887f27719887d7cada84db23bc
> Changeset:
> http://git.rtems.org/rtems/commit/?id=878487b024578e887f27719887d7cada84db23bc
>
> Author:Sebastian Huber 
> Date:  Mon Nov  5 09:53:04 2018 +0100
>
> score: Optimize Objects_Information
>
> Reduce structure internal padding.  Group members used by _Objects_Get()
> together.  Reduce size of some members.
>
> Format and simplify _Objects_Extend_information().
>
> ---
>
>  cpukit/include/rtems/score/objectimpl.h|  28 +++
>  cpukit/score/src/objectextendinformation.c | 116
> +
>  2 files changed, 66 insertions(+), 78 deletions(-)
>
> diff --git a/cpukit/include/rtems/score/objectimpl.h
> b/cpukit/include/rtems/score/objectimpl.h
> index 1bef14b..bf4d45d 100644
> --- a/cpukit/include/rtems/score/objectimpl.h
> +++ b/cpukit/include/rtems/score/objectimpl.h
> @@ -120,36 +120,36 @@ typedef void ( *Objects_Thread_queue_Extract_callout
> )(
>   *  manage each class of objects.
>   */
>  typedef struct {
> -  /** This field indicates the API of this object class. */
> -  Objects_APIs  the_api;
> -  /** This is the class of this object set. */
> -  uint16_t  the_class;
>/** This is the minimum valid id of this object class. */
>Objects_Idminimum_id;
>/** This is the maximum valid id of this object class. */
>Objects_Idmaximum_id;
> +  /** This points to the table of local objects. */
> +  Objects_Control **local_table;
>/** This is the maximum number of objects in this class. */
>Objects_Maximum   maximum;
> +  /** This is the number of objects on the Inactive list. */
> +  Objects_Maximum   inactive;
> +  /** This is the number of objects in a block. */
> +  Objects_Maximum   allocation_size;
> +  /** This is the maximum length of names. */
> +  uint16_t  name_length;
> +  /** This field indicates the API of this object class. */
> +  uint8_t   the_api;
> +  /** This is the class of this object set. */
> +  uint8_t   the_class;
>/** This is true if names are strings. */
>bool  is_string;
>/** This is the true if unlimited objects in this class. */
>bool  auto_extend;
> -  /** This is the number of objects in a block. */
> -  Objects_Maximum   allocation_size;
>/** This is the size in bytes of each object instance. */
>size_tsize;
> -  /** This points to the table of local objects. */
> -  Objects_Control **local_table;
>/** This is the chain of inactive control blocks. */
>Chain_Control Inactive;
> -  /** This is the number of objects on the Inactive list. */
> -  Objects_Maximum   inactive;
>/** This is the number of inactive objects per block. */
> -  uint32_t *inactive_per_block;
> +  Objects_Maximum  *inactive_per_block;
>/** This is a table to the chain of inactive object memory blocks. */
> -  void**object_blocks;
> -  /** This is the maximum length of names. */
> -  uint16_t  name_length;
> +  Objects_Control **object_blocks;
>#if defined(RTEMS_MULTIPROCESSING)
>  /** This is this object class' method called when extracting a
> thread. */
>  Objects_Thread_queue_Extract_callout extract;
> diff --git a/cpukit/score/src/objectextendinformation.c
> b/cpukit/score/src/objectextendinformation.c
> index f4ac11b..d2ee7fd 100644
> --- a/cpukit/score/src/objectextendinformation.c
> +++ b/cpukit/score/src/objectextendinformation.c
> @@ -51,8 +51,8 @@ void _Objects_Extend_information(
>uint32_t  minimum_index;
>uint32_t  index;
>uint32_t  maximum;
> -  size_tblock_size;
> -  void *new_object_block;
> +  size_tobject_block_size;
> +  Objects_Control  *new_object_block;
>bool  do_extend;
>
>_Assert(
> @@ -100,13 +100,13 @@ void _Objects_Extend_information(
> * Allocate the name table, and the objects and if it fails either
> return or
> * generate a fatal error depending on auto-extending being active.
> */
> -  block_size = information->allocation_size * information->size;
> +  object_block_size = information->allocation_size * information->size;
>if ( information->auto_extend ) {
> -new_object_block = _Workspace_Allocate( block_size );
> +new_object_block = _Workspace_Allocate( object_block_size );
>  if ( !new_object_block )
>return;
>} else {
> -new_object_block = _Workspace_Allocate_or_fatal_error( block_size );
> +new_object_block = _Workspace_Allocate_or_fatal_error(
> object_block_size );
>}
>
>/*
> @@ -114,13 +114,13 @@ void _Objects_Extend_information(
> */
>if ( do_extend ) {
>  ISR_lock_Context  lock_context;
> -void**object_blocks;
> -uint32_t *inactive_per_block;
> +Obj

Re: [PATCH 2/3] score: Simplify _Objects_Initialize_information()

2018-11-06 Thread Chris Johns
On 06/11/2018 23:37, Sebastian Huber wrote:
> There is no need to make the minimum identifier dependent on the maximum
> per allocation.
> ---
>  cpukit/score/src/objectinitializeinformation.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/cpukit/score/src/objectinitializeinformation.c 
> b/cpukit/score/src/objectinitializeinformation.c
> index 23c7819bfa..9905349213 100644
> --- a/cpukit/score/src/objectinitializeinformation.c
> +++ b/cpukit/score/src/objectinitializeinformation.c
> @@ -39,7 +39,6 @@ void _Objects_Do_initialize_information(
>  )
>  {
>static Objects_Control *null_local_table = NULL;
> -  uint32_tminimum_index;
>Objects_Maximum maximum_per_allocation;
>  
>information->the_api= the_api;
> @@ -88,9 +87,8 @@ void _Objects_Do_initialize_information(
>/*
> *  Calculate minimum and maximum Id's
> */
> -  minimum_index = (maximum_per_allocation == 0) ? 0 : 1;

I am not sure you can remove this line. Something does not feel right, it was
long ago I wrote the original change and I seem to remember I thought the same
things and added this code after lots of testing. It may be this is not needed
with the way the code initialises managers now, I am not sure. What if someone
pulls in a manager but does not configure any resources?

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


Re: [PATCH 1/3] spconfig02: New test program

2018-11-06 Thread Chris Johns
Hi

Could the top line of the commit please say what the test is for or even the
area? I have to read the patch to figure this out. For example:

  spconfig02: check object create calls fail with expected status codes
  This is a new test.

This is another from GCI pushed today ...

 https://lists.rtems.org/pipermail/vc/2018-November/015093.html

The top line is suitable for the body of the commit message.

:)

Spelling correction below.

Chris

On 06/11/2018 23:37, Sebastian Huber wrote:
> ---
>  testsuites/sptests/Makefile.am   |   9 ++
>  testsuites/sptests/configure.ac  |   1 +
>  testsuites/sptests/spconfig02/init.c | 227 
> +++
>  testsuites/sptests/spconfig02/spconfig02.doc |  23 +++
>  testsuites/sptests/spconfig02/spconfig02.scn |   7 +
>  5 files changed, 267 insertions(+)
>  create mode 100644 testsuites/sptests/spconfig02/init.c
>  create mode 100644 testsuites/sptests/spconfig02/spconfig02.doc
>  create mode 100644 testsuites/sptests/spconfig02/spconfig02.scn
> 
> diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
> index 7a182430b0..80680dfe83 100644
> --- a/testsuites/sptests/Makefile.am
> +++ b/testsuites/sptests/Makefile.am
> @@ -717,6 +717,15 @@ spconfig01_CPPFLAGS = $(AM_CPPFLAGS) 
> $(TEST_FLAGS_spconfig01) \
>   $(support_includes)
>  endif
>  
> +if TEST_spconfig02
> +sp_tests += spconfig02
> +sp_screens += spconfig02/spconfig02.scn
> +sp_docs += spconfig02/spconfig02.doc
> +spconfig02_SOURCES = spconfig02/init.c
> +spconfig02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spconfig02) \
> + $(support_includes)
> +endif
> +
>  if TEST_spconsole01
>  sp_tests += spconsole01
>  sp_screens += spconsole01/spconsole01.scn
> diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
> index 36b3a17ecd..e725b39067 100644
> --- a/testsuites/sptests/configure.ac
> +++ b/testsuites/sptests/configure.ac
> @@ -118,6 +118,7 @@ RTEMS_TEST_CHECK([spchain])
>  RTEMS_TEST_CHECK([spclock_err01])
>  RTEMS_TEST_CHECK([spclock_err02])
>  RTEMS_TEST_CHECK([spconfig01])
> +RTEMS_TEST_CHECK([spconfig02])
>  RTEMS_TEST_CHECK([spconsole01])
>  RTEMS_TEST_CHECK([spcontext01])
>  RTEMS_TEST_CHECK([spcoverage])
> diff --git a/testsuites/sptests/spconfig02/init.c 
> b/testsuites/sptests/spconfig02/init.c
> new file mode 100644
> index 00..1bde941c74
> --- /dev/null
> +++ b/testsuites/sptests/spconfig02/init.c
> @@ -0,0 +1,227 @@
> +/*
> + * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.com/license/LICENSE.
> + */
> +
> +#define _GNU_SOURCE
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include 
> +
> +#include 
> +
> +const char rtems_test_name[] = "SPCONFIG 2";
> +
> +static const rtems_name name = rtems_build_name('N', 'A', 'M', 'E');
> +
> +static void test_barrier(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +
> +  sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id);
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_message_queue(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +
> +  sc = rtems_message_queue_create(
> +name,
> +1,
> +1,
> +RTEMS_DEFAULT_ATTRIBUTES,
> +&id
> +  );
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_partition(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +  long buf[32];
> +
> +  sc = rtems_partition_create(
> +name,
> +buf,
> +sizeof(buf),
> +sizeof(buf),
> +RTEMS_DEFAULT_ATTRIBUTES,
> +&id
> +  );
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_rate_monotonic(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +
> +  sc = rtems_rate_monotonic_create(name, &id);
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_region(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +  long buf[32];
> +
> +  sc = rtems_region_create(
> +name,
> +buf,
> +sizeof(buf),
> +1,
> +RTEMS_DEFAULT_ATTRIBUTES,
> +&id
> +  );
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_semaphore(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +
> +  sc = rtems_semaphore_create(
> +name,
> +0,
> +RTEMS_DEFAULT_ATTRIBUTES,
> +0,
> +&id
> +  );
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_task(void)
> +{
> +  rtems_status_code sc;
> +  rtems_id id;
> +
> +  sc = rtems_task_create(
> +name,
> +1,
> +RTEMS_MINIMUM_STACK_SIZE,
> +RTEMS_DEFAULT_MODES,
> +RTEMS_DEFAULT_ATTRIBUTES,
> +&id
> +  );
> +  rtems_test_assert(sc == RTEMS_TOO_MANY);
> +}
> +
> +static void test_timer(void)
> +{
> +  rtems_st

[PATCH 2/2] tester: Update the Python TFTP server to fix Python3 issues.

2018-11-06 Thread chrisj
From: Chris Johns 

Updated to af2f2fe89a3bf45748b78703820efb0986a8207a.
Repo is https://github.com/msoulier/tftpy.git
---
 tester/rt/tftpy/TftpClient.py|   9 +-
 tester/rt/tftpy/TftpContexts.py  |  47 ++--
 tester/rt/tftpy/TftpPacketFactory.py |   9 +-
 tester/rt/tftpy/TftpPacketTypes.py   | 217 ---
 tester/rt/tftpy/TftpServer.py|  24 ++--
 tester/rt/tftpy/TftpShared.py|  52 ++---
 tester/rt/tftpy/TftpStates.py|  53 +
 tester/rt/tftpy/__init__.py  |  23 ++--
 8 files changed, 241 insertions(+), 193 deletions(-)

diff --git a/tester/rt/tftpy/TftpClient.py b/tester/rt/tftpy/TftpClient.py
index 2763dda..eb82c05 100644
--- a/tester/rt/tftpy/TftpClient.py
+++ b/tester/rt/tftpy/TftpClient.py
@@ -1,13 +1,18 @@
+# vim: ts=4 sw=4 et ai:
+# -*- coding: utf8 -*-
 """This module implements the TFTP Client functionality. Instantiate an
 instance of the client, and then use its upload or download method. Logging is
 performed via a standard logging object set in TftpShared."""
 
-from __future__ import absolute_import, division, print_function, 
unicode_literals
+
 import types
+import logging
 from .TftpShared import *
 from .TftpPacketTypes import *
 from .TftpContexts import TftpContextClientDownload, TftpContextClientUpload
 
+log = logging.getLogger('tftpy.TftpClient')
+
 class TftpClient(TftpSession):
 """This class is an implementation of a tftp client. Once instantiated, a
 download can be initiated via the download() method, or an upload via the
@@ -23,7 +28,7 @@ class TftpClient(TftpSession):
 self.localip = localip
 if 'blksize' in self.options:
 size = self.options['blksize']
-tftpassert(types.IntType == type(size), "blksize must be an int")
+tftpassert(int == type(size), "blksize must be an int")
 if size < MIN_BLKSIZE or size > MAX_BLKSIZE:
 raise TftpException("Invalid blksize: %d" % size)
 
diff --git a/tester/rt/tftpy/TftpContexts.py b/tester/rt/tftpy/TftpContexts.py
index 271441b..da85886 100644
--- a/tester/rt/tftpy/TftpContexts.py
+++ b/tester/rt/tftpy/TftpContexts.py
@@ -1,3 +1,5 @@
+# vim: ts=4 sw=4 et ai:
+# -*- coding: utf8 -*-
 """This module implements all contexts for state handling during uploads and
 downloads, the main interface to which being the TftpContext base class.
 
@@ -8,12 +10,18 @@ the next packet in the transfer, and returns a state object 
until the transfer
 is complete, at which point it returns None. That is, unless there is a fatal
 error, in which case a TftpException is returned instead."""
 
-from __future__ import absolute_import, division, print_function, 
unicode_literals
+
 from .TftpShared import *
 from .TftpPacketTypes import *
 from .TftpPacketFactory import TftpPacketFactory
 from .TftpStates import *
-import socket, time, sys
+import socket
+import time
+import sys
+import os
+import logging
+
+log = logging.getLogger('tftpy.TftpContext')
 
 ###
 # Utility classes
@@ -120,13 +128,14 @@ class TftpContext(object):
 def start(self):
 raise NotImplementedError("Abstract method")
 
-def end(self):
+def end(self, close_fileobj=True):
 """Perform session cleanup, since the end method should always be
 called explicitely by the calling code, this works better than the
-destructor."""
-log.debug("in TftpContext.end")
+destructor.
+Set close_fileobj to False so fileobj can be returned open."""
+log.debug("in TftpContext.end - closing socket")
 self.sock.close()
-if self.fileobj is not None and not self.fileobj.closed:
+if close_fileobj and self.fileobj is not None and not 
self.fileobj.closed:
 log.debug("self.fileobj is open - closing")
 self.fileobj.close()
 
@@ -159,7 +168,7 @@ class TftpContext(object):
 try:
 (buffer, (raddress, rport)) = self.sock.recvfrom(MAX_BLKSIZE)
 except socket.timeout:
-log.warn("Timeout waiting for traffic, retrying...")
+log.warning("Timeout waiting for traffic, retrying...")
 raise TftpTimeout("Timed-out waiting for traffic")
 
 # Ok, we've received a packet. Log it.
@@ -173,11 +182,11 @@ class TftpContext(object):
 
 # Check for known "connection".
 if raddress != self.address:
-log.warn("Received traffic from %s, expected host %s. Discarding"
+log.warning("Received traffic from %s, expected host %s. 
Discarding"
 % (raddress, self.host))
 
 if self.tidport and self.tidport != rport:
-log.warn("Received traffic from %s:%s but we're "
+log.warning("Received traffic from %s:%s but we're "
 "connected to %s:%s. Discarding."
 % (raddress, rport,
   

[PATCH 1/2] python: Provide support to select a valid python version.

2018-11-06 Thread chrisj
From: Chris Johns 

- Update imports after wrapping the code.
- Fix python3 issues.
- Fix config path issues for in repo and install runs.

Closes #3537
---
 rtemstoolkit/configuration.py  | 30 +--
 rtemstoolkit/python-wrapper.sh | 54 ++
 rtemstoolkit/rtems.py  | 32 +++--
 rtemstoolkit/wscript   |  3 +++
 tester/rt/check.py | 19 ---
 tester/rt/cmd-bsp-builder.py   | 45 +++
 tester/rt/cmd-run.py   | 44 ++
 tester/rt/cmd-test.py  | 45 +++
 tester/rt/config.py|  6 ++---
 tester/rt/console.py   |  4 ++--
 tester/rt/coverage.py  |  2 +-
 tester/rt/gdb.py   | 12 ++
 tester/rt/run.py   | 19 ++-
 tester/rt/test.py  | 16 ++---
 tester/rt/tftp.py  |  9 +--
 tester/rtems-bsp-builder   | 29 +++
 tester/rtems-run   | 29 +++
 tester/rtems-test  | 29 +++
 tester/wscript |  3 +++
 19 files changed, 308 insertions(+), 122 deletions(-)
 create mode 100644 rtemstoolkit/python-wrapper.sh
 create mode 100755 tester/rt/cmd-bsp-builder.py
 create mode 100755 tester/rt/cmd-run.py
 create mode 100755 tester/rt/cmd-test.py

diff --git a/rtemstoolkit/configuration.py b/rtemstoolkit/configuration.py
index 10d97e5..3b03296 100644
--- a/rtemstoolkit/configuration.py
+++ b/rtemstoolkit/configuration.py
@@ -37,18 +37,20 @@ from __future__ import print_function
 import os
 import re
 
-try:
-import configparser
-except:
-import ConfigParser as configparser
-
 from rtemstoolkit import error
 from rtemstoolkit import path
 
 class configuration:
 
-def __init__(self):
-self.config = configparser.ConfigParser()
+def __init__(self, raw = True):
+self.raw = True
+try:
+import configparser
+self.config = configparser.ConfigParser(strict = False)
+except:
+# python2
+import ConfigParser as configparser
+self.config = configparser.ConfigParser()
 self.ini = None
 self.macro_filter = re.compile('\$\{.+\}')
 
@@ -66,12 +68,15 @@ class configuration:
 for section in self.config.sections():
 s += [' [%s]' % (section)]
 for option in self.config.options(section):
-s += ['  %s = %s' % (option, self.config.get(section, option))]
+s += ['  %s = %s' % (option,
+ self.config.get(section,
+ option,
+ raw = self.raw))]
 return os.linesep.join(s)
 
 def get_item(self, section, label, err = True):
 try:
-rec = self.config.get(section, label).replace(os.linesep, ' ')
+rec = self.config.get(section, label, raw = 
self.raw).replace(os.linesep, ' ')
 except:
 if err:
 raise error.general('config: no "%s" found in "%s"' % (label, 
section))
@@ -89,7 +94,8 @@ class configuration:
 raise error.general('config: interpolation is 
${section:value}: %s' % (m))
 try:
 ref = self.config.get(section_value[0],
-  section_value[1]).replace(os.linesep, ' 
')
+  section_value[1],
+  raw = self.raw).replace(os.linesep, ' ')
 rec = rec.replace(m, ref)
 except:
 pass
@@ -98,7 +104,7 @@ class configuration:
 def get_items(self, section, err = True, flatten = True):
 try:
 items = []
-for name, key in self.config.items(section):
+for name, key in self.config.items(section, raw = self.raw):
 if flatten:
 items += [(name, key.replace(os.linesep, ' '))]
 else:
@@ -117,7 +123,7 @@ class configuration:
 
 def get_item_names(self, section, err = True):
 try:
-return [item[0] for item in self.config.items(section)]
+return [item[0] for item in self.config.items(section, raw = 
self.raw)]
 except:
 if err:
 raise error.general('config: section "%s" not found' % 
(section))
diff --git a/rtemstoolkit/python-wrapper.sh b/rtemstoolkit/python-wrapper.sh
new file mode 100644
index 000..105873f
--- /dev/null
+++ b/rtemstoolkit/python-wrapper.sh
@@ -0,0 +1,54 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2018 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binar

[PATCH] testsuite: Add python verison support to rtems-test-check.py

2018-11-06 Thread chrisj
From: Chris Johns 

Closes #3579
---
 testsuites/aclocal/rtems-test-check.m4 |  2 +-
 testsuites/rtems-test-check| 57 ++
 testsuites/rtems-test-check.py | 47 ++--
 3 files changed, 95 insertions(+), 11 deletions(-)
 create mode 100755 testsuites/rtems-test-check

diff --git a/testsuites/aclocal/rtems-test-check.m4 
b/testsuites/aclocal/rtems-test-check.m4
index a46c4abb20..36a917b3e8 100644
--- a/testsuites/aclocal/rtems-test-check.m4
+++ b/testsuites/aclocal/rtems-test-check.m4
@@ -5,7 +5,7 @@ AC_DEFUN([RTEMS_TEST_CHECK],
 [AC_REQUIRE([RTEMS_ENV_RTEMSBSP])
  AC_REQUIRE([RTEMS_SOURCE_TOP])
  AC_MSG_CHECKING([${RTEMS_CPU}/${RTEMS_BSP} $1 test])
- tcheck="${RTEMS_SOURCE_ROOT}/testsuites/rtems-test-check.py"
+ tcheck="${RTEMS_SOURCE_ROOT}/testsuites/rtems-test-check"
  tdata="${RTEMS_BSP}-testsuite.tcfg"
  
tincludes="${RTEMS_SOURCE_ROOT}/bsps/${RTEMS_CPU}/${RTEMS_BSP_FAMILY}/config:${RTEMS_SOURCE_ROOT}/testsuites"
  if test -f $tcheck; then
diff --git a/testsuites/rtems-test-check b/testsuites/rtems-test-check
new file mode 100755
index 00..e7fd08dde5
--- /dev/null
+++ b/testsuites/rtems-test-check
@@ -0,0 +1,57 @@
+#! /bin/sh
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2018 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# This script wraps python finding a suitable version to use.
+#
+base=$(dirname $0)
+PYTHON_CMD=${base}/rtems-test-check.py
+set -e
+if test ! -f $PYTHON_CMD; then
+  echo "error: RTEMS Testsuite python command not found: $PYTHON_CMD"
+  exit 5
+fi
+for py in python2 python3 python
+do
+  set +e
+  py_cmd=$(command -v $py)
+  set -e
+  if test -n "$RTEMS_PYTHON_OVERRIDE"; then
+if test "$RTEMS_PYTHON_OVERRIDE" != "$py"; then
+  py_cmd=""
+fi
+  fi
+  if test -n "$py_cmd"; then
+exec $py_cmd $PYTHON_CMD $0 $*
+  fi
+done
+echo "error: RTEMS Testsuite no valid python found"
+exit 5
diff --git a/testsuites/rtems-test-check.py b/testsuites/rtems-test-check.py
index 847aab05ae..0a4970a4ab 100755
--- a/testsuites/rtems-test-check.py
+++ b/testsuites/rtems-test-check.py
@@ -1,7 +1,32 @@
 #! /usr/bin/env python
 #
-# Copyright 2017 Chris Johns 
-# All rights reserved
+# Copyright 2018 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWA

Re: [PATCH] Coverage: add the style and js files to the symbol-set report directory

2018-11-06 Thread Chris Johns
On 05/11/2018 05:14, Vijay Kumar Banerjee wrote:
> On Sun, 28 Oct 2018 at 21:54, Vijay Kumar Banerjee  > wrote:
> 
> I could run with copy_tree using this workaround 
> 
> ===
> diff --git a/rtemstoolkit/path.py b/rtemstoolkit/path.py
> index 760f4bd..df553b3 100644
> --- a/rtemstoolkit/path.py
> +++ b/rtemstoolkit/path.py
> @@ -191,10 +191,10 @@ def copy_tree(src, dst):
>      hsrc = host(src)
>      hdst = host(dst)
>  
> -    if os.path.exists(src):
> +    if os.path.exists(src) and os.path.isdir(src):
>          names = os.listdir(src)
>      else:
> -        name = []
> +        names = []
>  
>      if not os.path.isdir(dst):
>          os.makedirs(dst)
> 
> =
> 
> But there's still an issue with the file permission as it uses copystat 
> which 
> copies the permission bits which is not required in this case. 
> It requires a manual `rm` with root permission before rerunning the 
> coverage.
> 
>  ping :) 
> 

Sorry about the delay. This looks find, can you please provide a patch.

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

Re: [rtems commit] psxtmonce01: New test written by Himanshu40 as part of GCI2018

2018-11-06 Thread Sebastian Huber
It would be nice if GCI2018 patches are sent to devel@rtems.org for 
review before they are committed.


On 07/11/2018 01:36, Joel Sherrill wrote:

Module:rtems
Branch:master
Commit:9bb395167a1cc7d8551d217825313bffcd0d8e1b
Changeset: 
http://git.rtems.org/rtems/commit/?id=9bb395167a1cc7d8551d217825313bffcd0d8e1b

Author:Himanshu40 
Date:  Wed Nov  7 00:17:10 2018 +0530

psxtmonce01: New test written by Himanshu40 as part of GCI2018

---

  testsuites/psxtmtests/Makefile.am | 11 +++
  testsuites/psxtmtests/configure.ac|  1 +
  testsuites/psxtmtests/psxtmonce01/Makefile.am | 27 
  testsuites/psxtmtests/psxtmonce01/init.c  | 82 +++
  testsuites/psxtmtests/psxtmonce01/psxtmonce01.doc | 18 +
  5 files changed, 139 insertions(+)

diff --git a/testsuites/psxtmtests/Makefile.am 
b/testsuites/psxtmtests/Makefile.am
index 2669107..1607ac6 100644
--- a/testsuites/psxtmtests/Makefile.am
+++ b/testsuites/psxtmtests/Makefile.am
@@ -338,6 +338,17 @@ psxtmnanosleep02_CPPFLAGS = $(AM_CPPFLAGS) \
-DOPERATION_COUNT=$(OPERATION_COUNT)
  endif
  
+if TEST_psxtmonce01

+psxtm_tests += psxtmonce01
+psxtm_docs += psxtmonce01/psxtmonce01.doc
+psxtmonce01_SOURCES = psxtmonce01/init.c \
+   ../tmtests/include/timesys.h ../support/src/tmtests_empty_function.c \
+   ../support/src/tmtests_support.c
+psxtmonce01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxtmonce01) \
+   $(support_includes) -I$(top_srcdir)/../tmtests/include \
+   -DOPERATION_COUNT=$(OPERATION_COUNT)
+endif
+
  if TEST_psxtmrwlock01
  psxtm_tests += psxtmrwlock01
  psxtm_docs += psxtmrwlock01/psxtmrwlock01.doc
diff --git a/testsuites/psxtmtests/configure.ac 
b/testsuites/psxtmtests/configure.ac
index 59192d0..0c3b143 100644
--- a/testsuites/psxtmtests/configure.ac
+++ b/testsuites/psxtmtests/configure.ac
@@ -59,6 +59,7 @@ RTEMS_TEST_CHECK([psxtmmutex06])
  RTEMS_TEST_CHECK([psxtmmutex07])
  RTEMS_TEST_CHECK([psxtmnanosleep01])
  RTEMS_TEST_CHECK([psxtmnanosleep02])
+RTEMS_TEST_CHECK([psxtmonce01])
  RTEMS_TEST_CHECK([psxtmrwlock01])
  RTEMS_TEST_CHECK([psxtmrwlock02])
  RTEMS_TEST_CHECK([psxtmrwlock03])
diff --git a/testsuites/psxtmtests/psxtmonce01/Makefile.am 
b/testsuites/psxtmtests/psxtmonce01/Makefile.am
new file mode 100644
index 000..242e393
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmonce01/Makefile.am
@@ -0,0 +1,27 @@
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxtmonce01
+psxtmonce01_SOURCES  = init.c
+psxtmonce01_SOURCES += ../../tmtests/include/timesys.h
+psxtmonce01_SOURCES += ../../support/src/tmtests_empty_function.c
+psxtmonce01_SOURCES += ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = psxtmonce01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+OPERATION_COUNT = @OPERATION_COUNT@
+AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include
+AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT)
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxtmonce01_OBJECTS) $(psxtmonce01_LDADD)
+LINK_LIBS = $(psxtmonce01_LDLIBS)
+
+psxtmonce01$(EXEEXT): $(psxtmonce01_OBJECTS) $(psxtmonce01_DEPENDENCIES)
+   @rm -f psxtmonce01$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am


This testsuites/psxtmtests/psxtmonce01/Makefile.am is superfluous.


diff --git a/testsuites/psxtmtests/psxtmonce01/init.c 
b/testsuites/psxtmtests/psxtmonce01/init.c
new file mode 100644
index 000..5f8391a
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmonce01/init.c
@@ -0,0 +1,82 @@
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak GCI 2018
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 
SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include "test_support.h"
+
+const char rtems_test_name[] = "PSXTMONCE01";
+
+/* forward declarations to avoid warnings */
+void *POSIX_Init(void *argument);
+void benchmark_first_time(void);
+void initRoutine(void);


Why not use static functions?


+
+pthread_once_t once_control = PTHREAD_ONCE_INIT;
+
+void initRoutine(void)
+{
+}
+
+void benchmark_first_time(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+  status = pthread_once( &once_control, initRoutine );
+  end_time = benchmark_timer_r

Re: [rtems commit] psxtmonce01: New test written by Himanshu40 as part of GCI2018

2018-11-06 Thread Chris Johns
On 07/11/2018 17:36, Sebastian Huber wrote:
> It would be nice if GCI2018 patches are sent to devel@rtems.org for review
> before they are committed.

I agree. I will post to the gci mentors list asking if this can be done.

Chris

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


Re: [PATCH] Coverage: add the style and js files to the symbol-set report directory

2018-11-06 Thread Vijay Kumar Banerjee
On Wed, 7 Nov 2018 at 10:47, Chris Johns  wrote:

> On 05/11/2018 05:14, Vijay Kumar Banerjee wrote:
> > On Sun, 28 Oct 2018 at 21:54, Vijay Kumar Banerjee <
> vijaykumar9...@gmail.com
> > > wrote:
> >
> > I could run with copy_tree using this workaround
> >
> > ===
> > diff --git a/rtemstoolkit/path.py b/rtemstoolkit/path.py
> > index 760f4bd..df553b3 100644
> > --- a/rtemstoolkit/path.py
> > +++ b/rtemstoolkit/path.py
> > @@ -191,10 +191,10 @@ def copy_tree(src, dst):
> >  hsrc = host(src)
> >  hdst = host(dst)
> >
> > -if os.path.exists(src):
> > +if os.path.exists(src) and os.path.isdir(src):
> >  names = os.listdir(src)
> >  else:
> > -name = []
> > +names = []
> >
> >  if not os.path.isdir(dst):
> >  os.makedirs(dst)
> >
> > =
> >
> > But there's still an issue with the file permission as it uses
> copystat which
> > copies the permission bits which is not required in this case.
> > It requires a manual `rm` with root permission before rerunning the
> coverage.
> >
> >  ping :)
> >
>
> Sorry about the delay. This looks find, can you please provide a patch.
>
> Hi
I just tried it and it doesn't work unfortunately, I have added another
line of modification here
and now it's working, I'll send two separate patches each for path and
coverage. Please review.

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

[PATCH 2/2] rtemstoolkit/path : Add support to copy single files

2018-11-06 Thread Vijay Kumar Banerjee
---
 rtemstoolkit/path.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/rtemstoolkit/path.py b/rtemstoolkit/path.py
index 760f4bd..83fb361 100644
--- a/rtemstoolkit/path.py
+++ b/rtemstoolkit/path.py
@@ -191,10 +191,11 @@ def copy_tree(src, dst):
 hsrc = host(src)
 hdst = host(dst)
 
-if os.path.exists(src):
+if os.path.exists(src) and os.path.isdir(src):
 names = os.listdir(src)
 else:
-name = []
+names = [basename(src)]
+src = dirname(src)
 
 if not os.path.isdir(dst):
 os.makedirs(dst)
-- 
2.17.2

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


[PATCH 1/2] Coverage: add the style and js files to the symbol-set report directory

2018-11-06 Thread Vijay Kumar Banerjee
---
 tester/rt/coverage.py | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 978a8c4..cfac464 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -201,23 +201,14 @@ class report_gen_html:
 index_content = self._prepare_index_content(partial_reports)
 self._create_index_file(head_section,index_content)
 
-def add_covoar_src_path(self):
+def add_covoar_css(self):
 table_js_path = path.join(self.covoar_src_path, 'table.js')
 covoar_css_path = path.join(self.covoar_src_path, 'covoar.css')
 for symbol_set in self.symbol_sets:
 symbol_set_dir = path.join(self.build_dir,
self.bsp + '-coverage', symbol_set)
-html_files = os.listdir(symbol_set_dir)
-for html_file in html_files:
-html_file = path.join(symbol_set_dir, html_file)
-if path.exists(html_file) and 'html' in html_file:
-with open(html_file, 'r') as f:
-file_data = f.read()
-file_data = file_data.replace('table.js', table_js_path)
-file_data = file_data.replace('covoar.css',
-  covoar_css_path)
-with open(html_file, 'w') as f:
-f.write(file_data)
+path.copy_tree(covoar_css_path, symbol_set_dir)
+path.copy_tree(table_js_path, symbol_set_dir)
 
 class build_path_generator(object):
 '''
@@ -402,7 +393,7 @@ class coverage_run(object):
  self.rtdir,
  self.macros['bsp'])
 report.generate()
-report.add_covoar_src_path()
+report.add_covoar_css()
 
 def _cleanup(self):
 if not self.no_clean:
-- 
2.17.2

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