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 update". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 7 |
---|
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 update -r PREV |
---|
34 | svn switch -q $ROOT_URL/branches/dev/Share/merge1 |
---|
35 | TEST_KEY=$TEST_KEY_BASE-r-PREV |
---|
36 | cd module |
---|
37 | run_pass "$TEST_KEY" fcm update -r PREV <<__IN__ |
---|
38 | y |
---|
39 | __IN__ |
---|
40 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
41 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
42 | update: status of "$TEST_DIR/wc": |
---|
43 | ? $TEST_DIR/wc/unversioned_file |
---|
44 | update: continue? |
---|
45 | Enter "y" or "n" (or just press <return> for "n"): |
---|
46 | Updating '$TEST_DIR/wc': |
---|
47 | D $TEST_DIR/wc/added_directory |
---|
48 | D $TEST_DIR/wc/added_file |
---|
49 | D tree_conflict_file |
---|
50 | U $TEST_DIR/wc/lib/python/info/poems.py |
---|
51 | U $TEST_DIR/wc/subroutine/hello_sub_dummy.h |
---|
52 | U hello_constants.f90 |
---|
53 | U hello_constants.inc |
---|
54 | U hello_constants_dummy.inc |
---|
55 | Updated to revision 4. |
---|
56 | __OUT__ |
---|
57 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
58 | #------------------------------------------------------------------------------- |
---|
59 | # Tests fcm update |
---|
60 | rm ../unversioned_file |
---|
61 | TEST_KEY=$TEST_KEY_BASE-normal |
---|
62 | run_pass "$TEST_KEY" fcm update <<__IN__ |
---|
63 | y |
---|
64 | __IN__ |
---|
65 | sed -n "/^ *\*/p" "$TEST_DIR/$TEST_KEY.out" | sort -k 3 -o \ |
---|
66 | "$TEST_DIR/$TEST_KEY.update-status.sorted.out" |
---|
67 | file_cmp "$TEST_KEY.update-status.sorted.out" \ |
---|
68 | "$TEST_KEY.update-status.sorted.out" <<__OUT__ |
---|
69 | * $TEST_DIR/wc/added_directory |
---|
70 | * $TEST_DIR/wc/added_directory/hello_constants.f90 |
---|
71 | * $TEST_DIR/wc/added_directory/hello_constants.inc |
---|
72 | * $TEST_DIR/wc/added_directory/hello_constants_dummy.inc |
---|
73 | * $TEST_DIR/wc/added_file |
---|
74 | * $TEST_DIR/wc/module/tree_conflict_file |
---|
75 | * 4 $TEST_DIR/wc |
---|
76 | * 4 $TEST_DIR/wc/lib/python/info/poems.py |
---|
77 | * 4 $TEST_DIR/wc/module |
---|
78 | * 4 $TEST_DIR/wc/module/hello_constants.f90 |
---|
79 | * 4 $TEST_DIR/wc/module/hello_constants.inc |
---|
80 | * 4 $TEST_DIR/wc/module/hello_constants_dummy.inc |
---|
81 | * 4 $TEST_DIR/wc/subroutine/hello_sub_dummy.h |
---|
82 | __OUT__ |
---|
83 | sed -i "/^ *\*/d" "$TEST_DIR/$TEST_KEY.out" |
---|
84 | merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
85 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__ |
---|
86 | update: status of "$TEST_DIR/wc": |
---|
87 | update: continue? |
---|
88 | Enter "y" or "n" (or just press <return> for "n"): |
---|
89 | Updating '$TEST_DIR/wc': |
---|
90 | A $TEST_DIR/wc/added_directory |
---|
91 | A $TEST_DIR/wc/added_directory/hello_constants.f90 |
---|
92 | A $TEST_DIR/wc/added_directory/hello_constants.inc |
---|
93 | A $TEST_DIR/wc/added_directory/hello_constants_dummy.inc |
---|
94 | A $TEST_DIR/wc/added_file |
---|
95 | A tree_conflict_file |
---|
96 | U $TEST_DIR/wc/lib/python/info/poems.py |
---|
97 | U $TEST_DIR/wc/subroutine/hello_sub_dummy.h |
---|
98 | U hello_constants.f90 |
---|
99 | U hello_constants.inc |
---|
100 | U hello_constants_dummy.inc |
---|
101 | Updated to revision 9. |
---|
102 | __OUT__ |
---|
103 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
104 | teardown |
---|
105 | #------------------------------------------------------------------------------- |
---|