aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/include/hal.h2
-rw-r--r--test/oslib/configuration.xml118
-rw-r--r--test/oslib/source/test/oslib_test_root.c2
-rw-r--r--test/oslib/source/test/oslib_test_root.h2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_001.c2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_001.h2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_002.c2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_002.h2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_003.c2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_003.h2
-rw-r--r--test/oslib/source/test/oslib_test_sequence_004.c117
-rw-r--r--test/oslib/source/test/oslib_test_sequence_004.h2
12 files changed, 244 insertions, 11 deletions
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h
index 26299602b..b0f828144 100644
--- a/os/hal/include/hal.h
+++ b/os/hal/include/hal.h
@@ -95,7 +95,7 @@
#endif
#if !defined(HAL_USE_SIO)
-#define HAL_USE_SPI FALSE
+#define HAL_USE_SIO FALSE
#endif
#if !defined(HAL_USE_SPI)
diff --git a/test/oslib/configuration.xml b/test/oslib/configuration.xml
index 11ceb09a9..7b3a6b47f 100644
--- a/test/oslib/configuration.xml
+++ b/test/oslib/configuration.xml
@@ -1561,6 +1561,124 @@ test_assert(dofp == NULL, "found");]]></value>
</step>
</steps>
</case>
+ <case>
+ <brief>
+ <value>Dynamic Pipes Factory.</value>
+ </brief>
+ <description>
+ <value>This test case verifies the dynamic pipes factory.</value>
+ </description>
+ <condition>
+ <value>CH_CFG_FACTORY_PIPES == TRUE</value>
+ </condition>
+ <various_code>
+ <setup_code>
+ <value />
+ </setup_code>
+ <teardown_code>
+ <value><![CDATA[dyn_pipe_t *dpp;
+
+dpp = chFactoryFindPipe("mypipe");
+if (dpp != NULL) {
+ while (dpp->element.refs > 0U) {
+ chFactoryReleasePipe(dpp);
+ }
+}]]></value>
+ </teardown_code>
+ <local_variables>
+ <value><![CDATA[dyn_pipe_t *dpp;]]></value>
+ </local_variables>
+ </various_code>
+ <steps>
+ <step>
+ <description>
+ <value>Retrieving a dynamic pipe by name, must not exist.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dpp = chFactoryFindPipe("mypipe");
+test_assert(dpp == NULL, "found");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Creating a dynamic pipe it must not exists, must succeed.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dpp = chFactoryCreatePipe("mypipe", 16U);
+test_assert(dpp != NULL, "cannot create");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Creating a dynamic pipe with the same name, must fail.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dyn_pipe_t *dpp1;
+
+dpp1 = chFactoryCreatePipe("mypipe", 16U);
+test_assert(dpp1 == NULL, "can create");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Retrieving the dynamic pipe by name, must exist, then increasing the reference counter, finally releasing both references.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dyn_pipe_t *dpp1, *dpp2;
+
+dpp1 = chFactoryFindPipe("mypipe");
+test_assert(dpp1 != NULL, "not found");
+test_assert(dpp == dpp1, "object reference mismatch");
+test_assert(dpp1->element.refs == 2, "object reference mismatch");
+
+dpp2 = (dyn_pipe_t *)chFactoryDuplicateReference(&dpp1->element);
+test_assert(dpp1 == dpp2, "object reference mismatch");
+test_assert(dpp2->element.refs == 3, "object reference mismatch");
+
+chFactoryReleasePipe(dpp2);
+test_assert(dpp1->element.refs == 2, "references mismatch");
+
+chFactoryReleasePipe(dpp1);
+test_assert(dpp->element.refs == 1, "references mismatch");]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Releasing the first reference to the dynamic pipe must not trigger an assertion.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[chFactoryReleasePipe(dpp);]]></value>
+ </code>
+ </step>
+ <step>
+ <description>
+ <value>Retrieving the dynamic pipe by name again, must not exist.</value>
+ </description>
+ <tags>
+ <value />
+ </tags>
+ <code>
+ <value><![CDATA[dpp = chFactoryFindPipe("mypipe");
+test_assert(dpp == NULL, "found");]]></value>
+ </code>
+ </step>
+ </steps>
+ </case>
</cases>
</sequence>
</sequences>
diff --git a/test/oslib/source/test/oslib_test_root.c b/test/oslib/source/test/oslib_test_root.c
index 2b8aae5ec..e222dcd06 100644
--- a/test/oslib/source/test/oslib_test_root.c
+++ b/test/oslib/source/test/oslib_test_root.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_root.h b/test/oslib/source/test/oslib_test_root.h
index 7e419375d..760ccddc8 100644
--- a/test/oslib/source/test/oslib_test_root.h
+++ b/test/oslib/source/test/oslib_test_root.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_001.c b/test/oslib/source/test/oslib_test_sequence_001.c
index 6f4fefc7c..74672a242 100644
--- a/test/oslib/source/test/oslib_test_sequence_001.c
+++ b/test/oslib/source/test/oslib_test_sequence_001.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_001.h b/test/oslib/source/test/oslib_test_sequence_001.h
index fc671846e..161c5278b 100644
--- a/test/oslib/source/test/oslib_test_sequence_001.h
+++ b/test/oslib/source/test/oslib_test_sequence_001.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_002.c b/test/oslib/source/test/oslib_test_sequence_002.c
index b6fa0f20e..bd661ce13 100644
--- a/test/oslib/source/test/oslib_test_sequence_002.c
+++ b/test/oslib/source/test/oslib_test_sequence_002.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_002.h b/test/oslib/source/test/oslib_test_sequence_002.h
index 0a3c238b3..7525db632 100644
--- a/test/oslib/source/test/oslib_test_sequence_002.h
+++ b/test/oslib/source/test/oslib_test_sequence_002.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_003.c b/test/oslib/source/test/oslib_test_sequence_003.c
index 0056058d1..9f623e9db 100644
--- a/test/oslib/source/test/oslib_test_sequence_003.c
+++ b/test/oslib/source/test/oslib_test_sequence_003.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_003.h b/test/oslib/source/test/oslib_test_sequence_003.h
index a24f0f2ea..57fc77602 100644
--- a/test/oslib/source/test/oslib_test_sequence_003.h
+++ b/test/oslib/source/test/oslib_test_sequence_003.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/oslib/source/test/oslib_test_sequence_004.c b/test/oslib/source/test/oslib_test_sequence_004.c
index 8749617fd..a053008d8 100644
--- a/test/oslib/source/test/oslib_test_sequence_004.c
+++ b/test/oslib/source/test/oslib_test_sequence_004.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@
* - @subpage oslib_test_004_003
* - @subpage oslib_test_004_004
* - @subpage oslib_test_004_005
+ * - @subpage oslib_test_004_006
* .
*/
@@ -629,6 +630,117 @@ static const testcase_t oslib_test_004_005 = {
};
#endif /* CH_CFG_FACTORY_OBJ_FIFOS == TRUE */
+#if (CH_CFG_FACTORY_PIPES == TRUE) || defined(__DOXYGEN__)
+/**
+ * @page oslib_test_004_006 [4.6] Dynamic Pipes Factory
+ *
+ * <h2>Description</h2>
+ * This test case verifies the dynamic pipes factory.
+ *
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - CH_CFG_FACTORY_PIPES == TRUE
+ * .
+ *
+ * <h2>Test Steps</h2>
+ * - [4.6.1] Retrieving a dynamic pipe by name, must not exist.
+ * - [4.6.2] Creating a dynamic pipe it must not exists, must succeed.
+ * - [4.6.3] Creating a dynamic pipe with the same name, must fail.
+ * - [4.6.4] Retrieving the dynamic pipe by name, must exist, then
+ * increasing the reference counter, finally releasing both
+ * references.
+ * - [4.6.5] Releasing the first reference to the dynamic pipe must not
+ * trigger an assertion.
+ * - [4.6.6] Retrieving the dynamic pipe by name again, must not exist.
+ * .
+ */
+
+static void oslib_test_004_006_teardown(void) {
+ dyn_pipe_t *dpp;
+
+ dpp = chFactoryFindPipe("mypipe");
+ if (dpp != NULL) {
+ while (dpp->element.refs > 0U) {
+ chFactoryReleasePipe(dpp);
+ }
+ }
+}
+
+static void oslib_test_004_006_execute(void) {
+ dyn_pipe_t *dpp;
+
+ /* [4.6.1] Retrieving a dynamic pipe by name, must not exist.*/
+ test_set_step(1);
+ {
+ dpp = chFactoryFindPipe("mypipe");
+ test_assert(dpp == NULL, "found");
+ }
+
+ /* [4.6.2] Creating a dynamic pipe it must not exists, must
+ succeed.*/
+ test_set_step(2);
+ {
+ dpp = chFactoryCreatePipe("mypipe", 16U);
+ test_assert(dpp != NULL, "cannot create");
+ }
+
+ /* [4.6.3] Creating a dynamic pipe with the same name, must fail.*/
+ test_set_step(3);
+ {
+ dyn_pipe_t *dpp1;
+
+ dpp1 = chFactoryCreatePipe("mypipe", 16U);
+ test_assert(dpp1 == NULL, "can create");
+ }
+
+ /* [4.6.4] Retrieving the dynamic pipe by name, must exist, then
+ increasing the reference counter, finally releasing both
+ references.*/
+ test_set_step(4);
+ {
+ dyn_pipe_t *dpp1, *dpp2;
+
+ dpp1 = chFactoryFindPipe("mypipe");
+ test_assert(dpp1 != NULL, "not found");
+ test_assert(dpp == dpp1, "object reference mismatch");
+ test_assert(dpp1->element.refs == 2, "object reference mismatch");
+
+ dpp2 = (dyn_pipe_t *)chFactoryDuplicateReference(&dpp1->element);
+ test_assert(dpp1 == dpp2, "object reference mismatch");
+ test_assert(dpp2->element.refs == 3, "object reference mismatch");
+
+ chFactoryReleasePipe(dpp2);
+ test_assert(dpp1->element.refs == 2, "references mismatch");
+
+ chFactoryReleasePipe(dpp1);
+ test_assert(dpp->element.refs == 1, "references mismatch");
+ }
+
+ /* [4.6.5] Releasing the first reference to the dynamic pipe must not
+ trigger an assertion.*/
+ test_set_step(5);
+ {
+ chFactoryReleasePipe(dpp);
+ }
+
+ /* [4.6.6] Retrieving the dynamic pipe by name again, must not
+ exist.*/
+ test_set_step(6);
+ {
+ dpp = chFactoryFindPipe("mypipe");
+ test_assert(dpp == NULL, "found");
+ }
+}
+
+static const testcase_t oslib_test_004_006 = {
+ "Dynamic Pipes Factory",
+ NULL,
+ oslib_test_004_006_teardown,
+ oslib_test_004_006_execute
+};
+#endif /* CH_CFG_FACTORY_PIPES == TRUE */
+
/****************************************************************************
* Exported data.
****************************************************************************/
@@ -652,6 +764,9 @@ const testcase_t * const oslib_test_sequence_004_array[] = {
#if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) || defined(__DOXYGEN__)
&oslib_test_004_005,
#endif
+#if (CH_CFG_FACTORY_PIPES == TRUE) || defined(__DOXYGEN__)
+ &oslib_test_004_006,
+#endif
NULL
};
diff --git a/test/oslib/source/test/oslib_test_sequence_004.h b/test/oslib/source/test/oslib_test_sequence_004.h
index 48be4123e..c301863f2 100644
--- a/test/oslib/source/test/oslib_test_sequence_004.h
+++ b/test/oslib/source/test/oslib_test_sequence_004.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.