tests+ci: Customize unit test running for different versions of Boost

Change-Id: I1619c84653f82c2b0c00c379b8cb61bc43546d87
Refs: #3750
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index bb1cf63..ec0f855 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -9,15 +9,30 @@
 rm -Rf ~/.ndn
 
 if has OSX $NODE_LABELS; then
-  echo "Unlocking OSX Keychain"
-  security unlock-keychain -p "named-data"
+    echo "Unlocking OSX Keychain"
+    security unlock-keychain -p "named-data"
 fi
 
 ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
 
-# Run unit tests
-if [[ -n "$XUNIT" ]]; then
-    ./build/unit-tests --log_level=all -- --log_format2=XML --log_sink2=build/xunit-report.xml
+BOOST_VERSION=$(python -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
+
+if (( BOOST_VERSION < 106200 )); then
+    if [[ -n "$XUNIT" ]]; then
+        UNIT_TEST_PARAMS1="--log_level=all"
+        UNIT_TEST_PARAMS2="--log_format2=XML --log_sink2=build/xunit-report.xml"
+        if (( BOOST_VERSION < 106000 )); then
+            UNIT_TEST_PARAMS="$UNIT_TEST_PARAMS1 $UNIT_TEST_PARAMS2"
+        else
+            UNIT_TEST_PARAMS="$UNIT_TEST_PARAMS1 -- $UNIT_TEST_PARAMS2"
+        fi
+    else
+        UNIT_TEST_PARAMS="--log_level=test_suite"
+    fi
 else
-    ./build/unit-tests -l test_suite
+    UNIT_TEST_PARAMS="--logger=HRF,test_suite,stdout:XML,all,build/xunit-report.xml"
 fi
+
+
+# Run unit tests
+./build/unit-tests $UNIT_TEST_PARAMS
diff --git a/tests/main.cpp b/tests/main.cpp
index d9f582b..aa2f330 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,12 +20,18 @@
  */
 
 #define BOOST_TEST_MODULE ndn-cxx Unit Tests
-
-#define BOOST_TEST_NO_MAIN
 #define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_ALTERNATIVE_INIT_API
 
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 106200
+// Boost.Test v3.3 (Boost 1.62) natively supports multi-logger output
 #include "boost-test.hpp"
+#else
+#define BOOST_TEST_NO_MAIN
+#include "boost-test.hpp"
+
 #include "boost-multi-log-formatter.hpp"
 
 #include <boost/program_options/options_description.hpp>
@@ -102,3 +108,5 @@
 {
   return ::boost::unit_test::unit_test_main(&init_tests, argc, argv);
 }
+
+#endif // BOOST_VERSION >= 106200