You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by pe...@apache.org on 2016/11/01 23:37:46 UTC

incubator-mynewt-core git commit: MYNEWT-139: Add runtest newtmgr command

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop bec53b116 -> db493262e


MYNEWT-139: Add runtest newtmgr command

Partial implementation of command to launch tests in sanity test command.
Future enhancements will allow specifying which test suite to run.


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/db493262
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/db493262
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/db493262

Branch: refs/heads/develop
Commit: db493262e51c898ecba205dc0f799c04bbcbe851
Parents: bec53b1
Author: Peter Snyder <pe...@apache.org>
Authored: Tue Nov 1 16:18:16 2016 -0700
Committer: Peter Snyder <pe...@apache.org>
Committed: Tue Nov 1 16:36:23 2016 -0700

----------------------------------------------------------------------
 mgmt/mgmt/include/mgmt/mgmt.h             |  1 +
 mgmt/newtmgr/include/newtmgr/newtmgr.h    |  1 +
 test/testreport/src/results.c             |  6 +++---
 test/testutil/include/testutil/testutil.h | 14 ++++++++++++++
 test/testutil/src/case.c                  |  8 ++++----
 test/testutil/src/suite.c                 |  2 +-
 test/testutil/src/testutil.c              |  2 ++
 7 files changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/mgmt/mgmt/include/mgmt/mgmt.h
----------------------------------------------------------------------
diff --git a/mgmt/mgmt/include/mgmt/mgmt.h b/mgmt/mgmt/include/mgmt/mgmt.h
index 9622e6b..bd3354b 100644
--- a/mgmt/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/mgmt/include/mgmt/mgmt.h
@@ -47,6 +47,7 @@ extern "C" {
 #define MGMT_GROUP_ID_LOGS      (4)
 #define MGMT_GROUP_ID_CRASH     (5)
 #define MGMT_GROUP_ID_SPLIT     (6)
+#define MGMT_GROUP_ID_RUNTEST   (7)
 #define MGMT_GROUP_ID_PERUSER   (64)
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/mgmt/newtmgr/include/newtmgr/newtmgr.h
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/include/newtmgr/newtmgr.h b/mgmt/newtmgr/include/newtmgr/newtmgr.h
index 7cb6f84..9f87655 100644
--- a/mgmt/newtmgr/include/newtmgr/newtmgr.h
+++ b/mgmt/newtmgr/include/newtmgr/newtmgr.h
@@ -38,6 +38,7 @@ extern "C" {
 #define NMGR_GROUP_ID_LOGS      (4)
 #define NMGR_GROUP_ID_CRASH     (5)
 #define NMGR_GROUP_ID_SPLIT     (6)
+#define NMGR_GROUP_ID_RUNTEST   (7)
 #define NMGR_GROUP_ID_PERUSER   (64)
 
 #define NMGR_OP_READ            (0)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/test/testreport/src/results.c
----------------------------------------------------------------------
diff --git a/test/testreport/src/results.c b/test/testreport/src/results.c
index daa6324..bc54bb3 100644
--- a/test/testreport/src/results.c
+++ b/test/testreport/src/results.c
@@ -82,7 +82,7 @@ tr_report_mkdir_suite(void)
 
     rc = snprintf(tr_report_buf, sizeof tr_report_buf,
                   "%s/%s", tr_config.tc_base_path,
-                  tu_suite_name);
+                  ts_current_config->ts_suite_name);
     if (rc >= sizeof tr_report_buf) {
         return -1;
     }
@@ -106,7 +106,7 @@ tr_report_mkdir_case(void)
 
     rc = snprintf(tr_report_buf, sizeof tr_report_buf,
                   "%s/%s/%s", tr_config.tc_base_path,
-                  tu_suite_name, tu_case_name);
+                  ts_current_config->ts_suite_name, tu_case_name);
     if (rc >= sizeof tr_report_buf) {
         return -1;
     }
@@ -131,7 +131,7 @@ tr_report_write_file(const char *filename, const uint8_t *data,
 
     rc = snprintf(tr_report_buf, sizeof tr_report_buf,
                   "%s/%s/%s/%s", tr_config.tc_base_path,
-                  tu_suite_name, tu_case_name, filename);
+                  ts_current_config->ts_suite_name, tu_case_name, filename);
     if (rc >= sizeof tr_report_buf) {
         return -1;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/test/testutil/include/testutil/testutil.h
----------------------------------------------------------------------
diff --git a/test/testutil/include/testutil/testutil.h b/test/testutil/include/testutil/testutil.h
index 88eaebe..3f0aca8 100644
--- a/test/testutil/include/testutil/testutil.h
+++ b/test/testutil/include/testutil/testutil.h
@@ -23,6 +23,8 @@
 #include <inttypes.h>
 #include <setjmp.h>
 
+#include "os/queue.h"
+
 #include "syscfg/syscfg.h"
 
 #ifdef __cplusplus
@@ -55,6 +57,8 @@ typedef void tu_init_test_fn_t(void *arg);
 typedef void tu_pre_test_fn_t(void *arg);
 typedef void tu_post_test_fn_t(void *arg);
 
+typedef void tu_testsuite_fn_t(void);
+
 /*
  * Private declarations - Test Suite configuration
  */
@@ -69,10 +73,20 @@ void tu_suite_pre_test(void);
 void tu_suite_post_test(void);
 void tu_suite_complete(void);
 
+SLIST_HEAD(ts_testsuite_list, ts_suite);
+
+struct ts_suite {
+    SLIST_ENTRY(ts_suite) ts_next;
+    const char *ts_name;
+    tu_testsuite_fn_t *ts_test;
+};
+
 struct ts_config {
     int ts_print_results;
     int ts_system_assert;
 
+    const char *ts_suite_name;
+
     /*
      * Called prior to the first test in the suite
      */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/test/testutil/src/case.c
----------------------------------------------------------------------
diff --git a/test/testutil/src/case.c b/test/testutil/src/case.c
index b0fd6fc..2171afb 100644
--- a/test/testutil/src/case.c
+++ b/test/testutil/src/case.c
@@ -156,7 +156,7 @@ tu_case_pass(void)
 {
 #if MYNEWT_VAL(SELFTEST)
     if (ts_config.ts_print_results) {
-        printf("[pass] %s/%s\n", tu_suite_name, tu_case_name);
+        printf("[pass] %s/%s\n", ts_current_config->ts_suite_name, tu_case_name);
         if (tu_case_buf_len > 0) {
             printf("%s", tu_case_buf);
         }
@@ -183,7 +183,7 @@ tu_case_fail(void)
 
 #if MYNEWT_VAL(SELFTEST)
     if (ts_config.ts_print_results) {
-        printf("[FAIL] %s/%s %s", tu_suite_name, tu_case_name, tu_case_buf);
+        printf("[FAIL] %s/%s %s", ts_current_config->ts_suite_name, tu_case_name, tu_case_buf);
         fflush(stdout);
     }
 #endif
@@ -206,7 +206,7 @@ tu_case_write_fail_buf(void)
 
 #if MYNEWT_VAL(SELFTEST)
     if (ts_config.ts_print_results) {
-        printf("[FAIL] %s/%s %s", tu_suite_name, tu_case_name, tu_case_buf);
+        printf("[FAIL] %s/%s %s", ts_current_config->ts_suite_name, tu_case_name, tu_case_buf);
         fflush(stdout);
     }
 #endif
@@ -241,7 +241,7 @@ tu_case_write_pass_buf(void)
 
 #if MYNEWT_VAL(SELFTEST)
     if (ts_config.ts_print_results) {
-        printf("[pass] %s/%s\n", tu_suite_name, tu_case_name);
+        printf("[pass] %s/%s\n", ts_current_config->ts_suite_name, tu_case_name);
         if (tu_case_buf_len > 0) {
             printf("%s", tu_case_buf);
         }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/test/testutil/src/suite.c
----------------------------------------------------------------------
diff --git a/test/testutil/src/suite.c b/test/testutil/src/suite.c
index a7e9f24..b956872 100644
--- a/test/testutil/src/suite.c
+++ b/test/testutil/src/suite.c
@@ -27,7 +27,7 @@ int tu_suite_failed = 0;
 static void
 tu_suite_set_name(const char *name)
 {
-    tu_suite_name = name;
+    ts_current_config->ts_suite_name = name;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/db493262/test/testutil/src/testutil.c
----------------------------------------------------------------------
diff --git a/test/testutil/src/testutil.c b/test/testutil/src/testutil.c
index 1c0ccef..06bd25c 100644
--- a/test/testutil/src/testutil.c
+++ b/test/testutil/src/testutil.c
@@ -36,6 +36,8 @@ struct ts_config *ts_current_config = &ts_config;
 int tu_any_failed;
 int tu_first_idx;
 
+struct ts_testsuites;
+
 int
 tu_init(void)
 {