allow packages to be provided locally or fetched from alternate branches
refs #1895
Change-Id: Idae33f3af5091413c915c5081d505bacea957c5d
diff --git a/.gitignore b/.gitignore
index c26d822..9dacfdf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,6 @@
/temp/
/test_interest_loop/keys/
logs/
+/repos.conf
+/packages/
+/prepare/
diff --git a/README.md b/README.md
index 5ecec83..4ce0c0f 100644
--- a/README.md
+++ b/README.md
@@ -12,36 +12,11 @@
## Setup Instructions: ##
-To install NDN applications used for the tests
-
- USAGE:
- ./install_apps.py [OPTIONS]
-
- Install NDN applications
- Latest source codes will be downloaded from their GitHub named-data repositories
-
- OPTIONS:
- install_ndncppdev - install ndn-cpp-dev (https://github.com/named-data/ndn-cpp-dev)
- setup_security - create an identity (/tmp/nfd_integration) using ndnsec
- install_NFD - install NFD (https://github.com/named-data/NFD)
- install_ndntraffic - install ndn-traffic-generator (https://github.com/named-data/ndn-traffic-generator)
- install_ndntools - install ndn-tools (https://github.com/named-data/ndn-tools)
- install_infoedit - install infoedit
- install_all - do all of the above
- help - print this message and exit
+To install all NDN applications used for the tests, run `./install_apps.py install_all`. To install
+one or more particular apps only, find the proper command line argument(s) to use in place of
+`install_all` by running `./install_apps.py help`.
## Test Run Instructions: #
-To run tests
-
- USAGE:
- ./run_tests.py [OPTIONS]
-
- Run a subset of NFD integration test cases
- The test case(s) to be executed should be provided as command line option(s)
-
- OPTIONS:
- test_ndnping
- test_all - run all the above tests
- help - print this message and exit
-
+To run all tests, run `./run_tests.py test_all`. To run one or more particular tests, run
+`./run_tests.py help` to find the proper command line argument(s) to use in place of `test_all`.
diff --git a/install_apps.py b/install_apps.py
index b267357..51abd9e 100755
--- a/install_apps.py
+++ b/install_apps.py
@@ -8,17 +8,19 @@
print "\nUSAGE:"
print " ./install_apps.py [OPTIONS]\n"
print " Install NDN applications"
- print " Latest source codes will be downloaded from their GitHub"
- print " named-data repositories (https://github.com/named-data)"
+ print " By default, the latest version of each package will be downloaded from the NDN GitHub"
+ print " repositories (https://github.com/named-data). To obtain the packages locally or from"
+ print " a specific branch or Gerrit change, use the repos.conf file (see repos.conf.sample for"
+ print " more information)."
print "\nOPTIONS:"
print " install_ndncxx - install ndn-cxx (named-data/ndn-cxx)"
- print " setup_security - create an identity using ndnsec (/tmp/nfd_integration)"
+ print " setup_security - create an identity using ndnsec (/tmp/nfd_integration_tests)"
print " install_NFD - install NFD (named-data/NFD)"
print " install_ndntraffic - install ndn-traffic-generator (named-data/ndn-traffic-generator)"
print " install_ndntools - install ndn-tools (named-data/ndn-tools)"
- print " install_repo - install repo-ng (named-data/repo-ng)"
+ print " install_repong - install repo-ng (named-data/repo-ng)"
print " install_infoedit - install infoedit"
- print " install_tools - install tests tools"
+ print " install_tools - install test tools"
print " install_all - do all of the above"
print " help - print this message and exit\n"
@@ -34,7 +36,7 @@
"install_NFD",
"install_ndntraffic",
"install_ndntools",
- "install_repo",
+ "install_repong",
"install_infoedit",
"install_tools",
"install_all",
@@ -55,34 +57,25 @@
actionList.add("install_NFD")
actionList.add("install_ndntraffic")
actionList.add("install_ndntools")
- actionList.add("install_repo")
+ actionList.add("install_repong")
actionList.add("install_infoedit")
actionList.add("install_tools")
- module = __import__("setup_preparation_folder")
- module.run()
- module = __import__("install_dependencies")
- module.run()
+ os.system("./install_helpers/setup_preparation_folder.sh")
+ os.system("./install_helpers/install_dependencies.sh")
if "install_ndncxx" in actionList:
- module = __import__("install_ndncxx")
- module.run()
+ os.system("./install_helpers/install_ndncxx.sh")
if "setup_security" in actionList:
- module = __import__("setup_security")
- module.run()
+ os.system("./install_helpers/setup_security.sh")
if "install_NFD" in actionList:
- module = __import__("install_NFD")
- module.run()
+ os.system("./install_helpers/install_NFD.sh")
if "install_ndntraffic" in actionList:
- module = __import__("install_ndntraffic")
- module.run()
+ os.system("./install_helpers/install_ndntraffic.sh")
if "install_ndntools" in actionList:
- module = __import__("install_ndntools")
- module.run()
- if "install_repo" in actionList:
- module = __import__("install_repo")
- module.run()
+ os.system("./install_helpers/install_ndntools.sh")
+ if "install_repong" in actionList:
+ os.system("./install_helpers/install_repong.sh")
if "install_infoedit" in actionList:
- module = __import__("install_infoedit")
- module.run()
+ os.system("./install_helpers/install_infoedit.sh")
if "install_tools" in actionList:
module = __import__("install_tools")
module.run()
diff --git a/install_helpers/common.sh b/install_helpers/common.sh
new file mode 100644
index 0000000..5a78668
--- /dev/null
+++ b/install_helpers/common.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+if [[ -f repos.conf ]]; then
+ source repos.conf
+fi
+
+# Check out the repository of the specified package from Gerrit or a local repository.
+#
+# Parameters:
+# name of package used in repository names (e.g., ndn-cxx or NFD)
+# name of package used in variable names (e.g., NDNCXX or NFD)
+#
+# This function changes the working directory to the directory containing the package source.
+prepare_repo() {
+ local PACKAGE_NAME=$1
+ local PACKAGE_VAR=PACKAGE_$2
+ local PACKAGE_SOURCE=${!PACKAGE_VAR}
+ if [[ -z $PACKAGE_SOURCE ]]; then
+ PACKAGE_SOURCE=branch:master
+ fi
+
+ local SOURCE=${PACKAGE_SOURCE%%:*}
+ local LOCATION=${PACKAGE_SOURCE#*:}
+ if [[ $SOURCE == branch || $SOURCE == gerrit ]]; then
+ if [[ $SOURCE == branch ]]; then
+ local GERRIT_BRANCH=$LOCATION
+ else
+ local GERRIT_CHANGE=${LOCATION%%,*}
+ local GERRIT_PATCHSET=${LOCATION#*,}
+ local GERRIT_BRANCH="refs/changes/$(printf '%02d' $(($GERRIT_CHANGE % 100)))/$GERRIT_CHANGE/$GERRIT_PATCHSET"
+ fi
+
+ echo "Checking out from Gerrit: $GERRIT_BRANCH"
+ cd prepare
+ git init $PACKAGE_NAME
+ cd $PACKAGE_NAME
+ git pull --depth 1 https://gerrit.named-data.net/$PACKAGE_NAME $GERRIT_BRANCH
+ elif [[ $SOURCE == local ]]; then
+ echo "Using local copy of $PACKAGE_NAME"
+ if [[ ! -d packages/$PACKAGE_NAME ]]; then
+ echo "ERROR: No local copy of package $PACKAGE_NAME could be found in prepare"
+ exit 1
+ fi
+ cp -r packages/$PACKAGE_NAME prepare
+ cd prepare/$PACKAGE_NAME
+ else
+ echo "SYNTAX ERROR: Package $PACKAGE_NAME has incorrectly formatted source: $PACKAGE_SOURCE"
+ exit 2
+ fi
+}
diff --git a/install_helpers/install_NFD.py b/install_helpers/install_NFD.py
deleted file mode 100644
index ff4db7b..0000000
--- a/install_helpers/install_NFD.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install NFD
-def run():
- print "\nINSTALLING NFD"
- print "**************"
- os.system("git clone --depth 1 https://github.com/named-data/NFD")
- os.chdir("NFD")
- os.system("git submodule init && git submodule update")
- os.system("./waf configure --with-other-tests")
- os.system("./waf")
- os.system("sudo ./waf install")
- os.system("sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf")
- os.system("sudo mkdir /usr/local/etc/ndn/keys/")
- os.system("ndnsec-cert-dump -i `ndnsec-get-default` > ~/default.ndncert")
- os.system("sudo mv ~/default.ndncert /usr/local/etc/ndn/keys")
- os.chdir("..")
diff --git a/install_helpers/install_NFD.sh b/install_helpers/install_NFD.sh
new file mode 100755
index 0000000..d6bfc62
--- /dev/null
+++ b/install_helpers/install_NFD.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source install_helpers/common.sh
+
+echo
+echo "INSTALLING NFD"
+echo "**************"
+
+prepare_repo NFD NFD
+git submodule update --init --depth 1
+./waf configure --with-other-tests
+./waf
+sudo ./waf install
+sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
+sudo mkdir -p /usr/local/etc/ndn/keys
+ndnsec-cert-dump -i "$(ndnsec-get-default)" | sudo tee /usr/local/etc/ndn/keys/default.ndncert > /dev/null
diff --git a/install_helpers/install_dependencies.py b/install_helpers/install_dependencies.py
deleted file mode 100644
index 6c5d1f3..0000000
--- a/install_helpers/install_dependencies.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install Dependencies & Necessary Tools
-def run():
- print "\nINSTALLING DEPENDENCIES"
- print "***********************"
- os.system("sudo apt-get -qq update")
- os.system("sudo apt-get -qq install build-essential git libboost-all-dev libcrypto++-dev libpcap-dev pkg-config libsqlite3-dev socat bind9 libssl-dev")
diff --git a/install_helpers/install_dependencies.sh b/install_helpers/install_dependencies.sh
new file mode 100755
index 0000000..e9b6e7d
--- /dev/null
+++ b/install_helpers/install_dependencies.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Install dependencies and necessary tools
+
+echo
+echo "INSTALLING DEPENDENCIES"
+echo "***********************"
+
+sudo apt-get -qq update
+sudo apt-get -qq install build-essential git libboost-all-dev libpcap-dev pkg-config libsqlite3-dev socat bind9 libssl-dev
diff --git a/install_helpers/install_infoedit.py b/install_helpers/install_infoedit.py
deleted file mode 100644
index ba8624b..0000000
--- a/install_helpers/install_infoedit.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install infoedit
-def run():
- print "\nINSTALLING infoedit"
- print "**************"
- os.system("git clone --depth 1 https://github.com/NDN-Routing/infoedit.git")
- os.chdir("infoedit")
- os.system("make")
- os.system("sudo make install")
- os.chdir("..")
diff --git a/install_helpers/install_infoedit.sh b/install_helpers/install_infoedit.sh
new file mode 100755
index 0000000..bad7360
--- /dev/null
+++ b/install_helpers/install_infoedit.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+echo
+echo "INSTALLING infoedit"
+echo "*******************"
+
+cd prepare
+git clone --depth 1 https://github.com/NDN-Routing/infoedit.git
+cd infoedit
+make
+sudo make install
diff --git a/install_helpers/install_ndncxx.py b/install_helpers/install_ndncxx.py
deleted file mode 100644
index 74495f5..0000000
--- a/install_helpers/install_ndncxx.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install ndn-cxx
-def run():
- print "\nINSTALLING ndn-cxx"
- print "**********************"
- os.system("git clone --depth 1 https://github.com/named-data/ndn-cxx")
- os.chdir("ndn-cxx")
- os.system("./waf configure")
- os.system("./waf")
- os.system("sudo ./waf install")
- os.system("mkdir -p ~/.ndn")
- os.system("sudo ldconfig")
- os.chdir("..")
diff --git a/install_helpers/install_ndncxx.sh b/install_helpers/install_ndncxx.sh
new file mode 100755
index 0000000..0cfd091
--- /dev/null
+++ b/install_helpers/install_ndncxx.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+source install_helpers/common.sh
+
+echo
+echo "INSTALLING ndn-cxx"
+echo "******************"
+
+prepare_repo ndn-cxx NDNCXX
+./waf configure
+./waf
+sudo ./waf install
+sudo ldconfig
+mkdir -p ~/.ndn
diff --git a/install_helpers/install_ndntools.py b/install_helpers/install_ndntools.py
deleted file mode 100644
index d4d0b92..0000000
--- a/install_helpers/install_ndntools.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install ndn-tools
-def run():
- print "\nINSTALLING ndn-tools"
- print "***********************"
- os.system("git clone --depth 1 https://github.com/named-data/ndn-tools")
- os.chdir("ndn-tools")
- os.system("./waf configure")
- os.system("./waf")
- os.system("sudo ./waf install")
- os.chdir("..")
diff --git a/install_helpers/install_ndntools.sh b/install_helpers/install_ndntools.sh
new file mode 100755
index 0000000..62022d9
--- /dev/null
+++ b/install_helpers/install_ndntools.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+source install_helpers/common.sh
+
+echo
+echo "INSTALLING ndn-tools"
+echo "********************"
+
+prepare_repo ndn-tools NDNTOOLS
+./waf configure
+./waf
+sudo ./waf install
diff --git a/install_helpers/install_ndntraffic.py b/install_helpers/install_ndntraffic.py
deleted file mode 100644
index f8e85ab..0000000
--- a/install_helpers/install_ndntraffic.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install ndn-traffic-generator
-def run():
- print "\nINSTALLING ndn-traffic-generator"
- print "********************************"
- os.system("git clone --depth 1 https://github.com/named-data/ndn-traffic-generator")
- os.chdir("ndn-traffic-generator")
- os.system("./waf configure")
- os.system("./waf")
- os.system("sudo ./waf install")
- os.chdir("..")
diff --git a/install_helpers/install_ndntraffic.sh b/install_helpers/install_ndntraffic.sh
new file mode 100755
index 0000000..75ab556
--- /dev/null
+++ b/install_helpers/install_ndntraffic.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+source install_helpers/common.sh
+
+echo
+echo "INSTALLING ndn-traffic-generator"
+echo "********************************"
+
+prepare_repo ndn-traffic-generator NDNTRAFFIC
+./waf configure
+./waf
+sudo ./waf install
diff --git a/install_helpers/install_repo.py b/install_helpers/install_repo.py
deleted file mode 100644
index 8748274..0000000
--- a/install_helpers/install_repo.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Install repo-ng
-def run():
- print "\nINSTALLING repo-ng"
- print "***********************"
- os.system("git clone --depth 1 https://github.com/named-data/repo-ng")
- os.chdir("repo-ng")
- os.system("./waf configure")
- os.system("./waf")
- os.system("sudo ./waf install")
- os.chdir("..")
diff --git a/install_helpers/install_repong.sh b/install_helpers/install_repong.sh
new file mode 100755
index 0000000..fa3ae99
--- /dev/null
+++ b/install_helpers/install_repong.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+source install_helpers/common.sh
+
+echo
+echo "INSTALLING repo-ng"
+echo "******************"
+
+prepare_repo repo-ng REPONG
+./waf configure
+./waf
+sudo ./waf install
diff --git a/install_helpers/setup_preparation_folder.py b/install_helpers/setup_preparation_folder.py
deleted file mode 100644
index 777fb73..0000000
--- a/install_helpers/setup_preparation_folder.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/python2
-import os
-from os.path import expanduser
-
-# Setup Preparation Folder
-def run():
- print "\nSETTING UP PREPARATION FOLDER"
- print "******************************"
- home = expanduser("~")
- os.chdir(home)
- os.system("rm -rf nfd_prepare")
- os.mkdir("nfd_prepare")
- os.chdir("nfd_prepare")
-
diff --git a/install_helpers/setup_preparation_folder.sh b/install_helpers/setup_preparation_folder.sh
new file mode 100755
index 0000000..194622d
--- /dev/null
+++ b/install_helpers/setup_preparation_folder.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+echo
+echo "SETTING UP PREPARATION FOLDER"
+echo "*****************************"
+
+rm -rf prepare
+mkdir prepare
diff --git a/install_helpers/setup_security.py b/install_helpers/setup_security.py
deleted file mode 100644
index 4d550cd..0000000
--- a/install_helpers/setup_security.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python2
-import os
-
-# Configure Security Environment Using ndnsec
-def run():
- print "\nCONFIGURING SECURITY ENVIRONMENT WITH ndnsec"
- print "********************************************"
- os.system("ndnsec-keygen -n '/tmp/nfd_integration_tests/' | ndnsec-install-cert -")
diff --git a/install_helpers/setup_security.sh b/install_helpers/setup_security.sh
new file mode 100755
index 0000000..c3bfcf8
--- /dev/null
+++ b/install_helpers/setup_security.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# Configure security environment using ndnsec
+
+echo
+echo "CONFIGURING SECURITY ENVIRONMENT WITH ndnsec"
+echo "********************************************"
+
+ndnsec-keygen -n /tmp/nfd_integration_tests/ | ndnsec-install-cert -
diff --git a/repos.conf.sample b/repos.conf.sample
new file mode 100644
index 0000000..f9c25a9
--- /dev/null
+++ b/repos.conf.sample
@@ -0,0 +1,23 @@
+# This file indicates where each package should be obtained from when running the integration test
+# suite. This file must be renamed to repos.conf to be used by the framework.
+#
+# Specific branches can be fetched by setting a PACKAGE_* variable to "branch:[name]", where
+# "[name]" is the name of the branch. For example, the master branch can be fetched by setting the
+# variable to "branch:master".
+#
+# A specific Gerrit patchset can be obtained by setting PACKAGE_* to "gerrit:[change],[patchset]",
+# where "[change]" is the change number and "[patchset]" is the patchset number. For example, change
+# 8888, patchset 1 can be obtained by setting the variable to "gerrit:8888,1".
+#
+# Specifying "local" uses a local version of the package, located in a subdirectory of the
+# integration tests directory named "packages". Within "packages", each local package must be in a
+# directory with the same name as the upstream repository (e.g., ndn-cxx would be in a directory
+# named "packages/ndn-cxx" and NFD would be in a directory named "packages/NFD").
+#
+# If undefined, the source of a package will default to "branch:master".
+
+#PACKAGE_NDNCXX=branch:master
+#PACKAGE_NFD=branch:master
+#PACKAGE_NDNTOOLS=branch:master
+#PACKAGE_NDNTRAFFIC=branch:master
+#PACKAGE_REPONG=branch:master
diff --git a/run-vagrant-tests.sh b/run-vagrant-tests.sh
index 934360a..9681797 100755
--- a/run-vagrant-tests.sh
+++ b/run-vagrant-tests.sh
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/bin/bash
#
# Automated integration testing for the Named Data Networking Forwarding Daemon.
# Part of the Named Data Networking project <http://named-data.net>
#
# --
#
-# Copyright (c) 2014-2015, Regents of the University of California,
+# Copyright (c) 2014-2017, Regents of the University of California,
# Arizona Board of Regents,
# Colorado State University,
# University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,7 @@
# You should have received a copy of the GNU General Public License along with
# NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
#
-# Author: Eric Newberry <enewberry@email.arizona.edu>
+# Author: Eric Newberry <enewberry@cs.arizona.edu>
mkdir -p logs/A logs/B logs/C logs/D
mkdir -p temp
@@ -55,5 +55,5 @@
vagrant destroy -f
vagrant box remove nfd-integ
-rm -Rf temp
+rm -rf temp prepare
rm -f nfd-integ.box