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 <loic@dachary.org>
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)
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# 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 <<EOF
+EOF
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# 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 "$@"