build: Synchronize CI scripts with NFD
This commits also fixes discovered incorrect memory accesses in SqliteStorage.
Change-Id: I85e1d1b62be15b6d9f0a2824e4fac8cbf2ca5f9b
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
new file mode 100755
index 0000000..e0a4194
--- /dev/null
+++ b/.jenkins.d/00-deps.sh
@@ -0,0 +1,34 @@
+#!/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
+ FORMULAE=(boost pkg-config openssl)
+ brew update
+ if [[ -n $TRAVIS ]]; then
+ # travis images come with a large number of brew packages
+ # pre-installed, don't waste time upgrading all of them
+ for FORMULA in "${FORMULAE[@]}"; do
+ brew outdated $FORMULA || brew upgrade $FORMULA
+ done
+ else
+ brew upgrade
+ fi
+ brew install "${FORMULAE[@]}"
+ brew cleanup
+fi
+
+if has Ubuntu $NODE_LABELS; then
+ sudo apt-get -qq update
+ sudo apt-get -qy install build-essential pkg-config libboost-all-dev \
+ libsqlite3-dev libssl-dev
+
+ if [[ $JOB_NAME == *"code-coverage" ]]; then
+ sudo apt-get -qy install lcov libgd-perl python-setuptools
+ sudo easy_install --upgrade gcovr
+ fi
+fi
diff --git a/.jenkins.d/01-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
new file mode 100755
index 0000000..c9e2a63
--- /dev/null
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -0,0 +1,56 @@
+#!/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=
+if has OSX $NODE_LABELS; then
+ BOOST=$(brew ls --versions boost)
+ OLD_BOOST=$(cat boost.txt || :)
+ if [[ $OLD_BOOST != $BOOST ]]; then
+ echo "$BOOST" > boost.txt
+ INSTALLED_VERSION=NONE
+ fi
+fi
+
+if [[ -z $INSTALLED_VERSION ]]; then
+ INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
+fi
+
+sudo rm -Rf ndn-cxx-latest
+
+git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
+
+LATEST_VERSION=$(git -C ndn-cxx-latest 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
+else
+ sudo rm -Rf ndn-cxx-latest
+fi
+
+sudo rm -f /usr/local/bin/ndnsec*
+sudo rm -fr /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/lib/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
+
+pushd ndn-cxx >/dev/null
+
+./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
+./waf build --color=yes -j${WAF_JOBS:-1}
+sudo env "PATH=$PATH" ./waf install --color=yes
+
+popd >/dev/null
+popd >/dev/null
+
+if has Linux $NODE_LABELS; then
+ sudo ldconfig
+elif has FreeBSD10 $NODE_LABELS; then
+ sudo ldconfig -m
+fi
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
new file mode 100755
index 0000000..fcf207c
--- /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 env "PATH=$PATH" ./waf --color=yes distclean
+
+if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
+ # Configure/build in optimized mode with tests
+ ./waf --color=yes configure --with-tests
+ ./waf --color=yes build -j${WAF_JOBS:-1}
+
+ # Cleanup
+ sudo env "PATH=$PATH" ./waf --color=yes distclean
+
+ # Configure/build in optimized mode without tests
+ ./waf --color=yes configure
+ ./waf --color=yes build -j${WAF_JOBS:-1}
+
+ # Cleanup
+ sudo env "PATH=$PATH" ./waf --color=yes distclean
+fi
+
+# Configure/build in debug mode with tests
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+ COVERAGE="--with-coverage"
+elif [[ -n $BUILD_WITH_ASAN || -z $TRAVIS ]]; then
+ ASAN="--with-sanitizer=address"
+fi
+./waf --color=yes configure --debug --with-tests $COVERAGE $ASAN
+./waf --color=yes build -j${WAF_JOBS:-1}
+
+# (tests will be run against debug version)
+
+# Install
+sudo env "PATH=$PATH" ./waf --color=yes install
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/10-ndn-cxx.sh
deleted file mode 100755
index 823b816..0000000
--- a/.jenkins.d/10-ndn-cxx.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-set -x
-set -e
-
-cd /tmp
-BUILD="no"
-if [ ! -d ndn-cxx ]; then
- git clone --depth 1 git://github.com/named-data/ndn-cxx
- cd ndn-cxx
- BUILD="yes"
-else
- cd ndn-cxx
- INSTALLED_VERSION=`git rev-parse HEAD || echo NONE`
- sudo rm -Rf latest-version
- git clone --depth 1 git://github.com/named-data/ndn-cxx latest-version
- cd latest-version
- LATEST_VERSION=`git rev-parse HEAD || echo UNKNOWN`
- cd ..
- rm -Rf latest-version
- if [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then
- cd ..
- sudo rm -Rf ndn-cxx
- git clone --depth 1 git://github.com/named-data/ndn-cxx
- cd ndn-cxx
- BUILD="yes"
- fi
-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*
-
-if [ "$BUILD" = "yes" ]; then
- ./waf distclean --color=yes
-fi
-
-./waf configure --color=yes --without-osx-keychain
-./waf -j1 --color=yes
-sudo ./waf install --color=yes
diff --git a/.jenkins.d/20-build.sh b/.jenkins.d/20-build.sh
deleted file mode 100755
index 985216e..0000000
--- a/.jenkins.d/20-build.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-set -x
-set -e
-
-git submodule init
-git submodule sync
-git submodule update
-
-COVERAGE=$( python -c "print '--with-coverage' if 'code-coverage' in '$JOB_NAME' else ''" )
-
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
-
-# Configure/build in debug mode
-./waf -j1 --color=yes configure --with-tests --debug
-./waf -j1 --color=yes build
-
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
-
-# Configure/build in optimized mode without tests with precompiled headers
-./waf -j1 --color=yes configure
-./waf -j1 --color=yes build
-
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
-
-# Configure/build in optimized mode
-./waf -j1 --color=yes configure --with-tests $COVERAGE
-./waf -j1 --color=yes build
-
-# (tests will be run against optimized 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..469b5bd
--- /dev/null
+++ b/.jenkins.d/20-tests.sh
@@ -0,0 +1,45 @@
+#!/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 all tests as unprivileged user
+./build/unit-tests $(ut_log_args)
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
new file mode 100755
index 0000000..77f0aa6
--- /dev/null
+++ b/.jenkins.d/30-coverage.sh
@@ -0,0 +1,29 @@
+#!/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
+ lcov --quiet \
+ --capture \
+ --directory . \
+ --no-external \
+ --rc lcov_branch_coverage=1 \
+ --output-file build/coverage-with-tests.info
+
+ lcov --quiet \
+ --remove build/coverage-with-tests.info "$PWD/tests/*" \
+ --rc lcov_branch_coverage=1 \
+ --output-file build/coverage.info
+
+ genhtml --branch-coverage \
+ --demangle-cpp \
+ --frames \
+ --legend \
+ --output-directory build/coverage \
+ --title "repo-ng unit tests" \
+ build/coverage.info
+fi
diff --git a/.jenkins.d/30-nfd.sh b/.jenkins.d/30-nfd.sh
deleted file mode 100755
index 2f139cd..0000000
--- a/.jenkins.d/30-nfd.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-set -x
-set -e
-
-cd /tmp
-BUILD="no"
-if [ ! -d NFD ]; then
- git clone --recursive --depth 1 git://github.com/named-data/NFD
- cd NFD
- BUILD="yes"
-else
- cd NFD
- INSTALLED_VERSION=`git rev-parse HEAD || echo NONE`
- sudo rm -Rf latest-version
- git clone --recursive --depth 1 git://github.com/named-data/NFD latest-version
- cd latest-version
- LATEST_VERSION=`git rev-parse HEAD || echo UNKNOWN`
- cd ..
- rm -Rf latest-version
- if [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then
- cd ..
- sudo rm -Rf NFD
- git clone --recursive --depth 1 git://github.com/named-data/NFD
- cd NFD
- BUILD="yes"
- fi
-fi
-
-if [ "$BUILD" = "yes" ]; then
- sudo ./waf -j1 --color=yes distclean
-fi
-
-git submodule update --init
-
-./waf configure -j1 --color=yes
-./waf -j1 --color=yes
-sudo ./waf install -j1 --color=yes
diff --git a/.jenkins.d/40-tests.sh b/.jenkins.d/40-tests.sh
deleted file mode 100755
index c4806a3..0000000
--- a/.jenkins.d/40-tests.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-set -x
-set -e
-
-# Run tests
-sudo rm -Rf ~/.ndn
-mkdir ~/.ndn
-
-sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
-
-IS_OSX=$( python -c "print 'yes' if 'OSX' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
-IS_LINUX=$( python -c "print 'yes' if 'Linux' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
-
-if [ $IS_OSX = "yes" ]; then
- security unlock-keychain -p "named-data"
-fi
-
-./build/unit-tests -l test_suite
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
new file mode 100644
index 0000000..41812aa
--- /dev/null
+++ b/.jenkins.d/README.md
@@ -0,0 +1,36 @@
+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.
+
+- `WAF_JOBS`: number of parallel build jobs used by waf, defaults to 1.
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..eaf279c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,138 @@
+sudo: required
+language: generic
+env:
+ global:
+ - JOB_NAME=limited-build
+ - WAF_JOBS=2
+
+matrix:
+ include:
+ # Linux/gcc
+ - os: linux
+ dist: trusty
+ env:
+ - CXX=g++-4.8
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources: ubuntu-toolchain-r-test
+ packages: g++-4.9
+ env:
+ - CXX=g++-4.9
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources: ubuntu-toolchain-r-test
+ packages: g++-5
+ env:
+ - CXX=g++-5
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources: ubuntu-toolchain-r-test
+ packages: g++-6
+ env:
+ - CXX=g++-6
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources: ubuntu-toolchain-r-test
+ packages: g++-7
+ env:
+ - CXX=g++-7
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+
+ # Linux/clang
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ packages: clang-3.5
+ env:
+ - CXX=clang++-3.5
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ packages: clang-3.6
+ env:
+ - CXX=clang++-3.6
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.7
+ - ubuntu-toolchain-r-test
+ packages: clang-3.7
+ env:
+ - CXX=clang++-3.7
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.8
+ - ubuntu-toolchain-r-test
+ packages: clang-3.8
+ env:
+ - CXX=clang++-3.8
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources: llvm-toolchain-trusty-3.9
+ packages: clang-3.9
+ env:
+ - CXX=clang++-3.9
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - os: linux
+ dist: trusty
+ addons:
+ apt:
+ sources: llvm-toolchain-trusty-4.0
+ packages: clang-4.0
+ env:
+ - CXX=clang++-4.0
+ - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+ - BUILD_WITH_ASAN=yes
+
+ # macOS/clang
+ # https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
+ - os: osx
+ osx_image: xcode7.3
+ env:
+ - NODE_LABELS="OSX OSX-10.11"
+ - BUILD_WITH_ASAN=yes
+ - os: osx
+ osx_image: xcode8.3
+ env:
+ - NODE_LABELS="OSX OSX-10.12"
+ - BUILD_WITH_ASAN=yes
+
+before_script:
+ - ${CXX:-c++} --version
+ - python --version
+
+script:
+ - ./.jenkins
diff --git a/.waf-tools/coverage.py b/.waf-tools/coverage.py
new file mode 100644
index 0000000..ce92883
--- /dev/null
+++ b/.waf-tools/coverage.py
@@ -0,0 +1,22 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+from waflib import TaskGen, Logs
+
+def options(opt):
+ opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
+ help='''Set compiler flags for gcc to enable code coverage information''')
+
+def configure(conf):
+ if conf.options.with_coverage:
+ if not conf.options.debug:
+ conf.fatal("Code coverage flags require debug mode compilation (add --debug)")
+ conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
+ linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
+
+@TaskGen.feature('cxx','cc')
+@TaskGen.after('process_source')
+def add_coverage(self):
+ if getattr(self, 'use', ''):
+ self.use += ' GCOV'
+ else:
+ self.use = 'GCOV'
diff --git a/.waf-tools/sanitizers.py b/.waf-tools/sanitizers.py
new file mode 100644
index 0000000..a8fe55d
--- /dev/null
+++ b/.waf-tools/sanitizers.py
@@ -0,0 +1,22 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def options(opt):
+ opt.add_option('--with-sanitizer', action='store', default='', dest='sanitizers',
+ help='Comma-separated list of compiler sanitizers to enable [default=none]')
+
+def configure(conf):
+ for san in conf.options.sanitizers.split(','):
+ if not san:
+ continue
+
+ sanflag = '-fsanitize=%s' % san
+ conf.start_msg('Checking if compiler supports %s' % sanflag)
+
+ if conf.check_cxx(cxxflags=['-Werror', sanflag, '-fno-omit-frame-pointer'],
+ linkflags=[sanflag], mandatory=False):
+ conf.end_msg('yes')
+ conf.env.append_unique('CXXFLAGS', [sanflag, '-fno-omit-frame-pointer'])
+ conf.env.append_unique('LINKFLAGS', [sanflag])
+ else:
+ conf.end_msg('no', color='RED')
+ conf.fatal('%s sanitizer is not supported by the current compiler' % san)
diff --git a/src/storage/sqlite-storage.cpp b/src/storage/sqlite-storage.cpp
index 3411dfb..35fa642 100644
--- a/src/storage/sqlite-storage.cpp
+++ b/src/storage/sqlite-storage.cpp
@@ -155,16 +155,25 @@
std::cerr << "insert sql not prepared" << std::endl;
}
//Insert
- if (sqlite3_bind_null(insertStmt, 1) == SQLITE_OK &&
- sqlite3_bind_blob(insertStmt, 2,
- entry.getName().wireEncode().wire(),
- entry.getName().wireEncode().size(), 0) == SQLITE_OK &&
- sqlite3_bind_blob(insertStmt, 3,
- data.wireEncode().wire(),
- data.wireEncode().size(),0 ) == SQLITE_OK &&
- sqlite3_bind_blob(insertStmt, 4,
- (const void*)&(*entry.getKeyLocatorHash()),
- ndn::util::Sha256::DIGEST_SIZE, 0) == SQLITE_OK) {
+ auto result = sqlite3_bind_null(insertStmt, 1);
+ if (result == SQLITE_OK) {
+ result = sqlite3_bind_blob(insertStmt, 2,
+ entry.getName().wireEncode().wire(),
+ entry.getName().wireEncode().size(), SQLITE_STATIC);
+ }
+ if (result == SQLITE_OK) {
+ result = sqlite3_bind_blob(insertStmt, 3,
+ data.wireEncode().wire(),
+ data.wireEncode().size(), SQLITE_STATIC);
+ }
+ if (result == SQLITE_OK) {
+ BOOST_ASSERT(entry.getKeyLocatorHash()->size() == ndn::util::Sha256::DIGEST_SIZE);
+ result = sqlite3_bind_blob(insertStmt, 4,
+ entry.getKeyLocatorHash()->data(),
+ entry.getKeyLocatorHash()->size(), SQLITE_STATIC);
+ }
+
+ if (result == SQLITE_OK) {
rc = sqlite3_step(insertStmt);
if (rc == SQLITE_CONSTRAINT) {
std::cerr << "Insert failed" << std::endl;
diff --git a/wscript b/wscript
index 02be7f5..fed01bf 100644
--- a/wscript
+++ b/wscript
@@ -6,7 +6,7 @@
def options(opt):
opt.load('compiler_c compiler_cxx gnu_dirs')
- opt.load('boost default-compiler-flags doxygen sqlite3', tooldir=['.waf-tools'])
+ opt.load('boost default-compiler-flags doxygen sqlite3 coverage sanitizers', tooldir=['.waf-tools'])
ropt = opt.add_option_group('ndn-repo-ng Options')
@@ -42,6 +42,10 @@
except:
pass
+ conf.load('coverage')
+
+ conf.load('sanitizers')
+
conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/repo-ng.conf' % conf.env['SYSCONFDIR'])
if not conf.options.with_sqlite_locking: