summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/INSTALL
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-04-24 16:28:15 +1000
committerMartin Schwenke <martin@meltin.net>2012-04-27 15:42:42 +1000
commitdc2dfbdb93eadd4e3112af9cdd33b43042f7ec20 (patch)
tree0c80df19b6e588a9ccd26f63013951e18ea6d6a8 /ctdb/tests/INSTALL
parent46f82181d06db78aba101ad4f19beb7ca9d84005 (diff)
downloadsamba-dc2dfbdb93eadd4e3112af9cdd33b43042f7ec20.tar.gz
samba-dc2dfbdb93eadd4e3112af9cdd33b43042f7ec20.tar.xz
samba-dc2dfbdb93eadd4e3112af9cdd33b43042f7ec20.zip
tests: Add installation script for tests
This could all be done in Makefile.in, but that would be very complex. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 12c9986059cacda819e669fa77d613b408c62599)
Diffstat (limited to 'ctdb/tests/INSTALL')
-rwxr-xr-xctdb/tests/INSTALL91
1 files changed, 91 insertions, 0 deletions
diff --git a/ctdb/tests/INSTALL b/ctdb/tests/INSTALL
new file mode 100755
index 0000000000..6f43650cce
--- /dev/null
+++ b/ctdb/tests/INSTALL
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+# Script to install the CTDB testsuite on a machine.
+
+usage ()
+{
+ if [ -n "$1" ] ; then
+ echo "$1"
+ echo
+ fi
+
+ cat <<EOF
+ $0 --destdir=<DIR1> \\
+ --datarootdir=<DIR2> \\
+ --libdir=<DIR3> \\
+ --bindir=<DIR4> \\
+ --etcdir=<DIR5>
+EOF
+ exit 1
+}
+
+parse_options ()
+{
+ temp=$(getopt -n "$prog" -o "h" -l help,destdir:,datarootdir:,libdir:,bindir:,etcdir: -- "$@")
+
+ [ $? != 0 ] && usage
+
+ eval set -- "$temp"
+
+ destdir=""
+ datarootdir=""
+ libdir=""
+ bindir=""
+ etcdir=""
+
+ while true ; do
+ case "$1" in
+ --destdir) destdir="$2" ; shift 2 ;;
+ --datarootdir) datarootdir="$2" ; shift 2 ;;
+ --libdir) libdir="$2" ; shift 2 ;;
+ --bindir) bindir="$2" ; shift 2 ;;
+ --etcdir) etcdir="$2" ; shift 2 ;;
+ --) shift ; break ;;
+ -h|--help|*) usage ;; # Shouldn't happen, so this is reasonable.
+ esac
+ done
+
+ [ $# -gt 0 ] && usage
+
+ [ -n "$destdir" ] || usage "No option --destdir specified"
+ [ -n "$datarootdir" ] || usage "No option --datarootdir specified"
+ [ -n "$libdir" ] || usage "No option --libdir specified"
+ [ -n "$bindir" ] || usage "No option --bindir specified"
+ [ -n "$etcdir" ] || usage "No option --etcdir specified"
+}
+
+parse_options "$@"
+
+# Make things neater!
+if [ "$destdir" = "/" ] ; then
+ destdir=""
+fi
+
+data_subdirs="complex events.d eventscripts onnode scripts simple takeover tool"
+
+ctdb_datadir="${destdir}${datarootdir}/ctdb-tests"
+echo "Installing test data files into ${ctdb_datadir}..."
+for d in $data_subdirs ; do
+ mkdir -p "${ctdb_datadir}/${d}"
+ cp -pr "tests/${d}" "${ctdb_datadir}"
+done
+# Some of the unit tests have relative symlinks back to in-tree bits
+# and pieces. These links will be broken!
+for i in "events.d" "functions" ; do
+ ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
+done
+
+ctdb_libdir="${destdir}${libdir}/ctdb-tests"
+mkdir -p "${destdir}${libdir}"
+echo "Installing test binary files into ${ctdb_libdir}..."
+cp -pr "tests/bin/" "${ctdb_libdir}"
+
+ctdb_bindir="${destdir}${bindir}"
+echo "Installing wrapper scripts into ${ctdb_bindir}..."
+mkdir -p "${ctdb_bindir}"
+for i in tests/run_tests.sh tests/run_cluster_tests.sh ; do
+ b=$(basename "$i" ".sh")
+ out="${ctdb_bindir}/ctdb_${b}"
+ sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "$i" >"${out}"
+ chmod 755 "$out"
+done