ci: Add Jenkins and Travis CI support

Change-Id: Iccfd44b910cd2cc703897b5e7fddc15ccb07cf89
diff --git a/.Jenkinsfile b/.Jenkinsfile
new file mode 100644
index 0000000..c1e0090
--- /dev/null
+++ b/.Jenkinsfile
@@ -0,0 +1,46 @@
+//////////////////////
+
+stage 'Checkout from git'
+node {
+    deleteDir()
+    git url: 'http://gerrit.named-data.net/ndn-tools'
+    sh "git fetch origin ${GERRIT_REFSPEC} && git checkout FETCH_HEAD"
+    stash name: 'code', includes: '**/*, .git/**/*', useDefaultExcludes: false
+}
+
+//////////////////////
+
+stage 'Parallel builds'
+
+def labels = [
+    "OSX-10.12",
+    "Ubuntu-16.04-64bit",
+    "code-coverage"
+]
+
+def builds = [:]
+
+// Apparently, cannot use for-loop iteration, see https://issues.jenkins-ci.org/browse/JENKINS-27421
+for (int i = 0; i < labels.size(); i++) {
+    String label = labels.get(i);
+
+    builds[label] = {
+        node(label) {
+            wrap([$class: 'hudson.plugins.ansicolor.AnsiColorBuildWrapper', colorMapName: 'xterm']) {
+                deleteDir()
+                unstash "code"
+
+                sh "XUNIT=yes ./.jenkins"
+
+                if (label == "code-coverage") {
+                  step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'build/coverage.xml', failNoReports: true, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
+                } else {
+                  // don't publish test results for code coverage run
+                  step([$class: 'XUnitBuilder', testTimeMargin: '50000', thresholdMode: 1, tools: [[$class: 'BoostTestJunitHudsonTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/xunit*.xml', skipNoTestFiles: true, stopProcessingIfError: true]]])
+                }
+            }
+        }
+    }
+}
+
+parallel builds
diff --git a/.jenkins b/.jenkins
new file mode 100755
index 0000000..674d751
--- /dev/null
+++ b/.jenkins
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -e
+
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+for file in "$DIR"/.jenkins.d/*; do
+    [[ -f $file && -x $file ]] || continue
+    echo "Run: $file"
+    "$file"
+done
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
new file mode 100755
index 0000000..77a0e6d
--- /dev/null
+++ b/.jenkins.d/00-deps.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if has OSX $NODE_LABELS; then
+    brew update
+    brew upgrade
+    brew install boost pkg-config cryptopp openssl log4cxx protobuf tinyxml qt5
+    brew cleanup
+fi
+
+if has Ubuntu $NODE_LABELS; then
+    sudo apt-get -qq update
+    sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
+                             libcrypto++-dev libsqlite3-dev libssl-dev \
+                             libpcap-dev \
+                             liblog4cxx10-dev protobuf-compiler libprotobuf-dev libtinyxml-dev qt5-default
+fi
diff --git a/.jenkins.d/01-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
new file mode 100755
index 0000000..482c155
--- /dev/null
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+pushd "${CACHE_DIR:-/tmp}" >/dev/null
+
+INSTALLED_VERSION=$((cd ndn-cxx && git rev-parse HEAD) 2>/dev/null || echo NONE)
+
+sudo rm -Rf ndn-cxx-latest
+
+git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
+
+LATEST_VERSION=$((cd ndn-cxx-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
+
+if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
+    sudo rm -Rf ndn-cxx
+    mv ndn-cxx-latest ndn-cxx
+    sudo rm -Rf NFD NFD-latest
+else
+    sudo rm -Rf ndn-cxx-latest
+fi
+
+sudo rm -Rf /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/lib/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
+
+pushd ndn-cxx >/dev/null
+
+./waf -j1 --color=yes configure --enable-shared --disable-static --without-osx-keychain
+./waf -j1 --color=yes build
+sudo ./waf -j1 --color=yes install
+
+popd >/dev/null
+popd >/dev/null
+
+if has Linux $NODE_LABELS; then
+    sudo ldconfig
+elif has FreeBSD $NODE_LABELS; then
+    sudo ldconfig -a
+fi
diff --git a/.jenkins.d/02-nfd.sh b/.jenkins.d/02-nfd.sh
new file mode 100755
index 0000000..a109057
--- /dev/null
+++ b/.jenkins.d/02-nfd.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+pushd "${CACHE_DIR:-/tmp}" >/dev/null
+
+INSTALLED_VERSION=$((cd NFD && git rev-parse HEAD) 2>/dev/null || echo NONE)
+
+sudo rm -Rf NFD-latest
+
+git clone git://github.com/named-data/NFD NFD-latest
+
+LATEST_VERSION=$((cd NFD-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
+
+if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
+    sudo rm -Rf NFD
+    mv NFD-latest NFD
+else
+    sudo rm -Rf NFD-latest
+fi
+
+sudo killall nfd || true
+
+sudo rm -f /usr/local/bin/nfd
+sudo rm -f /usr/local/etc/ndn/nfd.conf
+
+pushd NFD >/dev/null
+
+git submodule init
+git submodule sync
+git submodule update
+
+## Cleanup
+sudo ./waf -j1 --color=yes distclean
+
+./waf -j1 --color=yes configure
+./waf -j1 --color=yes build
+sudo ./waf -j1 --color=yes install
+sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
+
+popd >/dev/null
+popd >/dev/null
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
new file mode 100755
index 0000000..db41533
--- /dev/null
+++ b/.jenkins.d/10-build.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+git submodule init
+git submodule sync
+git submodule update
+
+# Cleanup
+sudo ./waf -j1 --color=yes distclean
+
+if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
+  # Configure/build in optimized mode with tests
+  ./waf -j1 --color=yes configure --with-tests
+  ./waf -j1 --color=yes build
+
+  # Cleanup
+  sudo ./waf -j1 --color=yes distclean
+
+  # Configure/build in optimized mode without tests
+  ./waf -j1 --color=yes configure
+  ./waf -j1 --color=yes build
+
+  # Cleanup
+  sudo ./waf -j1 --color=yes distclean
+fi
+
+# Configure/build in debug mode with tests
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+    COVERAGE="--with-coverage"
+elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
+    ASAN="--with-sanitizer=address"
+fi
+./waf -j1 --color=yes configure --debug --with-tests $COVERAGE $ASAN
+./waf -j1 --color=yes build
+
+# (tests will be run against debug version)
+
+# Install
+sudo ./waf -j1 --color=yes install
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
new file mode 100755
index 0000000..9ffad6c
--- /dev/null
+++ b/.jenkins.d/20-tests.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+# Prepare environment
+rm -Rf ~/.ndn
+
+if has OSX $NODE_LABELS; then
+    security unlock-keychain -p named-data
+fi
+
+ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
+
+BOOST_VERSION=$(python -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
+
+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 NFD and tests
+sudo nfd &
+
+# First run all tests as unprivileged user
+./build/unit-tests $(ut_log_args)
+
+sudo killall nfd || true
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
new file mode 100755
index 0000000..19f014c
--- /dev/null
+++ b/.jenkins.d/30-coverage.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+    gcovr --object-directory=build \
+          --output=build/coverage.xml \
+          --exclude="$PWD/(tests)" \
+          --root=. \
+          --xml
+
+    # Generate also a detailed HTML output
+    mkdir build/coverage
+    gcovr --object-directory=build \
+          --output=build/coverage/index.html \
+          --exclude="$PWD/(tests)" \
+          --root=. \
+          --html \
+          --html-details
+fi
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
new file mode 100644
index 0000000..085e383
--- /dev/null
+++ b/.jenkins.d/README.md
@@ -0,0 +1,34 @@
+CONTINUOUS INTEGRATION SCRIPTS
+==============================
+
+Environment Variables Used in Build Scripts
+-------------------------------------------
+
+- `NODE_LABELS`: the variable defines a list of OS properties.  The set values are used by the
+  build scripts to select proper behavior for different OS.
+
+  The list should include at least `[OS_TYPE]`, `[DISTRO_TYPE]`, and `[DISTRO_VERSION]`.
+
+  Possible values for Linux:
+
+  * `[OS_TYPE]`: `Linux`
+  * `[DISTRO_TYPE]`: `Ubuntu`
+  * `[DISTRO_VERSION]`: `Ubuntu-14.04`, `Ubuntu-16.04`
+
+  Possible values for OS X / macOS:
+
+  * `[OS_TYPE]`: `OSX`
+  * `[DISTRO_TYPE]`: `OSX` (can be absent)
+  * `[DISTRO_VERSION]`: `OSX-10.10`, `OSX-10.11`, `OSX-10.12`
+
+- `JOB_NAME`: optional variable to define type of the job.  Depending on the defined job type,
+  the build scripts can perform different tasks.
+
+  Possible values:
+
+  * empty: default build process
+  * `code-coverage` (Linux OS is assumed): debug build with tests and code coverage analysis
+  * `limited-build`: only a single debug build with tests
+
+- `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
+  e.g., a compiled version of ndn-cxx library.  If not set, `/tmp` is used.
diff --git a/.jenkins.d/util.sh b/.jenkins.d/util.sh
new file mode 100644
index 0000000..a89bc27
--- /dev/null
+++ b/.jenkins.d/util.sh
@@ -0,0 +1,18 @@
+has() {
+    local saved_xtrace
+    [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
+    set +x
+
+    local p=$1
+    shift
+    local i ret=1
+    for i in "$@"; do
+        if [[ "${i}" == "${p}" ]]; then
+            ret=0
+            break
+        fi
+    done
+
+    set ${saved_xtrace}
+    return ${ret}
+}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..76e3ded
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+sudo: required
+language: generic
+env:
+  global:
+    - JOB_NAME=limited-build
+    - BOOST_TEST_COLOR_OUTPUT=true
+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
+      osx_image: xcode8.2
+      env:
+        - CXX=clang++
+        - NODE_LABELS="OSX OSX-10.12"
+notifications:
+  email:
+    on_success: always
+    on_failure: always
+script:
+  - ./.jenkins
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 2999e8f..629b8cf 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -109,6 +109,7 @@
                               '-Wno-unused-parameter',
                               '-Wno-error=maybe-uninitialized', # Bug #1615
                               '-Wno-error=deprecated-declarations', # Bug #3795
+                              '-Wno-error=unused-local-typedefs',
                               ]
         return flags
 
diff --git a/log4cxx.properties b/log4cxx.properties
index e4bdc48..3c67ddb 100644
--- a/log4cxx.properties
+++ b/log4cxx.properties
@@ -1,5 +1,5 @@
 # Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=TRACE, A1, rollingFile
+log4j.rootLogger=DEBUG, A1
 
 # A1 is set to be a ConsoleAppender.
 log4j.appender.A1=org.apache.log4j.ConsoleAppender
@@ -7,31 +7,4 @@
 # A1 uses PatternLayout.
 log4j.appender.A1.layout=org.apache.log4j.PatternLayout
 log4j.appender.A1.target=System.err
-#log4j.appender.A1.layout.ConversionPattern=%d{dd-MMM HH:MM:SS,SSS} %p %c %m%n
-#log4j.appender.A1.layout.ConversionPattern=%d{hh:mm:ss,SSS} %-14t %-14c  %m%n
 log4j.appender.A1.layout.ConversionPattern=%d{ss,SSS} %-5p %-12c  %m%n
-
-log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
-log4j.appender.rollingFile.File=logfile.txt
-log4j.appender.rollingFile.MaxFileSize=10MB
-log4j.appender.rollingFile.MaxBackupIndex=9
-log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
-log4j.appender.rollingFile.layout.ConversionPattern=%d{ss,SSS} %-5p %-12c  %m%n
-
-log4j.logger.Executor = ERROR
-#log4j.logger.Sync.Log = ERROR
-#log4j.logger.Sync.Core = TRACE
-log4j.logger.Scheduler = ERROR
-#
-#log4j.logger.Fetcher = TRACE
-#log4j.logger.FetchManager = TRACE
-
-#log4j.logger.Sync = DEBUG
-#log4j.logger.Sync.Log = ERROR
-#log4j.logger.SyncInterestTable = TRACE
-#log4j.logger.AppDataFetch = TRACE
-#log4j.logger.Test = TRACE
-#log4j.logger.bgpparser=TRACE
-#log4j.logger.bgpparser.AttributeType=ERROR
-#log4j.logger.bgpparser.MRTCommonHeader=ERROR
-
diff --git a/server/server.cpp b/server/server.cpp
index fd91b04..46c983a 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -37,7 +37,7 @@
 
 using namespace ndn::chronoshare;
 
-INIT_LOGGER("HttpServer");
+INIT_LOGGER("HttpServer")
 
 server::server(const std::string& address, const std::string& port, const std::string& doc_root)
   : io_service_()
diff --git a/src/db-helper.cpp b/src/db-helper.cpp
index 8adf5a0..0597c12 100644
--- a/src/db-helper.cpp
+++ b/src/db-helper.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -26,7 +26,7 @@
 namespace ndn {
 namespace chronoshare {
 
-INIT_LOGGER("DbHelper");
+INIT_LOGGER("DbHelper")
 
 namespace fs = boost::filesystem;
 
diff --git a/src/file-state.cpp b/src/file-state.cpp
index 8ff065c..42e40de 100644
--- a/src/file-state.cpp
+++ b/src/file-state.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -22,7 +22,7 @@
 #include "logging.h"
 #include <boost/bind.hpp>
 
-INIT_LOGGER("FileState");
+INIT_LOGGER("FileState")
 
 using namespace boost;
 using namespace std;
diff --git a/src/state-server.cpp b/src/state-server.cpp
index b791e16..a013534 100644
--- a/src/state-server.cpp
+++ b/src/state-server.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -28,7 +28,7 @@
 #include <boost/make_shared.hpp>
 #include <utility>
 
-INIT_LOGGER("StateServer");
+INIT_LOGGER("StateServer")
 
 using namespace Ndnx;
 using namespace std;
diff --git a/src/sync-core.cpp b/src/sync-core.cpp
index 0a5efa6..c6bf498 100644
--- a/src/sync-core.cpp
+++ b/src/sync-core.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -28,7 +28,7 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/make_shared.hpp>
 
-INIT_LOGGER("Sync.Core");
+INIT_LOGGER("Sync.Core")
 
 const string SyncCore::RECOVER = "RECOVER";
 const double SyncCore::WAIT = 0.05;
diff --git a/src/sync-log.cpp b/src/sync-log.cpp
index ced80fe..bb10168 100644
--- a/src/sync-log.cpp
+++ b/src/sync-log.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -25,7 +25,7 @@
 #include <boost/make_shared.hpp>
 #include <boost/thread.hpp>
 
-INIT_LOGGER("Sync.Log");
+INIT_LOGGER("Sync.Log")
 
 using namespace boost;
 using namespace std;
diff --git a/tests/dummy-test.t.cpp b/tests/dummy-test.t.cpp
new file mode 100644
index 0000000..8dbf784
--- /dev/null
+++ b/tests/dummy-test.t.cpp
@@ -0,0 +1,52 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2017, Regents of the University of California.
+ *
+ * This file is part of ChronoShare, a decentralized file sharing application over NDN.
+ *
+ * ChronoShare is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * ChronoShare is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License along with
+ * ChronoShare, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ChronoShare authors and contributors.
+ */
+
+#include "test-common.hpp"
+
+namespace ndn {
+namespace chronoshare {
+namespace tests {
+
+// See http://redmine.named-data.net/projects/nfd/wiki/UnitTesting on how to name a test suite.
+BOOST_AUTO_TEST_SUITE(TestSkeleton)
+
+BOOST_AUTO_TEST_CASE(Test1)
+{
+  int i = 0;
+
+  // For reference of available Boost.Test macros, see
+  // http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/utf/testing-tools/reference.html
+
+  BOOST_REQUIRE_NO_THROW(i = 1);
+  BOOST_REQUIRE_EQUAL(i, 1);
+}
+
+// Use UnitTestTimeFixture to mock clocks.
+BOOST_FIXTURE_TEST_CASE(Test2, UnitTestTimeFixture)
+{
+  // this->advanceClocks increments mock clocks.
+  advanceClocks(time::milliseconds(500), 2);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace chronoshare
+} // namespace ndn
diff --git a/tests/logger-config-global-fixture.cpp b/tests/logger-config-global-fixture.cpp
index 2663333..fab5a29 100644
--- a/tests/logger-config-global-fixture.cpp
+++ b/tests/logger-config-global-fixture.cpp
@@ -1,24 +1,28 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
- * This file is part of NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
+ * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
- * NDNS is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
+ * ChronoShare is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
  *
- * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
+ * ChronoShare is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along with
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received copies of the GNU General Public License along with
+ * ChronoShare, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ChronoShare authors and contributors.
  */
 
 #include "core/chronoshare-config.hpp"
 
+#include <boost/version.hpp>
+#include <boost/filesystem.hpp>
+
 #include "test-common.hpp"
 
 namespace ndn {
diff --git a/tests/wscript b/tests/wscript
index d6bcf93..5d667b5 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -5,8 +5,10 @@
 from waflib import Logs
 
 def build(bld):
-    Logs.error("Unit tests are temporary disabled")
-    return
+    if not bld.env['WITH_TESTS']:
+        return
+
+    Logs.error("Most unit tests are temporary disabled")
 
     bld(features='cxx',
         target='unit-tests-main',
@@ -19,8 +21,9 @@
     unit_tests = bld.program(
             target='../unit-tests',
             features='cxx cxxprogram',
-            source=bld.path.ant_glob(['**/*.cpp'], excl=['main.cpp']),
-            use='unit-tests-main chronoshare',
+            source=bld.path.ant_glob(['**/*.cpp'], excl=['main.cpp',
+                                                         'unit-tests/**/*.cpp']),
+            use='unit-tests-main core-objects chronoshare',
             install_path=None,
             defines='UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % (bld.bldnode),
             includes='.. ../src .',
diff --git a/wscript b/wscript
index e0f5c04..4b03fe1 100644
--- a/wscript
+++ b/wscript
@@ -86,7 +86,7 @@
         target='core-objects',
         features=['cxx'],
         source=bld.path.ant_glob('core/**/*.cpp'),
-        use='LOG4CXX BOOST',
+        use='NDN_CXX LOG4CXX BOOST',
         includes='.',
         export_includes='.')