[PATCH 2/2] libmisc/testsupport: Add RTEMS version, build and tools to the tests.

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Nov 6 06:12:37 UTC 2017


On 05/11/17 08:45, Chris Johns wrote:
> diff --git a/cpukit/libmisc/testsupport/test.h b/cpukit/libmisc/testsupport/test.h
> index d9ac6caf91..258667a923 100644
> --- a/cpukit/libmisc/testsupport/test.h
> +++ b/cpukit/libmisc/testsupport/test.h
> @@ -18,6 +18,7 @@
>   #include <rtems.h>
>   #include <rtems/printer.h>
>   #include <rtems/score/atomic.h>
> +#include <rtems/score/cpuopts.h>

This is available via <rtems.h>.

>   #include <rtems/score/smpbarrier.h>
>   
>   #ifdef __cplusplus
> @@ -58,6 +59,98 @@ void rtems_test_fatal_extension(
>     { NULL, NULL, NULL, NULL, NULL, NULL, NULL, rtems_test_fatal_extension }
>   
>   /**
> + * @brief Build of the kernel. Print the test's build state and tools.
> + */
> +#define TEST_BUILD_DEFAULT "default"
> +#if RTEMS_POSIX
> +  #define TEST_BUILD_DEFAULT ""
> +  #define TEST_BUILD_POSIX   "posix "
> +#else
> +  #define TEST_BUILD_POSIX
> +#endif
> +#if RTEMS_SMP
> +  #define TEST_BUILD_DEFAULT ""
> +  #define TEST_BUILD_SMP     "smp "
> +#else
> +  #define TEST_BUILD_SMP
> +#endif
> +#if RTEMS_MULTIPROCESSING
> +  #define TEST_BUILD_DEFAULT ""
> +  #define TEST_BUILD_MP      "mp "
> +#else
> +  #define TEST_BUILD_MP
> +#endif
> +#if RTEMS_PARAVIRT
> +  #define TEST_BUILD_DEFAULT  ""
> +  #define TEST_BUILD_PARAVIRT "paravirt "
> +#else
> +  #define TEST_BUILD_PARAVIRT
> +#endif
> +#if RTEMS_NETWORKING
> +  #define TEST_BUILD_DEFAULT    ""
> +  #define TEST_BUILD_NETWORKING "legacy-net "
> +#else
> +  #define TEST_BUILD_NETWORKING
> +#endif
> +#if RTEMS_DEBUG
> +  #define TEST_BUILD_DEFAULT ""
> +  #define TEST_BUILD_DEBUG   "debug "
> +#else
> +  #define TEST_BUILD_DEBUG
> +#endif
> +#if RTEMS_PROFILING
> +  #define TEST_BUILD_DEFAULT   ""
> +  #define TEST_BUILD_PROFILING "profiling "
> +#else
> +  #define TEST_BUILD_PROFILING
> +#endif

These defines are only used in one source file. I would move this to the 
source file.
> +
> +#define TEST_BUILD_STRING \
> +         "*** TEST BUILD: " TEST_BUILD_DEFAULT \
> +         TEST_BUILD_POSIX \
> +         TEST_BUILD_SMP \
> +         TEST_BUILD_MP \
> +         TEST_BUILD_PARAVIRT \
> +         TEST_BUILD_NETWORKING \
> +         TEST_BUILD_DEBUG \
> +         TEST_BUILD_PROFILING \
> +         "\n"
> +
> +/**
> + * @brief Tools being used to build the kernel and tests.
> + */
> +#define TEST_TOOLS_STRING "*** TEST TOOLS: " __VERSION__ "\n"
> +
> +/**
> + * @brief Test states.
> + */
> +#if (TEST_STATE_EXPECTED_FAIL && TEST_STATE_USER_INPUT) || \
> +    (TEST_STATE_EXPECTED_FAIL && TEST_STATE_INDETERMINATE) || \
> +    (TEST_STATE_EXPECTED_FAIL && TEST_STATE_BENCHMARK) || \
> +    (TEST_STATE_USER_INPUT    && TEST_STATE_INDETERMINATE) || \
> +    (TEST_STATE_USER_INPUT    && TEST_STATE_BENCHMARK) || \
> +    (TEST_STATE_INDETERMINATE && TEST_STATE_BENCHMARK)
> +  #error Test states must be unique
> +#endif

Maybe we should separate the test classification from the actual output 
and use an enum:

typedef enum {
   RTEMS_TEST_TYPE_USER_INPUT,
   RTEMS_TEST_TYPE_BENCHMARK,
  ...
} rtems_test_type;

-- 
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.huber at embedded-brains.de
PGP     : Public key available on request.

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




More information about the devel mailing list