ci: Update CI scripts

The changes in Boost 1.62 broke command-line invocation of unit tests

Change-Id: Id98d00f5f85b2154981dec859c8c5a671ec06c84
diff --git a/.jenkins.d/01-deps.sh b/.jenkins.d/01-deps.sh
index 204336f..43c81f8 100755
--- a/.jenkins.d/01-deps.sh
+++ b/.jenkins.d/01-deps.sh
@@ -4,20 +4,21 @@
 JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 source "$JDIR"/util.sh
 
+set -x
+
 if has OSX $NODE_LABELS; then
-    set -x
     brew update
     brew upgrade
-    brew install boost cryptopp pkg-config libxml2
+    brew install boost pkg-config cryptopp openssl
+    brew install libxml2
     brew link --force libxml2
     brew cleanup
 fi
 
 if has Ubuntu $NODE_LABELS; then
-    set -x
-    sudo apt-get update -qq -y
-    sudo apt-get -qq -y install build-essential
-    sudo apt-get -qq -y install libssl-dev libsqlite3-dev libcrypto++-dev libboost-all-dev
+    sudo apt-get -qq update
+    sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
+                             libcrypto++-dev libsqlite3-dev libssl-dev
     sudo apt-get install -qq -y python-setuptools python-dev python-pygraphviz python-kiwi
     sudo apt-get install -qq -y python-pygoocanvas python-gnome2
     sudo apt-get install -qq -y python-rsvg ipython
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index cd1d39f..bf14236 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -1,17 +1,40 @@
 #!/usr/bin/env bash
 set -x
-set -e
 
 JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 source "$JDIR"/util.sh
 
+set -e
+
 pushd ns-3 >/dev/null
 
+BOOST_VERSION=$(python -c "import sys; sys.path.append('build/c4che'); import _cache; v = _cache.BOOST_VERSION.split('_'); print int(v[0]) * 100000 + int(v[1]) * 100;")
+
+ut_log_args() {
+    if (( BOOST_VERSION >= 106200 )); then
+        echo --logger=HRF,test_suite,stdout:XML,all,build/xunit-${1:-report}.xml
+    else
+        if [[ -n $XUNIT ]]; then
+            echo --log_level=all $( (( BOOST_VERSION >= 106000 )) && echo -- ) \
+                 --log_format2=XML --log_sink2=build/xunit-${1:-report}.xml
+        else
+            echo --log_level=test_suite
+        fi
+    fi
+}
+
+ASAN_OPTIONS="color=always"
+ASAN_OPTIONS+=":detect_leaks=false"
+ASAN_OPTIONS+=":detect_stack_use_after_return=true"
+ASAN_OPTIONS+=":check_initialization_order=true"
+ASAN_OPTIONS+=":strict_init_order=true"
+ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1"
+ASAN_OPTIONS+=":detect_container_overflow=false"
+ASAN_OPTIONS+=":strict_string_checks=true"
+ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
+export ASAN_OPTIONS
+
 # Run unit tests
-if [[ -n "$XUNIT" ]]; then
-    ./waf --run "ndnSIM-unit-tests --log_format=XML --log_sink=build/xunit-report.xml --log_level=all --report_level=no"
-else
-    ./waf --run "ndnSIM-unit-tests -l test_suite"
-fi
+./waf --run "ndnSIM-unit-tests $(ut_log_args)"
 
 popd >/dev/null
diff --git a/.jenkins.d/util.sh b/.jenkins.d/util.sh
index 81c8931..a89bc27 100755
--- a/.jenkins.d/util.sh
+++ b/.jenkins.d/util.sh
@@ -1,9 +1,18 @@
 has() {
+    local saved_xtrace
+    [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
+    set +x
+
     local p=$1
     shift
-    local x
-    for x in "$@"; do
-        [[ "${x}" == "${p}" ]] && return 0
+    local i ret=1
+    for i in "$@"; do
+        if [[ "${i}" == "${p}" ]]; then
+            ret=0
+            break
+        fi
     done
-    return 1
+
+    set ${saved_xtrace}
+    return ${ret}
 }
diff --git a/.travis.yml b/.travis.yml
index 0e7b265..127eddf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,24 @@
 sudo: required
 language: generic
-os: linux
-dist: trusty
-compiler:
-  - gcc
+matrix:
+  include:
+    - os: linux
+      dist: trusty
+      env:
+        - CXX=g++
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+    - os: linux
+      dist: trusty
+      env:
+        - CXX=clang++
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+    - os: osx
+      env:
+        - CXX=clang++
+        - NODE_LABELS="OSX OSX-10.9"
 notifications:
   email:
     on_success: always
     on_failure: always
-env:
-  - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
 script:
   - ./.jenkins