New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
00-simple.t in vendors/t/fcm-merge – NEMO

source: vendors/t/fcm-merge/00-simple.t @ 10669

Last change on this file since 10669 was 10669, checked in by nicolasmartin, 5 years ago

Import latest FCM release from Github into the repository for testing

File size: 10.5 KB
Line 
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 merge".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23#-------------------------------------------------------------------------------
24check_svn_version
25tests 42
26#-------------------------------------------------------------------------------
27setup
28init_repos
29init_merge_branches merge1 merge2 $REPOS_URL
30cd $TEST_DIR/wc
31#-------------------------------------------------------------------------------
32# Test the various mergeinfo output before merging.
33test_mergeinfo "$TEST_KEY_BASE-pre" \
34    $ROOT_URL/branches/dev/Share/merge1 - 9 <<__RESULTS__
35begin-prop
36end-prop
37begin-info
38    youngest common ancestor
39    |         last full merge
40    |         |        tip of branch
41    |         |        |         repository path
42
43    1                  9       
44    |                  |       
45       --| |------------         branches/dev/Share/merge1
46      /                       
47     /                         
48  -------| |------------         trunk
49                       |       
50                       WC     
51end-info
52begin-eligible
53r5
54end-eligible
55begin-merged
56end-merged
57__RESULTS__
58#-------------------------------------------------------------------------------
59# Tests fcm merge --dry-run
60TEST_KEY=$TEST_KEY_BASE-dry-run
61export SVN_EDITOR="sed -i 1i\foo"
62run_pass "$TEST_KEY" fcm merge --dry-run $ROOT_URL/branches/dev/Share/merge1
63merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
64file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__
65Eligible merge(s) from /${PROJECT}branches/dev/Share/merge1@9: 5
66--------------------------------------------------------------------------------
67Merge: /${PROJECT}branches/dev/Share/merge1@5
68 c.f.: /${PROJECT}trunk@1
69-------------------------------------------------------------------------dry-run
70--- Merging r4 through r5 into '.':
71A    added_directory
72A    added_directory/hello_constants.f90
73A    added_directory/hello_constants.inc
74A    added_directory/hello_constants_dummy.inc
75A    added_file
76A    module/tree_conflict_file
77U    lib/python/info/poems.py
78U    module/hello_constants.f90
79U    module/hello_constants.inc
80U    module/hello_constants_dummy.inc
81U    subroutine/hello_sub_dummy.h
82-------------------------------------------------------------------------dry-run
83__OUT__
84file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
85#-------------------------------------------------------------------------------
86# Tests svn status result of fcm merge --dry-run
87TEST_KEY=$TEST_KEY_BASE-dry-run-status
88run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
89file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
90?       unversioned_file
91__OUT__
92file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
93#-------------------------------------------------------------------------------
94# Tests svn diff result of fcm merge --dry-run
95TEST_KEY=$TEST_KEY_BASE-dry-run-diff
96run_pass "$TEST_KEY" svn diff
97file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
98__OUT__
99file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
100#-------------------------------------------------------------------------------
101# Tests fcm merge --non-interactive
102TEST_KEY=$TEST_KEY_BASE-non-interactive
103export SVN_EDITOR="sed -i 1i\foo"
104run_pass "$TEST_KEY" fcm merge --non-interactive $ROOT_URL/branches/dev/Share/merge1
105merge_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
106file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__
107Eligible merge(s) from /${PROJECT}branches/dev/Share/merge1@9: 5
108--------------------------------------------------------------------------------
109Merge: /${PROJECT}branches/dev/Share/merge1@5
110 c.f.: /${PROJECT}trunk@1
111Merge succeeded.
112--------------------------------------------------------------------------actual
113--- Merging r4 through r5 into '.':
114A    added_directory
115A    added_directory/hello_constants.f90
116A    added_directory/hello_constants.inc
117A    added_directory/hello_constants_dummy.inc
118A    added_file
119A    module/tree_conflict_file
120U    lib/python/info/poems.py
121U    module/hello_constants.f90
122U    module/hello_constants.inc
123U    module/hello_constants_dummy.inc
124U    subroutine/hello_sub_dummy.h
125--- Recording mergeinfo for merge of r4 through r5 into '.':
126 U   .
127--------------------------------------------------------------------------actual
128__OUT__
129file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
130#-------------------------------------------------------------------------------
131# Tests svn status result of fcm merge --non-interactive
132TEST_KEY=$TEST_KEY_BASE-non-interactive-status
133run_pass "$TEST_KEY" svn status --config-dir=$TEST_DIR/.subversion/
134status_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
135file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__
136 M      .
137?       unversioned_file
138A  +    added_directory
139A  +    added_file
140A  +    module/tree_conflict_file
141M       lib/python/info/poems.py
142M       module/hello_constants.f90
143M       module/hello_constants.inc
144M       module/hello_constants_dummy.inc
145M       subroutine/hello_sub_dummy.h
146__OUT__
147file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
148#-------------------------------------------------------------------------------
149# Tests svn diff result of fcm merge --non-interactive
150TEST_KEY=$TEST_KEY_BASE-non-interactive-diff
151run_pass "$TEST_KEY" svn diff
152diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
153diff_svn_version_filter >"$TEST_DIR/$TEST_KEY.sorted.ctrl" <<__OUT__
154
155Index: .
156===================================================================
157--- . (revision 9)
158+++ . (working copy)
159
160Property changes on: .
161___________________________________________________________________
162Added: svn:mergeinfo
163#IF SVN1.9 ## -0,0 +0,1 ##
164   Merged /branches/dev/Share/merge1:r4-5
165#IF SVN1.9 Index: added_directory/hello_constants.f90
166#IF SVN1.9 ===================================================================
167#IF SVN1.9 Index: added_directory/hello_constants.inc
168#IF SVN1.9 ===================================================================
169#IF SVN1.9 Index: added_directory/hello_constants_dummy.inc
170#IF SVN1.9 ===================================================================
171#IF SVN1.9 Index: added_file
172#IF SVN1.9 ===================================================================
173Index: lib/python/info/poems.py
174===================================================================
175--- lib/python/info/poems.py  (revision 9)
176+++ lib/python/info/poems.py  (working copy)
177@@ -1,24 +1,23 @@
178-#!/usr/bin/env python
179-# -*- coding: utf-8 -*-
180 """The Python, by Hilaire Belloc
181 
182 A Python I should not advise,--
183-It needs a doctor for its eyes,
184+It needs a doctor FOR its eyes,
185 And has the measles yearly.
186-However, if you feel inclined
187-To get one (to improve your mind,
188+However, if you feel INclINed
189+To get one (
190+to improve your mINd,
191 And not from fashion merely),
192 Allow no music near its cage;
193-And when it flies into a rage
194+And when it flies INto a rage
195 Chastise it, most severely.
196-I had an aunt in Yucatan
197+I had an aunt IN Yucatan
198 Who bought a Python from a man
199-And kept it for a pet.
200+And kept it FOR a pet.
201 She died, because she never knew
202 These simple little rules and few;--
203-The Snake is living yet.
204+The Snake is livINg yet.
205 """
206 
207 import this
208 
209-print "\n",  __doc__
210+prINt "\n",  __doc__
211Index: module/hello_constants.f90
212===================================================================
213--- module/hello_constants.f90   (revision 9)
214+++ module/hello_constants.f90   (working copy)
215@@ -1,5 +1,5 @@
216 MODULE Hello_Constants
217 
218-INCLUDE 'hello_constants_dummy.inc'
219+INCLUDE 'hello_constants_dummy.INc'
220 
221 END MODULE Hello_Constants
222Index: module/hello_constants.inc
223===================================================================
224--- module/hello_constants.inc   (revision 9)
225+++ module/hello_constants.inc   (working copy)
226@@ -1 +1,2 @@
227-CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!'
228+CHARACTER (
229+LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!'
230Index: module/hello_constants_dummy.inc
231===================================================================
232--- module/hello_constants_dummy.inc   (revision 9)
233+++ module/hello_constants_dummy.inc   (working copy)
234@@ -1 +1 @@
235-INCLUDE 'hello_constants.inc'
236+INCLUDE 'hello_constants.INc'
237#IF SVN1.9 Index: module/tree_conflict_file
238#IF SVN1.9 ===================================================================
239Index: subroutine/hello_sub_dummy.h
240===================================================================
241--- subroutine/hello_sub_dummy.h (revision 9)
242+++ subroutine/hello_sub_dummy.h (working copy)
243@@ -1 +1,2 @@
244 #include "hello_sub.h"
245+Modified a line
246__OUT__
247file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" "$TEST_DIR/$TEST_KEY.sorted.ctrl"
248file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
249#-------------------------------------------------------------------------------
250# Test the various mergeinfo output after merging.
251test_mergeinfo "$TEST_KEY_BASE-post" \
252    $ROOT_URL/branches/dev/Share/merge1 - 9 <<__RESULTS__
253begin-prop
254/branches/dev/Share/merge1:4-5
255end-prop
256begin-info
257    youngest common ancestor
258    |         last full merge
259    |         |        tip of branch
260    |         |        |         repository path
261
262    1                  9       
263    |                  |       
264       --| |------------         branches/dev/Share/merge1
265      /                       
266     /                         
267  -------| |------------         trunk
268                       |       
269                       WC     
270end-info
271begin-eligible
272end-eligible
273begin-merged
274r4
275r5
276end-merged
277__RESULTS__
278#-------------------------------------------------------------------------------
279teardown
280#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.