commit 86339ea57a51d075416946e5a42187b39a16ab26
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Jan 16 14:05:59 2015 +0100
rename run-git-test, add rsync option, change -g option
This commit renames the bash script that runs lnst regression tests to
run-test.sh. The reason behind this is that the tests don't really have
anything in common with git.
This commit also adds the argument -s which makes the script use rsync
to download lnst from a specified URL instead of using git clone on that
url.
When using the script to run all tests, before execution they will be
numerically sorted so that we keep the ordering in which they were
added.
Finally I changed the -g option (for git url) to -u (for url) since it
makes more sense like this.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
regression-tests/{run-git-test.sh => run-test.sh} | 62 +++++++++++++--------
1 files changed, 38 insertions(+), 24 deletions(-)
---
diff --git a/regression-tests/run-git-test.sh b/regression-tests/run-test.sh
similarity index 81%
rename from regression-tests/run-git-test.sh
rename to regression-tests/run-test.sh
index ef84a2e..1c9c657 100755
--- a/regression-tests/run-git-test.sh
+++ b/regression-tests/run-test.sh
@@ -41,23 +41,27 @@ function print_separator
function usage
{
- echo "Usage: $0 [-r revision] [-l logdir] [-t list_of_tests] [-g url]
[-n]"
+ echo "Usage: $0 [-r revision] [-l logdir] [-t list_of_tests] [-u url]
[-n]"
echo " -r revision Test a specific git branch/rev/tag"
+ echo " Note: ignored when -s is used"
echo " -l logdir Save test results to a directory"
echo " -t list_of_tests Run only these tests"
echo " Example: -t 0,1,2 will run tests 0, 1, and 2"
echo " -n Disable use of NetworkManager on
slavemachines"
echo " Note: enabled by default"
- echo " -g url URL pointing to LNST git repository that should be
cloned"
+ echo " -u url URL pointing to LNST repository that should be
used"
+ echo " Note: git clone and checkout by default"
+ echo " -s use rsync instead of git"
exit 0
}
# ---
#default repository url
-git_url="../"
+url="../"
+use_git=true
-while getopts "hlr:t:g:n" OPTION
+while getopts "hlr:t:g:ns" OPTION
do
case $OPTION in
h) usage ;;
@@ -67,7 +71,8 @@ do
r) rev="$OPTARG";;
t) tests="`tr "," " "
<<<"$OPTARG"`" ;;
n) nm_off="yes";;
- g) git_url="$OPTARG";;
+ g) url="$OPTARG";;
+ s) use_git=false;;
\?) exit 1;;
esac
done
@@ -89,17 +94,23 @@ echo "$$" >.lock
# Clone the repo
repo=`mktemp -d`
-git clone $git_url $repo
-
-# Checkout the appropriate revision/tag
-if [ ! -z "$rev" ]; then
- pushd . >/dev/null
- cd $repo
- git checkout "$rev"
- popd >/dev/null
+if $use_git ; then
+ git clone $url $repo
else
- log "Revision not specified, using HEAD."
- rev="HEAD"
+ rsync -r $url $repo
+fi
+
+if $use_git ; then
+ # Checkout the appropriate revision/tag
+ if [ ! -z "$rev" ]; then
+ pushd . >/dev/null
+ cd $repo
+ git checkout "$rev"
+ popd >/dev/null
+ else
+ log "Revision not specified, using HEAD."
+ rev="HEAD"
+ fi
fi
# Load the proper config
@@ -150,7 +161,7 @@ print_separator
# In case the list of test names to run was omitted, run all of them
if [ -z "$tests" ]; then
- tests="`ls -1 tests/ | grep -v '\.sh$'`"
+ tests="`command ls -1 tests/ | grep -v '\.sh$' | sort -n`"
fi
for test_name in $tests; do
@@ -208,14 +219,17 @@ print_separator
sleep 1
# Cleanup
-while read line; do
- hostname=`awk '{print $1}' <<<"$line"`
- pid=`awk '{print $2}' <<<"$line"`
- remote_repo=`awk '{print $3}' <<<"$line"`
-
- kill $pid
- ssh -n "root@$hostname" "rm -r $remote_repo"
-done <<< "$slave_status"
+if [ $slave_status ]; then
+ while read line; do
+ hostname=`awk '{print $1}' <<<"$line"`
+ pid=`awk '{print $2}' <<<"$line"`
+ remote_repo=`awk '{print $3}' <<<"$line"`
+
+ echo "kill $pid"
+ kill $pid
+ ssh -n "root@$hostname" "rm -r $remote_repo"
+ done <<< "$slave_status"
+fi
rm -rf $repo
Show replies by date