3 # Script to install the CTDB testsuite on a machine.
13 $0 --destdir=<DIR1> \\
14 --datarootdir=<DIR2> \\
24 temp
=$
(getopt
-n "$prog" -o "h" -l help,destdir
:,datarootdir
:,libdir
:,bindir
:,etcdir
: -- "$@")
38 --destdir) destdir
="$2" ; shift 2 ;;
39 --datarootdir) datarootdir
="$2" ; shift 2 ;;
40 --libdir) libdir
="$2" ; shift 2 ;;
41 --bindir) bindir
="$2" ; shift 2 ;;
42 --etcdir) etcdir
="$2" ; shift 2 ;;
44 -h|
--help|
*) usage
;; # Shouldn't happen, so this is reasonable.
50 [ -n "$destdir" ] || usage
"No option --destdir specified"
51 [ -n "$datarootdir" ] || usage
"No option --datarootdir specified"
52 [ -n "$libdir" ] || usage
"No option --libdir specified"
53 [ -n "$bindir" ] || usage
"No option --bindir specified"
54 [ -n "$etcdir" ] || usage
"No option --etcdir specified"
60 if [ "$destdir" = "/" ] ; then
64 data_subdirs
="complex events.d eventscripts onnode scripts simple takeover tool"
66 ctdb_datadir
="${destdir}${datarootdir}/ctdb-tests"
67 echo "Installing test data files into ${ctdb_datadir}..."
68 for d
in $data_subdirs ; do
69 mkdir
-p "${ctdb_datadir}/${d}"
70 cp -pr "tests/${d}" "${ctdb_datadir}"
72 # Some of the unit tests have relative symlinks back to in-tree bits
73 # and pieces. These links will be broken!
74 for i
in "events.d" "functions" "nfs-rpc-checks.d" ; do
75 ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
77 # test_wrap needs to set TEST_BIN_DIR
78 sed -i -e "s@^TEST_SCRIPTS_DIR=.*@&\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "${ctdb_datadir}/scripts/test_wrap"
80 ctdb_libdir
="${destdir}${libdir}/ctdb-tests"
81 mkdir
-p "${destdir}${libdir}"
82 echo "Installing test binary files into ${ctdb_libdir}..."
83 cp -pr "tests/bin/" "${ctdb_libdir}"
85 ctdb_bindir
="${destdir}${bindir}"
86 echo "Installing wrapper scripts into ${ctdb_bindir}..."
87 mkdir
-p "${ctdb_bindir}"
88 out
="${ctdb_bindir}/ctdb_run_tests"
89 sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "tests/run_tests.sh" >"$out"
91 ln -s "ctdb_run_tests" "${ctdb_bindir}/ctdb_run_cluster_tests"