[PATCH] tests: Refactor parallel test execution

Gedare Bloom gedare at rtems.org
Wed Mar 4 14:17:04 UTC 2015


It seems that these changes to test.h and the new testparallel.c
belong in the testsuites/smptests area, perhaps in a shared/
subdirectory. Certainly I don't see why testparallel.c is in sapi. (I
don't recall why we have testing framework in the sapi though...)

On Wed, Mar 4, 2015 at 7:33 AM, Alexander Krutwig
<alexander.krutwig at embedded-brains.de> wrote:
> ---
>  cpukit/sapi/Makefile.am                |   1 +
>  cpukit/sapi/include/rtems/test.h       | 109 ++++++++++++++
>  cpukit/sapi/src/testparallel.c         | 151 +++++++++++++++++++
>  testsuites/smptests/smpatomic01/init.c | 264 ++++++++++++++-------------------
>  4 files changed, 375 insertions(+), 150 deletions(-)
>  create mode 100644 cpukit/sapi/src/testparallel.c
>
> diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am
> index a7eaad5..b58b3a2 100644
> --- a/cpukit/sapi/Makefile.am
> +++ b/cpukit/sapi/Makefile.am
> @@ -42,6 +42,7 @@ libsapi_a_SOURCES += src/profilingiterate.c
>  libsapi_a_SOURCES += src/profilingreportxml.c
>  libsapi_a_SOURCES += src/testbeginend.c
>  libsapi_a_SOURCES += src/testextension.c
> +libsapi_a_SOURCES += src/testparallel.c
>  libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
>
>  include $(srcdir)/preinstall.am
> diff --git a/cpukit/sapi/include/rtems/test.h b/cpukit/sapi/include/rtems/test.h
> index 48a33a0..096b9ad 100644
> --- a/cpukit/sapi/include/rtems/test.h
> +++ b/cpukit/sapi/include/rtems/test.h
> @@ -17,6 +17,8 @@
>
>  #include <rtems.h>
>  #include <rtems/bspIo.h>
> +#include <rtems/score/atomic.h>
> +#include <rtems/score/smpbarrier.h>
>
>  #ifdef __cplusplus
>  extern "C" {
> @@ -116,6 +118,113 @@ static inline int rtems_test_endk(void)
>    return rtems_test_end_with_plugin(printk_plugin, NULL);
>  }
>
> +/**
> + * @brief Internal context for parallel job execution.
> + */
> +typedef struct {
> +  Atomic_Ulong stop;
> +  SMP_barrier_Control barrier;
> +  size_t worker_count;
I'd prefer to only see size_t to represent sizes e.g. in bytes. For
this field you can probably use uint8_t anyway? Same goes for all the
rest of the size_t here. It was size_t before, but that wasn't in a
public-facing header..

Gedare



More information about the devel mailing list