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

Chris Johns chrisj at rtems.org
Mon Nov 6 06:29:07 UTC 2017


On 06/11/2017 17:12, Sebastian Huber wrote:
> 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>.
> 

OK.

>>   #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.

Do all tests call the begin function in libmisc? Happy to see that happen if the
begin macro goes away. Maybe that can happen after this change?

>> +
>> +#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;
> 

How would the state be passed in as an enum? The test's state is passed on a per
test bases from the .tcfg files structure which is global, and per bsp as
command line defines.

FYI I will be looking to add build qualifiers for tests that do not work on SMP.
I cannot remember which test Joel was looking at that needed this.

Chris



More information about the devel mailing list