source: LMDZ6/branches/Amaury_dev/tools/fcm/t/fcm-branch-diff/00-simple.t @ 5095

Last change on this file since 5095 was 5095, checked in by abarral, 4 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

File size: 18.7 KB
Line 
1#!/bin/bash
2# ------------------------------------------------------------------------------
3# Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
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 branch-diff".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23#-------------------------------------------------------------------------------
24check_svn_version
25tests 18
26#-------------------------------------------------------------------------------
27setup
28init_repos
29init_branch_wc branch_test $REPOS_URL
30cd $TEST_DIR/wc
31FILE_LIST="lib/python/info/__init__.py lib/python/info/poems.py \
32module/hello_constants.f90 module/hello_constants.inc \
33module/hello_constants_dummy.inc"
34for FILE in $FILE_LIST; do 
35    sed -i "s/for/FOR/g; s/fi/end if/g; s/in/IN/g;" $FILE
36    sed -i "/#/d; /^ *!/d" $FILE
37    sed -i "s/!/!!/g; s/q/\nq/g; s/[(]/(\n/g" $FILE
38done
39FILE_DIR=$(dirname $FILE)
40svn copy -q $FILE added_file
41svn copy -q $FILE_DIR added_directory
42svn delete --force -q $FILE_DIR
43svn commit -q -m "make branch diff"
44svn switch -q $ROOT_URL/trunk
45TMPFILE=$(mktemp)
46for FILE in $FILE_LIST; do
47    if [[ -e $FILE ]]; then
48        tac $FILE > $TMPFILE && mv $TMPFILE $FILE
49    fi
50done
51rm -f $TMPFILE
52svn commit -q -m "make trunk diff"
53svn switch -q $ROOT_URL/branches/dev/Share/branch_test
54#-------------------------------------------------------------------------------
55# Tests fcm branch-diff
56TEST_KEY=$TEST_KEY_BASE-fcm-branch-diff
57run_pass "$TEST_KEY" fcm branch-diff
58diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
59file_cmp_filtered "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__
60
61Index: added_directory/hello_constants.f90
62===================================================================
63#IF SVN1.8 --- added_directory/hello_constants.f90      ($ROOT_URL/trunk)       (revision 0)
64#IF SVN1.8 +++ added_directory/hello_constants.f90      (revision 6)
65#IF SVN1.9/10/14 --- added_directory/hello_constants.f90        (.../trunk)     (working copy)
66#IF SVN1.9/10/14 +++ added_directory/hello_constants.f90        (.../branches/dev/Share/branch_test)    (revision 6)
67@@ -0,0 +1,5 @@
68+MODULE Hello_Constants
69+
70+INCLUDE 'hello_constants_dummy.INc'
71+
72+END MODULE Hello_Constants
73Index: added_directory/hello_constants.inc
74===================================================================
75#IF SVN1.8 --- added_directory/hello_constants.inc      ($ROOT_URL/trunk)       (revision 0)
76#IF SVN1.8 +++ added_directory/hello_constants.inc      (revision 6)
77#IF SVN1.9/10/14 --- added_directory/hello_constants.inc        (.../trunk)     (working copy)
78#IF SVN1.9/10/14 +++ added_directory/hello_constants.inc        (.../branches/dev/Share/branch_test)    (revision 6)
79@@ -0,0 +1,2 @@
80+CHARACTER (
81+LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!'
82Index: added_directory/hello_constants_dummy.inc
83===================================================================
84#IF SVN1.8 --- added_directory/hello_constants_dummy.inc        ($ROOT_URL/trunk)       (revision 0)
85#IF SVN1.8 +++ added_directory/hello_constants_dummy.inc        (revision 6)
86#IF SVN1.9/10/14 --- added_directory/hello_constants_dummy.inc  (.../trunk)     (working copy)
87#IF SVN1.9/10/14 +++ added_directory/hello_constants_dummy.inc  (.../branches/dev/Share/branch_test)    (revision 6)
88@@ -0,0 +1 @@
89+INCLUDE 'hello_constants.INc'
90Index: added_file
91===================================================================
92#IF SVN1.8 --- added_file       ($ROOT_URL/trunk)       (revision 0)
93#IF SVN1.8 +++ added_file       (revision 6)
94#IF SVN1.9/10/14 --- added_file (.../trunk)     (working copy)
95#IF SVN1.9/10/14 +++ added_file (.../branches/dev/Share/branch_test)    (revision 6)
96@@ -0,0 +1 @@
97+INCLUDE 'hello_constants.INc'
98Index: lib/python/info/poems.py
99===================================================================
100#IF SVN1.8 --- lib/python/info/poems.py ($ROOT_URL/trunk)       (revision 1)
101#IF SVN1.8 +++ lib/python/info/poems.py (working copy)
102#IF SVN1.9/10/14 --- lib/python/info/poems.py   (.../trunk)     (revision 1)
103#IF SVN1.9/10/14 +++ lib/python/info/poems.py   (.../branches/dev/Share/branch_test)    (working copy)
104@@ -1,24 +1,23 @@
105-#!/usr/bin/env python
106-# -*- coding: utf-8 -*-
107 """The Python, by Hilaire Belloc
108 
109 A Python I should not advise,--
110-It needs a doctor for its eyes,
111+It needs a doctor FOR its eyes,
112 And has the measles yearly.
113-However, if you feel inclined
114-To get one (to improve your mind,
115+However, if you feel INclINed
116+To get one (
117+to improve your mINd,
118 And not from fashion merely),
119 Allow no music near its cage;
120-And when it flies into a rage
121+And when it flies INto a rage
122 Chastise it, most severely.
123-I had an aunt in Yucatan
124+I had an aunt IN Yucatan
125 Who bought a Python from a man
126-And kept it for a pet.
127+And kept it FOR a pet.
128 She died, because she never knew
129 These simple little rules and few;--
130-The Snake is living yet.
131+The Snake is livINg yet.
132 """
133 
134 import this
135 
136-print "\n",  __doc__
137+prINt "\n",  __doc__
138Index: module/hello_constants.f90
139===================================================================
140#IF SVN1.8 --- module/hello_constants.f90       ($ROOT_URL/trunk)       (revision 1)
141#IF SVN1.8 +++ module/hello_constants.f90       (working copy)
142#IF SVN1.9/10/14 --- module/hello_constants.f90 (.../trunk)     (revision 1)
143#IF SVN1.9/10/14 +++ module/hello_constants.f90 (.../branches/dev/Share/branch_test)    (working copy)
144@@ -1,5 +0,0 @@
145-MODULE Hello_Constants
146-
147-INCLUDE 'hello_constants_dummy.inc'
148-
149-END MODULE Hello_Constants
150Index: module/hello_constants.inc
151===================================================================
152#IF SVN1.8 --- module/hello_constants.inc       ($ROOT_URL/trunk)       (revision 1)
153#IF SVN1.8 +++ module/hello_constants.inc       (working copy)
154#IF SVN1.9/10/14 --- module/hello_constants.inc (.../trunk)     (revision 1)
155#IF SVN1.9/10/14 +++ module/hello_constants.inc (.../branches/dev/Share/branch_test)    (working copy)
156@@ -1 +0,0 @@
157-CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!'
158Index: module/hello_constants_dummy.inc
159===================================================================
160#IF SVN1.8 --- module/hello_constants_dummy.inc ($ROOT_URL/trunk)       (revision 1)
161#IF SVN1.8 +++ module/hello_constants_dummy.inc (working copy)
162#IF SVN1.9/10/14 --- module/hello_constants_dummy.inc   (.../trunk)     (revision 1)
163#IF SVN1.9/10/14 +++ module/hello_constants_dummy.inc   (.../branches/dev/Share/branch_test)    (working copy)
164@@ -1 +0,0 @@
165-INCLUDE 'hello_constants.inc'
166__OUT__
167file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
168#-------------------------------------------------------------------------------
169# Tests fcm bdi
170TEST_KEY=$TEST_KEY_BASE-bdi
171run_pass "$TEST_KEY" fcm bdi
172diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
173file_cmp_filtered "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__
174
175Index: added_directory/hello_constants.f90
176===================================================================
177#IF SVN1.8 --- added_directory/hello_constants.f90      ($ROOT_URL/trunk)       (revision 0)
178#IF SVN1.8 +++ added_directory/hello_constants.f90      (revision 6)
179#IF SVN1.9/10/14 --- added_directory/hello_constants.f90        (.../trunk)     (working copy)
180#IF SVN1.9/10/14 +++ added_directory/hello_constants.f90        (.../branches/dev/Share/branch_test)    (revision 6)
181@@ -0,0 +1,5 @@
182+MODULE Hello_Constants
183+
184+INCLUDE 'hello_constants_dummy.INc'
185+
186+END MODULE Hello_Constants
187Index: added_directory/hello_constants.inc
188===================================================================
189#IF SVN1.8 --- added_directory/hello_constants.inc      ($ROOT_URL/trunk)       (revision 0)
190#IF SVN1.8 +++ added_directory/hello_constants.inc      (revision 6)
191#IF SVN1.9/10/14 --- added_directory/hello_constants.inc        (.../trunk)     (working copy)
192#IF SVN1.9/10/14 +++ added_directory/hello_constants.inc        (.../branches/dev/Share/branch_test)    (revision 6)
193@@ -0,0 +1,2 @@
194+CHARACTER (
195+LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!'
196Index: added_directory/hello_constants_dummy.inc
197===================================================================
198#IF SVN1.8 --- added_directory/hello_constants_dummy.inc        ($ROOT_URL/trunk)       (revision 0)
199#IF SVN1.8 +++ added_directory/hello_constants_dummy.inc        (revision 6)
200#IF SVN1.9/10/14 --- added_directory/hello_constants_dummy.inc  (.../trunk)     (working copy)
201#IF SVN1.9/10/14 +++ added_directory/hello_constants_dummy.inc  (.../branches/dev/Share/branch_test)    (revision 6)
202@@ -0,0 +1 @@
203+INCLUDE 'hello_constants.INc'
204Index: added_file
205===================================================================
206#IF SVN1.8 --- added_file       ($ROOT_URL/trunk)       (revision 0)
207#IF SVN1.8 +++ added_file       (revision 6)
208#IF SVN1.9/10/14 --- added_file (.../trunk)     (working copy)
209#IF SVN1.9/10/14 +++ added_file (.../branches/dev/Share/branch_test)    (revision 6)
210@@ -0,0 +1 @@
211+INCLUDE 'hello_constants.INc'
212Index: lib/python/info/poems.py
213===================================================================
214#IF SVN1.8 --- lib/python/info/poems.py ($ROOT_URL/trunk)       (revision 1)
215#IF SVN1.8 +++ lib/python/info/poems.py (working copy)
216#IF SVN1.9/10/14 --- lib/python/info/poems.py   (.../trunk)     (revision 1)
217#IF SVN1.9/10/14 +++ lib/python/info/poems.py   (.../branches/dev/Share/branch_test)    (working copy)
218@@ -1,24 +1,23 @@
219-#!/usr/bin/env python
220-# -*- coding: utf-8 -*-
221 """The Python, by Hilaire Belloc
222 
223 A Python I should not advise,--
224-It needs a doctor for its eyes,
225+It needs a doctor FOR its eyes,
226 And has the measles yearly.
227-However, if you feel inclined
228-To get one (to improve your mind,
229+However, if you feel INclINed
230+To get one (
231+to improve your mINd,
232 And not from fashion merely),
233 Allow no music near its cage;
234-And when it flies into a rage
235+And when it flies INto a rage
236 Chastise it, most severely.
237-I had an aunt in Yucatan
238+I had an aunt IN Yucatan
239 Who bought a Python from a man
240-And kept it for a pet.
241+And kept it FOR a pet.
242 She died, because she never knew
243 These simple little rules and few;--
244-The Snake is living yet.
245+The Snake is livINg yet.
246 """
247 
248 import this
249 
250-print "\n",  __doc__
251+prINt "\n",  __doc__
252Index: module/hello_constants.f90
253===================================================================
254#IF SVN1.8 --- module/hello_constants.f90       ($ROOT_URL/trunk)       (revision 1)
255#IF SVN1.8 +++ module/hello_constants.f90       (working copy)
256#IF SVN1.9/10/14 --- module/hello_constants.f90 (.../trunk)     (revision 1)
257#IF SVN1.9/10/14 +++ module/hello_constants.f90 (.../branches/dev/Share/branch_test)    (working copy)
258@@ -1,5 +0,0 @@
259-MODULE Hello_Constants
260-
261-INCLUDE 'hello_constants_dummy.inc'
262-
263-END MODULE Hello_Constants
264Index: module/hello_constants.inc
265===================================================================
266#IF SVN1.8 --- module/hello_constants.inc       ($ROOT_URL/trunk)       (revision 1)
267#IF SVN1.8 +++ module/hello_constants.inc       (working copy)
268#IF SVN1.9/10/14 --- module/hello_constants.inc (.../trunk)     (revision 1)
269#IF SVN1.9/10/14 +++ module/hello_constants.inc (.../branches/dev/Share/branch_test)    (working copy)
270@@ -1 +0,0 @@
271-CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!'
272Index: module/hello_constants_dummy.inc
273===================================================================
274#IF SVN1.8 --- module/hello_constants_dummy.inc ($ROOT_URL/trunk)       (revision 1)
275#IF SVN1.8 +++ module/hello_constants_dummy.inc (working copy)
276#IF SVN1.9/10/14 --- module/hello_constants_dummy.inc   (.../trunk)     (revision 1)
277#IF SVN1.9/10/14 +++ module/hello_constants_dummy.inc   (.../branches/dev/Share/branch_test)    (working copy)
278@@ -1 +0,0 @@
279-INCLUDE 'hello_constants.inc'
280__OUT__
281file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
282#-------------------------------------------------------------------------------
283# Tests fcm branch-diff --wiki
284TEST_KEY=$TEST_KEY_BASE-wiki
285run_pass "$TEST_KEY" fcm branch-diff --wiki
286file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
287diff:/${PROJECT}trunk@1///${PROJECT}branches/dev/Share/branch_test@6
288__OUT__
289file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
290#-------------------------------------------------------------------------------
291# Tests fcm bdi --wiki
292TEST_KEY=$TEST_KEY_BASE-bdi-wiki
293run_pass "$TEST_KEY" fcm bdi --wiki
294file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
295diff:/${PROJECT}trunk@1///${PROJECT}branches/dev/Share/branch_test@6
296__OUT__
297file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
298#-------------------------------------------------------------------------------
299# Tests fcm bdi on the trunk
300svn switch -q $ROOT_URL/trunk
301TEST_KEY=$TEST_KEY_BASE-bdi-trunk
302run_fail "$TEST_KEY" fcm bdi
303file_cmp "$TEST_KEY.out" "$TEST_KEY.out" </dev/null
304file_cmp "$TEST_KEY.err" "$TEST_KEY.err" <<__ERR__
305[FAIL] $ROOT_URL/trunk@6: not a valid URL of a standard FCM branch.
306
307__ERR__
308#-------------------------------------------------------------------------------
309# Tests fcm bdi with working copy changes
310svn switch -q $ROOT_URL/branches/dev/Share/branch_test
311TEST_KEY=$TEST_KEY_BASE-bdi-wc-changes
312echo "foo" > added_directory/foo$TEST_KEY
313svn add -q added_directory/foo$TEST_KEY
314echo "bar" > added_directory/bar$TEST_KEY
315run_pass "$TEST_KEY" fcm bdi
316diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
317file_cmp_filtered "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<__OUT__
318
319Index: added_directory/foo00-simple-bdi-wc-changes
320===================================================================
321#IF SVN1.8 --- added_directory/foo00-simple-bdi-wc-changes      ($ROOT_URL/trunk)       (revision 0)
322#IF SVN1.8 +++ added_directory/foo00-simple-bdi-wc-changes      (working copy)
323#IF SVN1.9/10/14 --- added_directory/foo00-simple-bdi-wc-changes        (.../trunk)     (working copy)
324#IF SVN1.9/10/14 +++ added_directory/foo00-simple-bdi-wc-changes        (.../branches/dev/Share/branch_test)    (working copy)
325@@ -0,0 +1 @@
326+foo
327Index: added_directory/hello_constants.f90
328===================================================================
329#IF SVN1.8 --- added_directory/hello_constants.f90      ($ROOT_URL/trunk)       (revision 0)
330#IF SVN1.8 +++ added_directory/hello_constants.f90      (revision 6)
331#IF SVN1.9/10/14 --- added_directory/hello_constants.f90        (.../trunk)     (working copy)
332#IF SVN1.9/10/14 +++ added_directory/hello_constants.f90        (.../branches/dev/Share/branch_test)    (revision 6)
333@@ -0,0 +1,5 @@
334+MODULE Hello_Constants
335+
336+INCLUDE 'hello_constants_dummy.INc'
337+
338+END MODULE Hello_Constants
339Index: added_directory/hello_constants.inc
340===================================================================
341#IF SVN1.8 --- added_directory/hello_constants.inc      ($ROOT_URL/trunk)       (revision 0)
342#IF SVN1.8 +++ added_directory/hello_constants.inc      (revision 6)
343#IF SVN1.9/10/14 --- added_directory/hello_constants.inc        (.../trunk)     (working copy)
344#IF SVN1.9/10/14 +++ added_directory/hello_constants.inc        (.../branches/dev/Share/branch_test)    (revision 6)
345@@ -0,0 +1,2 @@
346+CHARACTER (
347+LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!'
348Index: added_directory/hello_constants_dummy.inc
349===================================================================
350#IF SVN1.8 --- added_directory/hello_constants_dummy.inc        ($ROOT_URL/trunk)       (revision 0)
351#IF SVN1.8 +++ added_directory/hello_constants_dummy.inc        (revision 6)
352#IF SVN1.9/10/14 --- added_directory/hello_constants_dummy.inc  (.../trunk)     (working copy)
353#IF SVN1.9/10/14 +++ added_directory/hello_constants_dummy.inc  (.../branches/dev/Share/branch_test)    (revision 6)
354@@ -0,0 +1 @@
355+INCLUDE 'hello_constants.INc'
356Index: added_file
357===================================================================
358#IF SVN1.8 --- added_file       ($ROOT_URL/trunk)       (revision 0)
359#IF SVN1.8 +++ added_file       (revision 6)
360#IF SVN1.9/10/14 --- added_file (.../trunk)     (working copy)
361#IF SVN1.9/10/14 +++ added_file (.../branches/dev/Share/branch_test)    (revision 6)
362@@ -0,0 +1 @@
363+INCLUDE 'hello_constants.INc'
364Index: lib/python/info/poems.py
365===================================================================
366#IF SVN1.8 --- lib/python/info/poems.py ($ROOT_URL/trunk)       (revision 1)
367#IF SVN1.8 +++ lib/python/info/poems.py (working copy)
368#IF SVN1.9/10/14 --- lib/python/info/poems.py   (.../trunk)     (revision 1)
369#IF SVN1.9/10/14 +++ lib/python/info/poems.py   (.../branches/dev/Share/branch_test)    (working copy)
370@@ -1,24 +1,23 @@
371-#!/usr/bin/env python
372-# -*- coding: utf-8 -*-
373 """The Python, by Hilaire Belloc
374 
375 A Python I should not advise,--
376-It needs a doctor for its eyes,
377+It needs a doctor FOR its eyes,
378 And has the measles yearly.
379-However, if you feel inclined
380-To get one (to improve your mind,
381+However, if you feel INclINed
382+To get one (
383+to improve your mINd,
384 And not from fashion merely),
385 Allow no music near its cage;
386-And when it flies into a rage
387+And when it flies INto a rage
388 Chastise it, most severely.
389-I had an aunt in Yucatan
390+I had an aunt IN Yucatan
391 Who bought a Python from a man
392-And kept it for a pet.
393+And kept it FOR a pet.
394 She died, because she never knew
395 These simple little rules and few;--
396-The Snake is living yet.
397+The Snake is livINg yet.
398 """
399 
400 import this
401 
402-print "\n",  __doc__
403+prINt "\n",  __doc__
404Index: module/hello_constants.f90
405===================================================================
406#IF SVN1.8 --- module/hello_constants.f90       ($ROOT_URL/trunk)       (revision 1)
407#IF SVN1.8 +++ module/hello_constants.f90       (working copy)
408#IF SVN1.9/10/14 --- module/hello_constants.f90 (.../trunk)     (revision 1)
409#IF SVN1.9/10/14 +++ module/hello_constants.f90 (.../branches/dev/Share/branch_test)    (working copy)
410@@ -1,5 +0,0 @@
411-MODULE Hello_Constants
412-
413-INCLUDE 'hello_constants_dummy.inc'
414-
415-END MODULE Hello_Constants
416Index: module/hello_constants.inc
417===================================================================
418#IF SVN1.8 --- module/hello_constants.inc       ($ROOT_URL/trunk)       (revision 1)
419#IF SVN1.8 +++ module/hello_constants.inc       (working copy)
420#IF SVN1.9/10/14 --- module/hello_constants.inc (.../trunk)     (revision 1)
421#IF SVN1.9/10/14 +++ module/hello_constants.inc (.../branches/dev/Share/branch_test)    (working copy)
422@@ -1 +0,0 @@
423-CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!'
424Index: module/hello_constants_dummy.inc
425===================================================================
426#IF SVN1.8 --- module/hello_constants_dummy.inc ($ROOT_URL/trunk)       (revision 1)
427#IF SVN1.8 +++ module/hello_constants_dummy.inc (working copy)
428#IF SVN1.9/10/14 --- module/hello_constants_dummy.inc   (.../trunk)     (revision 1)
429#IF SVN1.9/10/14 +++ module/hello_constants_dummy.inc   (.../branches/dev/Share/branch_test)    (working copy)
430@@ -1 +0,0 @@
431-INCLUDE 'hello_constants.inc'
432__OUT__
433file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
434teardown
435#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.