From 2a679a36deac7bc9bfdeda8b6472ebaf113bbe19 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Tue, 1 Aug 2017 16:04:10 -0700 Subject: [PATCH] qa: Add support for specifying sub-tests with run-standalone.sh Fix test-ceph-helpers.sh to pass additional arguments on Signed-off-by: David Zafman --- qa/run-standalone.sh | 15 +++++++++++---- qa/standalone/README | 5 +++++ qa/standalone/misc/test-ceph-helpers.sh | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/qa/run-standalone.sh b/qa/run-standalone.sh index 82c93c56632f4..a30200993b4f2 100755 --- a/qa/run-standalone.sh +++ b/qa/run-standalone.sh @@ -40,6 +40,7 @@ location="../qa/standalone" count=0 errors=0 +userargs="" for f in $(cd $location ; find . -perm $exec_mode -type f) do f=$(echo $f | sed 's/\.\///') @@ -51,11 +52,16 @@ do found=false for c in "${!select[@]}" do - if [[ "${select[$c]}" = $(basename $f) ]]; then + # Get command and any arguments of subset of tests ro tun + allargs="${select[$c]}" + arg1=$(echo "$allargs" | cut --delimiter " " --field 1) + # Get user args for this selection for use below + userargs="$(echo $allargs | cut -s --delimiter " " --field 2-)" + if [[ "$arg1" = $(basename $f) ]]; then found=true break fi - if [[ "${select[$c]}" = "$f" ]]; then + if [[ "$arg1" = "$f" ]]; then found=true break fi @@ -69,13 +75,14 @@ do continue fi + cmd="$location/$f $userargs" count=$(expr $count + 1) - echo "--- $f ---" + echo "--- $cmd ---" if [[ "$dryrun" != "true" ]]; then if ! PATH=$PATH:bin \ CEPH_ROOT=.. \ CEPH_LIB=lib \ - $location/$f ; then + $cmd ; then echo "$f .............. FAILED" errors=$(expr $errors + 1) fi diff --git a/qa/standalone/README b/qa/standalone/README index 8ec202639bdbd..3082442cba326 100644 --- a/qa/standalone/README +++ b/qa/standalone/README @@ -16,3 +16,8 @@ You can run them in a git checkout + build directory as well: qa/standalone as arguments to qa/run-standalone.sh. ../qa/run-standalone.sh misc.sh osd/osd-dup.sh + + * Add support for specifying arguments to selected tests by simply adding + list of tests to each argument. + +../qa/run-standalone.sh "test-ceph-helpers.sh test_get_last_scrub_stamp" diff --git a/qa/standalone/misc/test-ceph-helpers.sh b/qa/standalone/misc/test-ceph-helpers.sh index 3a6788ecaa364..932fcf3fa324f 100755 --- a/qa/standalone/misc/test-ceph-helpers.sh +++ b/qa/standalone/misc/test-ceph-helpers.sh @@ -18,4 +18,4 @@ # GNU Library Public License for more details. # -$CEPH_ROOT/qa/standalone/ceph-helpers.sh TESTS +$CEPH_ROOT/qa/standalone/ceph-helpers.sh TESTS "$@" -- 2.39.5