mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [30/42] incubator-mynewt-core git commit: Initialize libs/os in libs/testutil's tu_init().
Date Tue, 15 Mar 2016 00:36:37 GMT
Initialize libs/os in libs/testutil's tu_init().

This is necessary for unit tests that run in sim and which don't explicitly
initialize the OS.  The set of blocked signals needs to be initialized before
any OS functions are called.  os_init() initializes the signal set.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f51c77b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f51c77b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f51c77b0

Branch: refs/heads/master
Commit: f51c77b08e56a6798c336424ce73d7cee2e6ce02
Parents: 05ce86e
Author: Christopher Collins <ccollins476ad@gmail.com>
Authored: Fri Mar 11 12:12:02 2016 -0800
Committer: Christopher Collins <ccollins476ad@gmail.com>
Committed: Fri Mar 11 12:16:14 2016 -0800

----------------------------------------------------------------------
 libs/os/src/arch/sim/os_arch_sim.c          | 1 +
 libs/os/src/os_priv.h                       | 1 +
 libs/testutil/src/testutil.c                | 3 +++
 net/nimble/host/src/test/ble_hs_test_util.c | 2 ++
 net/nimble/host/src/test/ble_os_test.c      | 6 ------
 5 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f51c77b0/libs/os/src/arch/sim/os_arch_sim.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/sim/os_arch_sim.c b/libs/os/src/arch/sim/os_arch_sim.c
index 1daa94a..94182a8 100644
--- a/libs/os/src/arch/sim/os_arch_sim.c
+++ b/libs/os/src/arch/sim/os_arch_sim.c
@@ -310,6 +310,7 @@ os_arch_os_init(void)
 {
     g_current_task = NULL;
 
+    TAILQ_INIT(&g_os_task_list);
     TAILQ_INIT(&g_os_run_list);
     TAILQ_INIT(&g_os_sleep_list);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f51c77b0/libs/os/src/os_priv.h
----------------------------------------------------------------------
diff --git a/libs/os/src/os_priv.h b/libs/os/src/os_priv.h
index 93a0c3a..dfc9e38 100644
--- a/libs/os/src/os_priv.h
+++ b/libs/os/src/os_priv.h
@@ -24,6 +24,7 @@ TAILQ_HEAD(os_task_list, os_task);
 
 extern struct os_task_list g_os_run_list;
 extern struct os_task_list g_os_sleep_list;
+extern struct os_task_list g_os_task_list;
 extern struct os_task *g_current_task;
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f51c77b0/libs/testutil/src/testutil.c
----------------------------------------------------------------------
diff --git a/libs/testutil/src/testutil.c b/libs/testutil/src/testutil.c
index 09842c5..e41a5a9 100644
--- a/libs/testutil/src/testutil.c
+++ b/libs/testutil/src/testutil.c
@@ -18,6 +18,7 @@
  */
 
 #include <assert.h>
+#include "os/os.h"
 #include "hal/hal_flash.h"
 #include "testutil/testutil.h"
 #include "testutil_priv.h"
@@ -29,6 +30,8 @@ int tu_first_idx;
 int
 tu_init(void)
 {
+    os_init();
+
     tu_any_failed = 0;
 
     return 0;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f51c77b0/net/nimble/host/src/test/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.c b/net/nimble/host/src/test/ble_hs_test_util.c
index 642df70..9f8efc2 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.c
+++ b/net/nimble/host/src/test/ble_hs_test_util.c
@@ -405,6 +405,8 @@ ble_hs_test_util_init(void)
     struct ble_hs_cfg cfg;
     int rc;
 
+    tu_init();
+
     os_msys_reset();
     stats_module_reset();
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f51c77b0/net/nimble/host/src/test/ble_os_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_os_test.c b/net/nimble/host/src/test/ble_os_test.c
index 2b722a2..5e57113 100644
--- a/net/nimble/host/src/test/ble_os_test.c
+++ b/net/nimble/host/src/test/ble_os_test.c
@@ -134,8 +134,6 @@ ble_gap_direct_connect_test_task_handler(void *arg)
 
 TEST_CASE(ble_gap_direct_connect_test_case)
 {
-    os_init();
-
     ble_hs_test_util_init();
 
     os_task_init(&ble_os_test_task,
@@ -216,8 +214,6 @@ ble_gap_gen_disc_test_task_handler(void *arg)
 
 TEST_CASE(ble_gap_gen_disc_test_case)
 {
-    os_init();
-
     ble_hs_test_util_init();
 
     os_task_init(&ble_os_test_task,
@@ -330,8 +326,6 @@ ble_gap_terminate_test_task_handler(void *arg)
 
 TEST_CASE(ble_gap_terminate_test_case)
 {
-    os_init();
-
     ble_hs_test_util_init();
 
     os_task_init(&ble_os_test_task,


Mime
View raw message