diff mbox series

[v12,1/5] test: build: enable cunit output to xml

Message ID 1513785623-30862-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v12,1/5] test: build: enable cunit output to xml | expand

Commit Message

Github ODP bot Dec. 20, 2017, 4 p.m. UTC
From: Maxim Uvarov <maxim.uvarov@linaro.org>


Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 309 (muvarov:devel/master_shippable2)
 ** https://github.com/Linaro/odp/pull/309
 ** Patch: https://github.com/Linaro/odp/pull/309.patch
 ** Base sha: 6b5cdc77eb9759a2349b10372a964648559bc92c
 ** Merge commit sha: 170d41370418d3dd8da3808c800f2894f36cf9ae
 **/
 .gitignore                     |  3 +++
 doc/.gitignore                 |  1 +
 test/common/odp_cunit_common.c | 13 +++++++++++--
 test/common/odp_cunit_common.h |  1 +
 4 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 doc/.gitignore
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index 93ab63a31..4653f8976 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,13 +2,16 @@ 
 *.gcda
 *.gcno
 *.gcov
+*.trs
 *.la
 *.lo
+*.log
 *.o
 *.orig
 *.patch
 *.rej
 *.swp
+*.xml
 *~
 .deps/
 .dirstamp
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 000000000..d7ec32eaf
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1 @@ 
+!*.xml
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c
index 08bf1f264..55a39d910 100644
--- a/test/common/odp_cunit_common.c
+++ b/test/common/odp_cunit_common.c
@@ -6,13 +6,16 @@ 
 
 #include "config.h"
 
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <odp_api.h>
 #include "odp_cunit_common.h"
 #include <odp/helper/odph_api.h>
 /* Globals */
 static odph_odpthread_t thread_tbl[MAX_WORKERS];
 static odp_instance_t instance;
+static char *progname;
 
 /*
  * global init/term functions which may be registered
@@ -296,8 +299,13 @@  int odp_cunit_run(void)
 	printf("\tODP implementation name:    %s\n", odp_version_impl_name());
 	printf("\tODP implementation version: %s\n", odp_version_impl_str());
 
-	CU_basic_set_mode(CU_BRM_VERBOSE);
-	CU_basic_run_tests();
+	if (getenv("ODP_TEST_OUT_XML")) {
+		CU_set_output_filename(progname);
+		CU_automated_run_tests();
+	} else {
+		CU_basic_set_mode(CU_BRM_VERBOSE);
+		CU_basic_run_tests();
+	}
 
 	ret = CU_get_number_of_failure_records();
 
@@ -371,5 +379,6 @@  int odp_cunit_register(odp_suiteinfo_t testsuites[])
  */
 int odp_cunit_parse_options(int argc, char *argv[])
 {
+	progname = argv[0];
 	return odph_parse_options(argc, argv, NULL, NULL);
 }
diff --git a/test/common/odp_cunit_common.h b/test/common/odp_cunit_common.h
index 486a5ec51..ef4385398 100644
--- a/test/common/odp_cunit_common.h
+++ b/test/common/odp_cunit_common.h
@@ -17,6 +17,7 @@ 
 #include <inttypes.h>
 #include "CUnit/Basic.h"
 #include "CUnit/TestDB.h"
+#include <CUnit/Automated.h>
 #include <odp_api.h>
 
 #define MAX_WORKERS 32 /**< Maximum number of work threads */