[PATCH] implementation of smp test smpmrsp02

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Sep 25 06:10:22 UTC 2019


On 24/09/2019 19:08, Ricardo Gomes (1161078) wrote:
> ---
>   testsuites/smptests/Makefile.am             |  16 ++
>   testsuites/smptests/configure.ac            |   2 +
>   testsuites/smptests/smpmrsp02/init.c        | 231 ++++++++++++++++++++
>   testsuites/smptests/smpmrsp02/smpmrsp02.doc |  15 ++
>   4 files changed, 264 insertions(+)
>   create mode 100755 testsuites/smptests/smpmrsp02/init.c
>   create mode 100644 testsuites/smptests/smpmrsp02/smpmrsp02.doc
> 
> diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am
> index 38cc87e3c5..edb6478b8f 100644
> --- a/testsuites/smptests/Makefile.am
> +++ b/testsuites/smptests/Makefile.am
> @@ -314,6 +314,18 @@ smpmrsp01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_smpmrsp01) \
>   endif
>   endif
>   
> +if HAS_SMP
> +if TEST_smpmrsp02
> +smp_tests += smpmrsp02
> +smp_screens += smpmrsp02/smpmrsp02.scn
> +smp_docs += smpmrsp02/smpmrsp02.doc
> +smpmrsp02_SOURCES = smpmrsp02/init.c
> +smpmrsp02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_smpmrsp02) \
> +	$(support_includes)
> +endif
> +endif
> +
> +

Please avoid extra blank lines.

>   if HAS_SMP
>   if TEST_smpmulticast01
>   smp_tests += smpmulticast01
> @@ -670,4 +682,8 @@ smpwakeafter01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_smpwakeafter01) \
>   endif
>   endif
>   
> +
> +
> +
>   noinst_PROGRAMS = $(smp_tests)
> +

Here also.

> diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac
> index 83b5b9fe41..6336b4e481 100644
> --- a/testsuites/smptests/configure.ac
> +++ b/testsuites/smptests/configure.ac
> @@ -60,6 +60,7 @@ RTEMS_TEST_CHECK([smplock01])
>   RTEMS_TEST_CHECK([smpmigration01])
>   RTEMS_TEST_CHECK([smpmigration02])
>   RTEMS_TEST_CHECK([smpmrsp01])
> +RTEMS_TEST_CHECK([smpmrsp02])
>   RTEMS_TEST_CHECK([smpmulticast01])
>   RTEMS_TEST_CHECK([smpmutex01])
>   RTEMS_TEST_CHECK([smpmutex02])
> @@ -93,5 +94,6 @@ RTEMS_TEST_CHECK([smpthreadpin01])
>   RTEMS_TEST_CHECK([smpunsupported01])
>   RTEMS_TEST_CHECK([smpwakeafter01])
>   
> +
>   AC_CONFIG_FILES([Makefile])
>   AC_OUTPUT
> diff --git a/testsuites/smptests/smpmrsp02/init.c b/testsuites/smptests/smpmrsp02/init.c
> new file mode 100755
> index 0000000000..c097fde50b
> --- /dev/null
> +++ b/testsuites/smptests/smpmrsp02/init.c
> @@ -0,0 +1,231 @@
> +/*
> + * SPDX-License-Identifier: BSD-2-Clause
> + *
> + * Copyright (C) 2019 Ricardo Gomes
> + *
> + * 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 OWNER 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.
> + */

License looks good. I hope you are actually the copyright owner and not 
the university.

> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include <sys/param.h>
> +#include <stdio.h>
> +#include <inttypes.h>
> +#include <rtems.h>
> +#include <rtems/libcsupport.h>
> +#include <rtems/score/schedulersmpimpl.h>

Please try to reduce the number of includes, e.g. why do you need 
<rtems/score/schedulersmpimpl.h>, <rtems/libcsupport.h>, and <sys/param.h>?

> +#include "tmacros.h"
> +
> +const char rtems_test_name[] = "SMPMRSP 2";
> +
> +#define CPU_COUNT 2
> +
> +typedef struct
> +{
> +  rtems_id init_id;
> +  rtems_id scheduler_ids[CPU_COUNT];
> +  rtems_id mrsp_id;
> +  rtems_id task_id;
> +} test_context;
> +
> +static test_context test_instance;
> +
> +static void assert_priority(rtems_id task_id, rtems_task_priority priority)
> +{
> +  rtems_status_code sc;
> +  rtems_task_priority prio;
> +
> +  sc = rtems_task_set_priority(task_id, RTEMS_CURRENT_PRIORITY, &prio);
> +  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
> +
> +  rtems_test_assert(priority == prio);
> +}

How much time to you have left for this integration work? Would it be 
possible to re-write the tests to use the new RTEMS Test Framework?

https://docs.rtems.org/branches/master/eng/test-framework.html#the-rtems-test-framework

Is it possible to place all the test cases into one test program?

The coding style is not really in line with what is already present in 
the test suite, but this would be not an issue for me.

Please make sure that the tests compile without warnings (I didn't check 
this).

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