summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-23 17:20:50 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-12-08 17:25:15 +0100
commit10824c52cd8676fac52063d86ab9785d8fcaeb7b (patch)
treebf37e38838d3698c87d91ef13bca0e5d6c88a92e
parentf219d879e59f88b5932532776d915f5019799e7e (diff)
testsuites/validation/tc-signals.c
-rw-r--r--testsuites/validation/tc-signals.c7
-rw-r--r--testsuites/validation/tr-signal-constant.c64
2 files changed, 61 insertions, 10 deletions
diff --git a/testsuites/validation/tc-signals.c b/testsuites/validation/tc-signals.c
index de6a1d3ad8..00f4752412 100644
--- a/testsuites/validation/tc-signals.c
+++ b/testsuites/validation/tc-signals.c
@@ -63,11 +63,12 @@
*
* @ingroup RTEMSTestSuiteTestsuitesValidation0
*
- * @brief Tests the Signal Manager API.
+ * @brief This test case collection provides validation test cases for the @ref
+ * RTEMSAPIClassicSignal.
*
* This test case performs the following actions:
*
- * - Run the signal constant and number test for all 32 signal constants.
+ * - Run the signal test for all 32 signal constants.
*
* @{
*/
@@ -108,7 +109,7 @@ static const rtems_signal_set signals[] = {
};
/**
- * @brief Run the signal constant and number test for all 32 signal constants.
+ * @brief Run the signal test for all 32 signal constants.
*/
static void RtemsSignalValSignals_Action_0( void )
{
diff --git a/testsuites/validation/tr-signal-constant.c b/testsuites/validation/tr-signal-constant.c
index 58e30da14f..622806a582 100644
--- a/testsuites/validation/tr-signal-constant.c
+++ b/testsuites/validation/tr-signal-constant.c
@@ -64,15 +64,19 @@
*
* @ingroup RTEMSTestSuiteTestsuitesValidation0
*
- * @brief Tests an signal constant and number of the Signal Manager using the
- * Classic and system signal sets of the executing task.
+ * @brief Tests a signal constant of the @ref RTEMSAPIClassicSignal using the
+ * signal set of the executing task.
*
* This test case performs the following actions:
*
* - Validate the signal constant.
*
- * - Check that the signal constant is equal to the signal number bit in the
- * signal set.
+ * - Check that the signal constant is equal to the integer representation of
+ * the signal in the signal set.
+ *
+ * - Validate the signal delivery.
+ *
+ * - Check that the caught signal set represents exactly the sent signal.
*
* @{
*/
@@ -82,6 +86,11 @@
*/
typedef struct {
/**
+ * @brief This member contains the caught signal set.
+ */
+ rtems_signal_set signal_set;
+
+ /**
* @brief This member contains a copy of the corresponding
* RtemsSignalValSignalConstant_Run() parameter.
*/
@@ -97,6 +106,16 @@ typedef struct {
static RtemsSignalValSignalConstant_Context
RtemsSignalValSignalConstant_Instance;
+typedef RtemsSignalValSignalConstant_Context Context;
+
+static void SignalHandler( rtems_signal_set signal_set )
+{
+ Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->signal_set = signal_set;
+}
+
static T_fixture RtemsSignalValSignalConstant_Fixture = {
.setup = NULL,
.stop = NULL,
@@ -115,8 +134,8 @@ static void RtemsSignalValSignalConstant_Action_0(
/* No action */
/*
- * Check that the signal constant is equal to the signal number bit in the
- * signal set.
+ * Check that the signal constant is equal to the integer representation of
+ * the signal in the signal set.
*/
T_step_eq_u32(
0,
@@ -125,6 +144,36 @@ static void RtemsSignalValSignalConstant_Action_0(
);
}
+/**
+ * @brief Validate the signal delivery.
+ */
+static void RtemsSignalValSignalConstant_Action_1(
+ RtemsSignalValSignalConstant_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ ctx->signal_set = 0;
+
+ sc = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
+ T_step_rsc_success( 1, sc );
+
+ sc = rtems_signal_catch( SignalHandler, RTEMS_NO_ASR );
+ T_step_rsc_success( 2, sc );
+
+ sc = rtems_signal_send( RTEMS_SELF, ctx->signal );
+ T_step_rsc_success( 3, sc );
+
+ /*
+ * Check that the caught signal set represents exactly the sent signal.
+ */
+ T_step_eq_u32(
+ 4,
+ ctx->signal_set,
+ ctx->signal
+ );
+}
+
static T_fixture_node RtemsSignalValSignalConstant_Node;
void RtemsSignalValSignalConstant_Run( rtems_signal_set signal, int number )
@@ -140,9 +189,10 @@ void RtemsSignalValSignalConstant_Run( rtems_signal_set signal, int number )
&RtemsSignalValSignalConstant_Fixture
);
- T_plan( 1 );
+ T_plan( 5 );
RtemsSignalValSignalConstant_Action_0( ctx );
+ RtemsSignalValSignalConstant_Action_1( ctx );
T_pop_fixture();
}