6 # Script to install the CTDB testsuite on a machine.
16 $0 --destdir=<DIR1> \\
17 --datarootdir=<DIR2> \\
27 temp
=$
(getopt
-n "$prog" -o "h" -l help,destdir
:,datarootdir
:,libdir
:,bindir
:,etcdir
: -- "$@")
41 --destdir) destdir
="$2" ; shift 2 ;;
42 --datarootdir) datarootdir
="$2" ; shift 2 ;;
43 --libdir) libdir
="$2" ; shift 2 ;;
44 --bindir) bindir
="$2" ; shift 2 ;;
45 --etcdir) etcdir
="$2" ; shift 2 ;;
47 -h|
--help|
*) usage
;; # Shouldn't happen, so this is reasonable.
53 [ -n "$destdir" ] || usage
"No option --destdir specified"
54 [ -n "$datarootdir" ] || usage
"No option --datarootdir specified"
55 [ -n "$libdir" ] || usage
"No option --libdir specified"
56 [ -n "$bindir" ] || usage
"No option --bindir specified"
57 [ -n "$etcdir" ] || usage
"No option --etcdir specified"
63 if [ "$destdir" = "/" ] ; then
67 data_subdirs
="complex events.d eventscripts onnode scripts simple takeover tool"
69 ctdb_datadir
="${destdir}${datarootdir}/ctdb-tests"
70 echo "Installing test data files into ${ctdb_datadir}..."
71 for d
in $data_subdirs ; do
72 mkdir
-p "${ctdb_datadir}/${d}"
73 cp -pr "tests/${d}" "${ctdb_datadir}"
75 # Some of the unit tests have relative symlinks back to in-tree bits
76 # and pieces. These links will be broken!
77 link_dir
="${ctdb_datadir}/eventscripts/etc-ctdb/"
78 broken_links
=$
(find "$link_dir" -type l |
sed -e "s@^${link_dir}@@")
79 for i
in $broken_links ; do
80 ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
82 # test_wrap needs to set TEST_BIN_DIR
83 sed -i -e "s@^TEST_SCRIPTS_DIR=.*@&\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "${ctdb_datadir}/scripts/test_wrap"
85 ctdb_libdir
="${destdir}${libdir}/ctdb-tests"
86 mkdir
-p "${destdir}${libdir}"
87 echo "Installing test binary files into ${ctdb_libdir}..."
88 cp -pr "tests/bin/" "${ctdb_libdir}"
90 ctdb_bindir
="${destdir}${bindir}"
91 echo "Installing wrapper scripts into ${ctdb_bindir}..."
92 mkdir
-p "${ctdb_bindir}"
93 out
="${ctdb_bindir}/ctdb_run_tests"
94 sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" -e 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\1=true@' "tests/run_tests.sh" >"$out"
96 ln -s "ctdb_run_tests" "${ctdb_bindir}/ctdb_run_cluster_tests"