[PATCH 1/3] spconfig02: New test program
Chris Johns
chrisj at rtems.org
Wed Nov 7 00:53:27 UTC 2018
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 0000000000..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
> + * <rtems at embedded-brains.de>
> + *
> + * 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 <rtems.h>
> +
> +#include <tmacros.h>
> +
> +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 {
> + rtems_test_assert(name_of_id == rtems_build_name('I', 'D', 'L', 'E'));
> + rtems_test_assert(!found[1]);
> + found[1] = true;
> + }
> + } else {
> + rtems_test_assert(sc == RTEMS_INVALID_ID);
> + }
> +}
> +
> +static void test_some_id_to_name(void)
> +{
> + rtems_id api;
> + bool found[2];
> +
> + found[0] = false;
> + found[1] = false;
> +
> + for (api = 0; api < 8; ++api) {
> + rtems_id cls;
> +
> + for (cls = 0; cls < 32; ++cls) {
> + test_id_to_name(api, cls, 0, found);
> + test_id_to_name(api, cls, 1, found);
> + test_id_to_name(api, cls, 2, found);
> + test_id_to_name(api, cls, 65535, found);
> + test_id_to_name(api, cls, 65536, found);
> + }
> + }
> +
> + rtems_test_assert(found[0]);
> + rtems_test_assert(found[1]);
> +}
> +
> +static void Init(rtems_task_argument arg)
> +{
> + rtems_print_printer_printk(&rtems_test_printer);
> + TEST_BEGIN();
> + test_barrier();
> + test_message_queue();
> + test_partition();
> + test_rate_monotonic();
> + test_region();
> + test_semaphore();
> + test_task();
> + test_timer();
> + test_user_extensions();
> + test_some_id_to_name();
> + TEST_END();
> + rtems_test_exit(0);
> +}
> +
> +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
> +
> +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
> +
> +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
> +
> +#define CONFIGURE_MAXIMUM_TASKS 1
> +
> +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
> +
> +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> +
> +#define CONFIGURE_INIT
> +
> +#include <rtems/confdefs.h>
> diff --git a/testsuites/sptests/spconfig02/spconfig02.doc b/testsuites/sptests/spconfig02/spconfig02.doc
> new file mode 100644
> index 0000000000..0bad04f758
> --- /dev/null
> +++ b/testsuites/sptests/spconfig02/spconfig02.doc
> @@ -0,0 +1,23 @@
> +This file describes the directives and concepts tested by this test set.
> +
> +test set name: spconfig02
> +
> +directives:
> +
> + - rtems_barrier_create()
> + - rtems_extension_create()
> + - rtems_message_queue_create()
> + - rtems_object_get_classic_name()
> + - rtems_partition_create()
> + - rtems_rate_monotonic_create()
> + - rtems_region_create()
> + - rtems_semaphore_create()
> + - rtems_task_create()
> + - rtems_timer_create()
> +
> +concepts:
> +
> + - Ensure that the creation of Classic API objects failes with the expected
fails not failes
> + status code in the default configuration.
> + - Ensure that only the expected objects are present in the default
> + configuration via rtems_object_get_classic_name().
> diff --git a/testsuites/sptests/spconfig02/spconfig02.scn b/testsuites/sptests/spconfig02/spconfig02.scn
> new file mode 100644
> index 0000000000..39628a8de2
> --- /dev/null
> +++ b/testsuites/sptests/spconfig02/spconfig02.scn
> @@ -0,0 +1,7 @@
> +*** BEGIN OF TEST SPCONFIG 2 ***
> +*** TEST VERSION: 5.0.0.5f0d0d2d272bebb13f63efe70cb186bbf7715a89
> +*** TEST STATE: EXPECTED-PASS
> +*** TEST BUILD:
> +*** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 279e47eab88299b0123be5a1e4446fe4a9329a54, Newlib 08eab6396f678cf5e5968acaed0bae9fd129983b)
> +
> +*** END OF TEST SPCONFIG 2 ***
>
More information about the devel
mailing list