[Kimchi-devel] [PATCH][Wok 06/11] FVT: Install all the dependencies from requirements.txt and runs FVT testcases

archus at linux.vnet.ibm.com archus at linux.vnet.ibm.com
Wed May 25 11:14:13 UTC 2016


From: Archana Singh <archus at linux.vnet.ibm.com>

Script to run FVT test cases which also take care of installing all
dependencies from requirements.txt.

Signed-off-by: Archana Singh <archus at linux.vnet.ibm.com>
---
 tests/fvt/run_tests.sh.in | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100755 tests/fvt/run_tests.sh.in

diff --git a/tests/fvt/run_tests.sh.in b/tests/fvt/run_tests.sh.in
new file mode 100755
index 0000000..7f8046d
--- /dev/null
+++ b/tests/fvt/run_tests.sh.in
@@ -0,0 +1,92 @@
+#!/bin/bash
+#
+# Project Wok
+#
+# Copyright IBM, Corp. 2016
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301USA
+
+mkdir -p venv
+
+HAVE_UNITTEST=@HAVE_PYMOD_UNITTEST@
+PYTHON_VER=@PYTHON_VERSION@
+
+# Verify if the required commands exists on the system
+command -v virtualenv >/dev/null 2>&1 || { echo >&2 "virtualenv must be installed for your distribution.  Aborting."; exit 1; }
+command -v pip >/dev/null 2>&1 || { echo >&2 "pip must be installed for your distribution.  Aborting."; exit 1; }
+
+# Get absolute path of this script
+pushd `dirname $0` > /dev/null
+SCRIPTPATH=`pwd -P`
+reqfile=$SCRIPTPATH'/requirements.txt'
+
+# Start the virtual environment
+virtualenv venv --no-site-packages
+
+
+# Actiate the virtual environment
+source venv/bin/activate
+
+while read line; do
+
+  case "$line" in
+    \#*)
+    continue ;; # skip comments
+    "")
+    continue ;; # skip empty lines
+    *)
+    venv/bin/python$PYTHON_VER -c "import $line" > /dev/null 2>&1
+    status=$?
+    if [ $status -ne 0 ]; then
+        pip install -r $reqfile # Install the required modules to run tests
+        break
+    fi
+  esac
+done < $reqfile
+
+# Execute the test suite
+#python registered_tests.py
+#nosetests --with-html --html-file=test_report.html registered_tests.py
+
+if [ "$1" = "-v" ]; then
+    OPTS="-v"
+    shift
+else
+    OPTS=""
+fi
+
+if [ $# -ne 0 ]; then
+    ARGS="$@"
+else
+    ARGS=`find -name "fvt_*.py" | xargs -I @ basename @ .py`
+fi
+
+if [ "$HAVE_UNITTEST" != "yes" -o "$PYTHON_VER" == "2.6" ]; then
+    CMD="unit2"
+else
+    CMD="python -m unittest"
+fi
+
+LIST=($ARGS)
+FVT_LIST=()
+for ((i=0;i<${#LIST[@]};i++)); do
+    FVT_LIST+=(${LIST[$i]})
+done
+PYTHONPATH=../ $CMD $OPTS ${FVT_LIST[@]}
+
+# Deativate the virtual environment
+deactivate
+
+rm -fr venv
-- 
2.5.0




More information about the Kimchi-devel mailing list