ci: Add ability to generate unit test reports in XML format (for xUnit processing)
Change-Id: I67fdc579ed4562f7d9ac2c49f91892ddbb7c44c0
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index c9b1e94..3bc96ce 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -16,4 +16,8 @@
ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
# Run unit tests
-./build/unit-tests -l test_suite
+if [[ -n "$XUNIT" ]]; then
+ ./build/unit-tests --log_format=XML --log_sink=build/xunit-report.xml --log_level=all --report_level=no
+else
+ ./build/unit-tests -l test_suite
+fi
diff --git a/tests/wscript b/tests/wscript
index 5a602d3..c4cbfbf 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -43,20 +43,28 @@
unit_tests.source += bld.path.ant_glob('unit-tests/**/*-sqlite3.cpp')
integrated.source += bld.path.ant_glob('integrated/**/*-sqlite3.cpp')
- unit_test_main = bld(
- target='unit-tests-main',
- name='unit-tests-main',
- features='cxx',
+ bld(features='cxx',
+ target='unit-tests-main-unit',
+ name='unit-tests-main-unit',
source=bld.path.ant_glob(['*.cpp']),
use='ndn-cxx',
+ defines=['BOOST_TEST_MODULE=ndn-cxx Unit Tests'],
+ )
+
+ bld(features='cxx',
+ target='unit-tests-main-integrated',
+ name='unit-tests-main-integrated',
+ source=bld.path.ant_glob(['*.cpp']),
+ use='ndn-cxx',
+ defines=['BOOST_TEST_MODULE=ndn-cxx Integrated Tests'],
)
bld(features="cxx cxxprogram",
target="../unit-tests",
- use="unit-test-objects unit-tests-main",
+ use="unit-test-objects unit-tests-main-unit",
install_path=None)
bld(features="cxx cxxprogram",
target="../integrated-tests",
- use="integrated-test-objects unit-tests-main",
+ use="integrated-test-objects unit-tests-main-integrated",
install_path=None)