1 | #!/bin/bash |
---|
2 | #------------------------------------------------------------------------------- |
---|
3 | # (C) British Crown Copyright 2006-17 Met Office. |
---|
4 | # |
---|
5 | # This file is part of FCM, tools for managing and building source code. |
---|
6 | # |
---|
7 | # FCM is free software: you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation, either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # FCM is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | #------------------------------------------------------------------------------- |
---|
20 | # Test "fcm-install-svn-hook", "hooks-env" installation. |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | . $TEST_SOURCE_DIR/test_header_more |
---|
24 | #------------------------------------------------------------------------------- |
---|
25 | if ! which svnadmin 1>/dev/null 2>/dev/null; then |
---|
26 | skip_all 'svnadmin not available' |
---|
27 | fi |
---|
28 | tests 2 |
---|
29 | FCM_REAL_HOME=$(readlink -f "$FCM_HOME") |
---|
30 | mkdir conf svn-repos |
---|
31 | export FCM_CONF_PATH="$PWD/conf" |
---|
32 | cat >conf/admin.cfg <<__CONF__ |
---|
33 | admin_email=robert.fitzroy@metoffice.gov.uk |
---|
34 | notification_from=notifications@localhost |
---|
35 | svn_dump_dir=$PWD/svn/dumps |
---|
36 | svn_group= |
---|
37 | svn_hook_path_env=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
---|
38 | svn_live_dir=$PWD/svn-repos |
---|
39 | svn_project_suffix=.svn |
---|
40 | trac_live_dir=$PWD/trac |
---|
41 | __CONF__ |
---|
42 | svnadmin create svn-repos/foo.svn |
---|
43 | cat >hooks-env <<__CONF__ |
---|
44 | [default] |
---|
45 | FCM_HOME=$FCM_REAL_HOME |
---|
46 | FCM_SVN_HOOK_ADMIN_EMAIL=robert.fitzroy@metoffice.gov.uk |
---|
47 | FCM_SVN_HOOK_COMMIT_DUMP_DIR=$PWD/svn/dumps |
---|
48 | FCM_SVN_HOOK_NOTIFICATION_FROM=notifications@localhost |
---|
49 | FCM_SVN_HOOK_REPOS_SUFFIX=.svn |
---|
50 | FCM_SVN_HOOK_TRAC_ROOT_DIR=$PWD/trac |
---|
51 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
---|
52 | TZ=UTC |
---|
53 | __CONF__ |
---|
54 | #------------------------------------------------------------------------------- |
---|
55 | TEST_KEY="$TEST_KEY_BASE" |
---|
56 | run_pass "$TEST_KEY" "$FCM_HOME/sbin/fcm-install-svn-hook" |
---|
57 | file_cmp "$TEST_KEY.foo.hooks-env" svn-repos/foo.svn/conf/hooks-env hooks-env |
---|
58 | #------------------------------------------------------------------------------- |
---|
59 | exit |
---|