summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-09-28 12:22:33 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-10-14 10:48:22 +0200
commit1ab93ba480cabae849c1c0a00e9650ad75d5f912 (patch)
tree20686fb90bc9cb462c2383f5cf6663aad4e0de43 /testsuites
parentscore: Simplify casts (diff)
downloadrtems-1ab93ba480cabae849c1c0a00e9650ad75d5f912.tar.bz2
score: INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED
Add the INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED fatal error in case the creation of an idle thread fails. This may happen due to a failing create extension provided by the application.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/sptests/spinternalerror02/init.c2
-rw-r--r--testsuites/validation/tr-fatal-idle-thread-create-failed.c158
-rw-r--r--testsuites/validation/tr-fatal-idle-thread-create-failed.h84
-rw-r--r--testsuites/validation/ts-fatal-idle-thread-create-failed.c90
-rw-r--r--testsuites/validation/ts-fatal-sysinit.h7
5 files changed, 340 insertions, 1 deletions
diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c
index 08aeabd3a7..f94759a99b 100644
--- a/testsuites/sptests/spinternalerror02/init.c
+++ b/testsuites/sptests/spinternalerror02/init.c
@@ -49,7 +49,7 @@ static void test_internal_error_text(void)
} while ( text != text_last );
rtems_test_assert(
- error - 3 == INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED
+ error - 3 == INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED
);
}
diff --git a/testsuites/validation/tr-fatal-idle-thread-create-failed.c b/testsuites/validation/tr-fatal-idle-thread-create-failed.c
new file mode 100644
index 0000000000..8c66f01c82
--- /dev/null
+++ b/testsuites/validation/tr-fatal-idle-thread-create-failed.c
@@ -0,0 +1,158 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseScoreThreadValFatalIdleThreadCreateFailed
+ */
+
+/*
+ * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * 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.
+ */
+
+/*
+ * This file is part of the RTEMS quality process and was automatically
+ * generated. If you find something that needs to be fixed or
+ * worded better please post a report or patch to an RTEMS mailing list
+ * or raise a bug report:
+ *
+ * https://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include "tr-fatal-idle-thread-create-failed.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseScoreThreadValFatalIdleThreadCreateFailed \
+ * spec:/score/thread/val/fatal-idle-thread-create-failed
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesFatalIdleThreadCreateFailed
+ *
+ * @brief Tests a fatal error caused by a failing task create extension.
+ *
+ * This test case performs the following actions:
+ *
+ * - The test action is carried out by configuring a task create extension
+ * which always fails.
+ *
+ * - Check that the expected fatal source is present.
+ *
+ * - Check that the expected fatal code is present.
+ *
+ * @{
+ */
+
+/**
+ * @brief Test context for
+ * spec:/score/thread/val/fatal-idle-thread-create-failed test case.
+ */
+typedef struct {
+ /**
+ * @brief This member contains a copy of the corresponding
+ * ScoreThreadValFatalIdleThreadCreateFailed_Run() parameter.
+ */
+ rtems_fatal_source source;
+
+ /**
+ * @brief This member contains a copy of the corresponding
+ * ScoreThreadValFatalIdleThreadCreateFailed_Run() parameter.
+ */
+ rtems_fatal_code code;
+} ScoreThreadValFatalIdleThreadCreateFailed_Context;
+
+static ScoreThreadValFatalIdleThreadCreateFailed_Context
+ ScoreThreadValFatalIdleThreadCreateFailed_Instance;
+
+static T_fixture ScoreThreadValFatalIdleThreadCreateFailed_Fixture = {
+ .setup = NULL,
+ .stop = NULL,
+ .teardown = NULL,
+ .scope = NULL,
+ .initial_context = &ScoreThreadValFatalIdleThreadCreateFailed_Instance
+};
+
+/**
+ * @brief The test action is carried out by configuring a task create extension
+ * which always fails.
+ */
+static void ScoreThreadValFatalIdleThreadCreateFailed_Action_0(
+ ScoreThreadValFatalIdleThreadCreateFailed_Context *ctx
+)
+{
+ /* Nothing to do */
+
+ /*
+ * Check that the expected fatal source is present.
+ */
+ T_step_eq_int( 0, ctx->source, INTERNAL_ERROR_CORE );
+
+ /*
+ * Check that the expected fatal code is present.
+ */
+ T_step_eq_ulong(
+ 1,
+ ctx->code,
+ INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED
+ );
+}
+
+void ScoreThreadValFatalIdleThreadCreateFailed_Run(
+ rtems_fatal_source source,
+ rtems_fatal_code code
+)
+{
+ ScoreThreadValFatalIdleThreadCreateFailed_Context *ctx;
+
+ ctx = &ScoreThreadValFatalIdleThreadCreateFailed_Instance;
+ ctx->source = source;
+ ctx->code = code;
+
+ ctx = T_case_begin(
+ "ScoreThreadValFatalIdleThreadCreateFailed",
+ &ScoreThreadValFatalIdleThreadCreateFailed_Fixture
+ );
+
+ T_plan( 2 );
+
+ ScoreThreadValFatalIdleThreadCreateFailed_Action_0( ctx );
+
+ T_case_end();
+}
+
+/** @} */
diff --git a/testsuites/validation/tr-fatal-idle-thread-create-failed.h b/testsuites/validation/tr-fatal-idle-thread-create-failed.h
new file mode 100644
index 0000000000..15d4c9a086
--- /dev/null
+++ b/testsuites/validation/tr-fatal-idle-thread-create-failed.h
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseScoreThreadValFatalIdleThreadCreateFailed
+ */
+
+/*
+ * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * 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.
+ */
+
+/*
+ * This file is part of the RTEMS quality process and was automatically
+ * generated. If you find something that needs to be fixed or
+ * worded better please post a report or patch to an RTEMS mailing list
+ * or raise a bug report:
+ *
+ * https://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifndef _TR_FATAL_IDLE_THREAD_CREATE_FAILED_H
+#define _TR_FATAL_IDLE_THREAD_CREATE_FAILED_H
+
+#include <rtems.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup RTEMSTestCaseScoreThreadValFatalIdleThreadCreateFailed
+ *
+ * @{
+ */
+
+/**
+ * @brief Runs the parameterized test case.
+ *
+ * @param source is the fatal source.
+ *
+ * @param code is the fatal code.
+ */
+void ScoreThreadValFatalIdleThreadCreateFailed_Run(
+ rtems_fatal_source source,
+ rtems_fatal_code code
+);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TR_FATAL_IDLE_THREAD_CREATE_FAILED_H */
diff --git a/testsuites/validation/ts-fatal-idle-thread-create-failed.c b/testsuites/validation/ts-fatal-idle-thread-create-failed.c
new file mode 100644
index 0000000000..55173f21d1
--- /dev/null
+++ b/testsuites/validation/ts-fatal-idle-thread-create-failed.c
@@ -0,0 +1,90 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesFatalIdleThreadCreateFailed
+ */
+
+/*
+ * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * 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.
+ */
+
+/*
+ * This file is part of the RTEMS quality process and was automatically
+ * generated. If you find something that needs to be fixed or
+ * worded better please post a report or patch to an RTEMS mailing list
+ * or raise a bug report:
+ *
+ * https://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tr-fatal-idle-thread-create-failed.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestSuiteTestsuitesFatalIdleThreadCreateFailed \
+ * spec:/testsuites/fatal-idle-thread-create-failed
+ *
+ * @ingroup RTEMSTestSuites
+ *
+ * @brief This validation test suite contains a test case which is triggered by
+ * a fatal error during system initialization.
+ *
+ * @{
+ */
+
+const char rtems_test_name[] = "FatalIdleThreadCreateFailed";
+
+static bool CreateTask( rtems_tcb *executing, rtems_tcb *created )
+{
+ (void) executing;
+ (void) created;
+ return false;
+}
+
+#define FATAL_SYSINIT_RUN ScoreThreadValFatalIdleThreadCreateFailed_Run
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
+
+#define FATAL_SYSINIT_INITIAL_EXTENSION { .thread_create = CreateTask }
+
+#include "ts-fatal-sysinit.h"
+
+/** @} */
diff --git a/testsuites/validation/ts-fatal-sysinit.h b/testsuites/validation/ts-fatal-sysinit.h
index 5744bc6fea..09d86d02ea 100644
--- a/testsuites/validation/ts-fatal-sysinit.h
+++ b/testsuites/validation/ts-fatal-sysinit.h
@@ -122,7 +122,14 @@ RTEMS_SYSINIT_ITEM(
#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
+#ifdef FATAL_SYSINIT_INITIAL_EXTENSION
+#define OPTIONAL_FATAL_SYSINIT_INITIAL_EXTENSION FATAL_SYSINIT_INITIAL_EXTENSION,
+#else
+#define OPTIONAL_FATAL_SYSINIT_INITIAL_EXTENSION
+#endif
+
#define CONFIGURE_INITIAL_EXTENSIONS \
+ OPTIONAL_FATAL_SYSINIT_INITIAL_EXTENSION \
{ .fatal = FatalInitialExtension }, \
{ .fatal = TestSuiteFatalExtension }