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 | # Basic tests for "fcm commit". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 3 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_branch sibling_branch_test $REPOS_URL |
---|
30 | init_branch_wc branch_test $REPOS_URL |
---|
31 | cd $TEST_DIR/wc |
---|
32 | FILE_LIST="./lib/python/info/__init__.py |
---|
33 | ./lib/python/info/poems.py |
---|
34 | ./module/hello_constants.f90 |
---|
35 | ./module/hello_constants.inc |
---|
36 | ./module/hello_constants_dummy.inc |
---|
37 | " |
---|
38 | for FILE in $FILE_LIST; do |
---|
39 | sed -i "s/for/FOR/g; s/fi/end if/g; s/in/IN/g;" $FILE |
---|
40 | sed -i "/#/d; /^ *!/d" $FILE |
---|
41 | sed -i "s/!/!!/g; s/q/\nq/g; s/[(]/(\n/g" $FILE |
---|
42 | done |
---|
43 | FILE_DIR=$(dirname $FILE) |
---|
44 | svn copy -q $FILE added_file |
---|
45 | svn copy -q $FILE_DIR added_directory |
---|
46 | svn delete --force -q $FILE_DIR |
---|
47 | #------------------------------------------------------------------------------- |
---|
48 | # Tests fcm commit |
---|
49 | TEST_KEY=$TEST_KEY_BASE |
---|
50 | export SVN_EDITOR="sed -i 1i\foo" |
---|
51 | cd program |
---|
52 | run_pass "$TEST_KEY" fcm commit --svn-non-interactive <<__IN__ |
---|
53 | y |
---|
54 | __IN__ |
---|
55 | commit_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
56 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
57 | $TEST_DIR/wc: working directory changed to top of working copy. |
---|
58 | [info] sed -i 1i\foo: starting commit message editor... |
---|
59 | Change summary: |
---|
60 | -------------------------------------------------------------------------------- |
---|
61 | [Root : $REPOS_URL] |
---|
62 | [Project: ${TEST_PROJECT:-}] |
---|
63 | [Branch : branches/dev/Share/branch_test] |
---|
64 | [Sub-dir: ] |
---|
65 | A + added_directory |
---|
66 | A + added_file |
---|
67 | D module |
---|
68 | D module/hello_constants.f90 |
---|
69 | D module/hello_constants.inc |
---|
70 | D module/hello_constants_dummy.inc |
---|
71 | M lib/python/info/poems.py |
---|
72 | M + added_directory/hello_constants.f90 |
---|
73 | M + added_directory/hello_constants.inc |
---|
74 | M + added_directory/hello_constants_dummy.inc |
---|
75 | -------------------------------------------------------------------------------- |
---|
76 | Commit message is as follows: |
---|
77 | -------------------------------------------------------------------------------- |
---|
78 | foo |
---|
79 | -------------------------------------------------------------------------------- |
---|
80 | *** WARNING: YOU ARE COMMITTING TO A Share BRANCH. |
---|
81 | *** Please ensure that you have the owner's permission. |
---|
82 | Would you like to commit this change? |
---|
83 | Enter "y" or "n" (or just press <return> for "n"): Adding added_directory |
---|
84 | Adding added_file |
---|
85 | Deleting module |
---|
86 | Sending added_directory/hello_constants.f90 |
---|
87 | Sending added_directory/hello_constants.inc |
---|
88 | Sending added_directory/hello_constants_dummy.inc |
---|
89 | Sending lib/python/info/poems.py |
---|
90 | Committed revision 6. |
---|
91 | Updating '.': |
---|
92 | At revision 6. |
---|
93 | __OUT__ |
---|
94 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
95 | teardown |
---|
96 | #------------------------------------------------------------------------------- |
---|