ci: Embedding CI build and test running script

This commit also unifies build and test scripts for Jenkins and Travis CI

Change-Id: Ieaf2d8793c2320a23ce9958c9cf06b3abd4d500f
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
new file mode 100755
index 0000000..6385fc9
--- /dev/null
+++ b/.jenkins.d/20-tests.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+set -x
+set -e
+
+# Prepare environment
+rm -Rf ~/.ndnx ~/.ndn
+
+echo $NODE_LABELS
+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"
+  sudo chgrp admin /dev/bpf*
+  sudo chmod g+rw /dev/bpf*
+fi
+if [[ $IS_LINUX = "yes" ]]; then
+  sudo setcap cap_net_raw,cap_net_admin=eip `pwd`/build/unit-tests-core || true
+  sudo setcap cap_net_raw,cap_net_admin=eip `pwd`/build/unit-tests-daemon || true
+  sudo setcap cap_net_raw,cap_net_admin=eip `pwd`/build/unit-tests-rib || true
+fi
+
+ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
+
+# Run unit tests
+# Core
+./build/unit-tests-core -l test_suite
+
+# Daemon
+./build/unit-tests-daemon -l test_suite
+
+# RIB
+./build/unit-tests-rib -l test_suite