You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/12/08 07:31:34 UTC

incubator-mynewt-core git commit: MYNEWT-245 Allow debug of unittest via "newt run"

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 219c5e137 -> f433a77ef


MYNEWT-245 Allow debug of unittest via "newt run"

This change is required to enable the sibling change to work to function
properly.  With both changes, a unittest package can be debugged via:

    newt run <unittest-pkg>

This builds the test executable such that a failed test triggers a
failed assert and runs it in gdb.  When a test fails, gdb halts at the
point of failure.


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

Branch: refs/heads/develop
Commit: f433a77ef2819ed1848215312a88a1ad20a69013
Parents: 219c5e1
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Dec 8 01:29:46 2016 -0600
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Dec 8 01:31:25 2016 -0600

----------------------------------------------------------------------
 test/testutil/include/testutil/testutil.h |  8 ++++++++
 test/testutil/syscfg.yml                  | 24 ++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f433a77e/test/testutil/include/testutil/testutil.h
----------------------------------------------------------------------
diff --git a/test/testutil/include/testutil/testutil.h b/test/testutil/include/testutil/testutil.h
index a941ca1..66701f2 100644
--- a/test/testutil/include/testutil/testutil.h
+++ b/test/testutil/include/testutil/testutil.h
@@ -268,6 +268,12 @@ TEST_SUITE_##suite_name(void);                               \
 #define XSTR(s) STR(s)
 #define STR(s) #s
 
+#if MYNEWT_VAL(TESTUTIL_SYSTEM_ASSERT)
+
+#define TEST_ASSERT_FULL(fatal, expr, ...) (assert(expr))
+
+#else 
+
 #define TEST_ASSERT_FULL(fatal, expr, ...) do                 \
 {                                                             \
     if (!(expr)) {                                            \
@@ -277,6 +283,8 @@ TEST_SUITE_##suite_name(void);                               \
     }                                                         \
 } while (0)
 
+#endif
+
 #define TEST_ASSERT(...)                                      \
     TEST_ASSERT_FULL(0, FIRST(__VA_ARGS__), REST_OR_0(__VA_ARGS__))
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f433a77e/test/testutil/syscfg.yml
----------------------------------------------------------------------
diff --git a/test/testutil/syscfg.yml b/test/testutil/syscfg.yml
new file mode 100644
index 0000000..32a1da6
--- /dev/null
+++ b/test/testutil/syscfg.yml
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Package: boot/bootutil
+
+syscfg.defs:
+    TESTUTIL_SYSTEM_ASSERT:
+        description: 'Crash the system on test failure'
+        value: '0'