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 switch". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 12 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_merge_branches merge1 merge2 $REPOS_URL |
---|
30 | export SVN_EDITOR="sed -i 1i\foo" |
---|
31 | cd $TEST_DIR/wc |
---|
32 | #------------------------------------------------------------------------------- |
---|
33 | # Tests fcm switch trunk |
---|
34 | svn switch -q $ROOT_URL/branches/dev/Share/merge1 |
---|
35 | TEST_KEY=$TEST_KEY_BASE-trunk |
---|
36 | run_pass "$TEST_KEY" fcm switch trunk <<<"y" |
---|
37 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
38 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
39 | switch: status of "$TEST_DIR/wc": |
---|
40 | ? unversioned_file |
---|
41 | switch: continue? |
---|
42 | Enter "y" or "n" (or just press <return> for "n"): |
---|
43 | D added_directory |
---|
44 | D added_file |
---|
45 | D module/tree_conflict_file |
---|
46 | U lib/python/info/__init__.py |
---|
47 | U lib/python/info/poems.py |
---|
48 | U module/hello_constants.f90 |
---|
49 | U module/hello_constants.inc |
---|
50 | U module/hello_constants_dummy.inc |
---|
51 | U subroutine/hello_sub_dummy.h |
---|
52 | Updated to revision 9. |
---|
53 | __OUT__ |
---|
54 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
55 | #------------------------------------------------------------------------------- |
---|
56 | # Tests fcm switch merge1 branch |
---|
57 | rm unversioned_file |
---|
58 | TEST_KEY=$TEST_KEY_BASE-branch-1 |
---|
59 | run_pass "$TEST_KEY" fcm switch branches/dev/Share/merge1 <<<'y' |
---|
60 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
61 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
62 | A added_directory |
---|
63 | A added_directory/hello_constants.f90 |
---|
64 | A added_directory/hello_constants.inc |
---|
65 | A added_directory/hello_constants_dummy.inc |
---|
66 | A added_file |
---|
67 | A module/tree_conflict_file |
---|
68 | U lib/python/info/__init__.py |
---|
69 | U lib/python/info/poems.py |
---|
70 | U module/hello_constants.f90 |
---|
71 | U module/hello_constants.inc |
---|
72 | U module/hello_constants_dummy.inc |
---|
73 | U subroutine/hello_sub_dummy.h |
---|
74 | Updated to revision 9. |
---|
75 | __OUT__ |
---|
76 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
77 | #------------------------------------------------------------------------------- |
---|
78 | # Tests fcm switch merge2 branch |
---|
79 | TEST_KEY=$TEST_KEY_BASE-branch-2 |
---|
80 | run_pass "$TEST_KEY" fcm switch --non-interactive dev/Share/merge2 |
---|
81 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
82 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
83 | U subroutine/hello_sub.h |
---|
84 | A renamed_added_file |
---|
85 | D added_directory |
---|
86 | D added_file |
---|
87 | D module/tree_conflict_file |
---|
88 | U lib/python/info/poems.py |
---|
89 | U module/hello_constants.f90 |
---|
90 | U module/hello_constants.inc |
---|
91 | U module/hello_constants_dummy.inc |
---|
92 | U subroutine/hello_sub_dummy.h |
---|
93 | Updated to revision 9. |
---|
94 | __OUT__ |
---|
95 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
96 | #------------------------------------------------------------------------------- |
---|
97 | # Tests fcm switch trunk, without .svn/entries |
---|
98 | TEST_KEY=$TEST_KEY_BASE-trunk-2 |
---|
99 | rm -f .svn/entries |
---|
100 | run_pass "$TEST_KEY" fcm switch trunk <<<'y' |
---|
101 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
102 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__' |
---|
103 | U subroutine/hello_sub.h |
---|
104 | D renamed_added_file |
---|
105 | U lib/python/info/__init__.py |
---|
106 | Updated to revision 9. |
---|
107 | __OUT__ |
---|
108 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
109 | #------------------------------------------------------------------------------- |
---|
110 | teardown |
---|
111 | exit |
---|