summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-intr-handler-iterate.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/validation/tc-intr-handler-iterate.c')
-rw-r--r--testsuites/validation/tc-intr-handler-iterate.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/testsuites/validation/tc-intr-handler-iterate.c b/testsuites/validation/tc-intr-handler-iterate.c
index 2014e829bf..fc3f498838 100644
--- a/testsuites/validation/tc-intr-handler-iterate.c
+++ b/testsuites/validation/tc-intr-handler-iterate.c
@@ -3,11 +3,11 @@
/**
* @file
*
- * @ingroup RTEMSTestCaseRtemsIntrReqHandlerIterate
+ * @ingroup RtemsIntrReqHandlerIterate
*/
/*
- * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2021 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -60,10 +60,9 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestCaseRtemsIntrReqHandlerIterate \
- * spec:/rtems/intr/req/handler-iterate
+ * @defgroup RtemsIntrReqHandlerIterate spec:/rtems/intr/req/handler-iterate
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup TestsuitesValidationIntr
*
* @{
*/
@@ -134,6 +133,12 @@ typedef struct {
rtems_vector_number test_vector;
/**
+ * @brief If this member is true, then the testable interrupt vector was
+ * enabled at the test case begin.
+ */
+ bool test_vector_was_enabled;
+
+ /**
* @brief If this member is true, then the service shall be initialized.
*/
bool initialized;
@@ -282,7 +287,7 @@ static void Action( void *arg )
ctx->visited_entries = 0;
bsp_interrupt_set_handler_unique(
- BSP_INTERRUPT_HANDLER_TABLE_SIZE,
+ BSP_INTERRUPT_DISPATCH_TABLE_SIZE,
ctx->initialized
);
@@ -293,7 +298,7 @@ static void Action( void *arg )
);
bsp_interrupt_set_handler_unique(
- BSP_INTERRUPT_HANDLER_TABLE_SIZE,
+ BSP_INTERRUPT_DISPATCH_TABLE_SIZE,
ctx->initialized_during_setup
);
}
@@ -505,7 +510,12 @@ static void RtemsIntrReqHandlerIterate_Setup(
rtems_status_code sc;
ctx->initialized_during_setup = bsp_interrupt_is_initialized();
- ctx->test_vector = GetTestableInterruptVector();
+ ctx->test_vector = GetTestableInterruptVector( NULL );
+ ctx->test_vector_was_enabled = false;
+ (void) rtems_interrupt_vector_is_enabled(
+ ctx->test_vector,
+ &ctx->test_vector_was_enabled
+ );
rtems_interrupt_entry_initialize(
&ctx->entry,
EntryRoutine,
@@ -529,6 +539,32 @@ static void RtemsIntrReqHandlerIterate_Setup_Wrap( void *arg )
RtemsIntrReqHandlerIterate_Setup( ctx );
}
+static void RtemsIntrReqHandlerIterate_Teardown(
+ RtemsIntrReqHandlerIterate_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ sc = rtems_interrupt_entry_remove(
+ ctx->test_vector,
+ &ctx->entry
+ );
+ T_rsc_success( sc );
+
+ if ( ctx->test_vector_was_enabled ) {
+ (void) rtems_interrupt_vector_enable( ctx->test_vector );
+ }
+}
+
+static void RtemsIntrReqHandlerIterate_Teardown_Wrap( void *arg )
+{
+ RtemsIntrReqHandlerIterate_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsIntrReqHandlerIterate_Teardown( ctx );
+}
+
static void RtemsIntrReqHandlerIterate_Action(
RtemsIntrReqHandlerIterate_Context *ctx
)
@@ -586,7 +622,7 @@ static size_t RtemsIntrReqHandlerIterate_Scope(
static T_fixture RtemsIntrReqHandlerIterate_Fixture = {
.setup = RtemsIntrReqHandlerIterate_Setup_Wrap,
.stop = NULL,
- .teardown = NULL,
+ .teardown = RtemsIntrReqHandlerIterate_Teardown_Wrap,
.scope = RtemsIntrReqHandlerIterate_Scope,
.initial_context = &RtemsIntrReqHandlerIterate_Instance
};