From: Loic Dachary Date: Mon, 16 Dec 2013 16:13:27 +0000 (+0100) Subject: qa: vstart wrapper helper for unittests X-Git-Tag: v0.75~88^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c1eb55c6b0343a2a9655e337be52be20e9414ff9;p=ceph.git qa: vstart wrapper helper for unittests Primarily useful to run scripts from qa/workunits as part of make check. vstart_wrapper.sh starts a vstart.sh cluster, runs the command given in argument and tearsdown cluster when it completes. The vstart_wrapped_tests.sh script contains the list of scripts that need the vstart_wrapper.sh to run. It would not be necessary if automake allowed passing argument to tests scripts. It also adds markers to the output to facilitate searching the output because it can be very verbose. This wrapper is kept simple and will probably evolve into something more sophisticated depending on the scripts being added to vstart_wrapper_tests.sh. There are numerous options, ranging from parsing the yaml from ceph-qa-suite to figure out the configuration cluster to converting the same yaml into a puppet manifest that is applied locally or even driving OpenStack instances to avoid messing with the local machine. But this would probably be overkill at this point. Signed-off-by: Loic Dachary --- diff --git a/src/test/Makefile.am b/src/test/Makefile.am index e543fd759cc1..3cd531ef6742 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -234,7 +234,8 @@ bin_DEBUGPROGRAMS += ceph_bench_log check_SCRIPTS += \ unittest_bufferlist.sh \ - test/encoding/check-generated.sh + test/encoding/check-generated.sh \ + test/vstart_wrapped_tests.sh # target to build but not run the unit tests unittests:: $(check_PROGRAMS) diff --git a/src/test/vstart_wrapped_tests.sh b/src/test/vstart_wrapped_tests.sh new file mode 100755 index 000000000000..02f582e054b4 --- /dev/null +++ b/src/test/vstart_wrapped_tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright (C) 2013 Cloudwatt +# +# Author: Loic Dachary +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program 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 Library Public License for more details. +# +echo "Run unit tests that need a cluster, using vstart.sh" +while read line ; do + echo "================ START ================" + echo "$line" + echo "=======================================" + test/vstart_wrapper.sh $line + echo "================ STOP =================" +done < +# +# Author: Loic Dachary +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program 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 Library Public License for more details. +# +function vstart_teardown() +{ + ./stop.sh +} + +function vstart_setup() +{ + rm -fr dev out + mkdir -p dev + trap "vstart_teardown ; rm -f $TMPFILE" EXIT + export LC_ALL=C # some tests are vulnerable to i18n + MON=1 OSD=3 ./vstart.sh -n -X -l mon osd + export PATH=.:$PATH + export CEPH_CONF=ceph.conf +} + +function main() +{ + if [[ $(pwd) =~ /src$ ]] && [ -d .libs ] && [ -d pybind ] ; then + vstart_setup + else + trap "rm -f $TMPFILE" EXIT + fi + + "$@" +} + +main "$@"