aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2019-08-19 13:21:43 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2019-08-20 14:33:59 +0300
commitb9fdf74d3340ccd88a1bdeb1218f2a6ac4a3e840 (patch)
treee31ef08f07d196e77dc25a26c46e263896923f8d /helper
parent0b9207d87fba558d0dd1dfcf192f4310d6bc9f93 (diff)
helper: debug: add test application for helper debug
Test that macros are defined and use assert. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r--helper/test/.gitignore1
-rw-r--r--helper/test/Makefile.am2
-rw-r--r--helper/test/debug.c31
3 files changed, 34 insertions, 0 deletions
diff --git a/helper/test/.gitignore b/helper/test/.gitignore
index 5a6c60bcc..23fab7b30 100644
--- a/helper/test/.gitignore
+++ b/helper/test/.gitignore
@@ -10,3 +10,4 @@ table
thread
pthread
version
+debug
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index bf3aa862c..b030ddf4a 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -1,6 +1,7 @@
include $(top_srcdir)/test/Makefile.inc
EXECUTABLES = version \
+ debug \
chksum \
cuckootable \
parse\
@@ -38,3 +39,4 @@ parse_SOURCES = parse.c
table_SOURCES = table.c
iplookuptable_SOURCES = iplookuptable.c
version_SOURCES = version.c
+debug_SOURCES = debug.c
diff --git a/helper/test/debug.c b/helper/test/debug.c
new file mode 100644
index 000000000..e20fd325a
--- /dev/null
+++ b/helper/test/debug.c
@@ -0,0 +1,31 @@
+/* Copyright (c) 2019, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "config.h"
+
+#include <odp_api.h>
+#include <odp/helper/odph_api.h>
+
+#include <stdio.h>
+#include <string.h>
+
+int main(void)
+{
+ printf("\nHelper library version is: %s\n\n", odph_version_str());
+
+ printf("Helper debugging:\n");
+ printf(" ODPH_DEBUG: %i\n", ODPH_DEBUG);
+ printf(" ODPH_DEBUG_PRINT: %i\n\n", ODPH_DEBUG_PRINT);
+
+ /* ASSERT(true) should work always */
+ ODPH_ASSERT(1);
+
+ /* ASSERT(false) should not abort when not debugging */
+ if (ODPH_DEBUG == 0)
+ ODPH_ASSERT(0);
+
+ return 0;
+}