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-branch-diff – NEMO

source: vendors/t/fcm-branch-diff/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: 18.7 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 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"
59diff_svn_version_filter >"$TEST_DIR/$TEST_KEY.sorted.ctrl" <<__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 --- added_directory/hello_constants.f90 (.../trunk) (working copy)
66#IF SVN1.9 +++ 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 --- added_directory/hello_constants.inc (.../trunk) (working copy)
78#IF SVN1.9 +++ 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 --- added_directory/hello_constants_dummy.inc (.../trunk) (working copy)
87#IF SVN1.9 +++ 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 --- added_file  (.../trunk) (working copy)
95#IF SVN1.9 +++ 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 --- lib/python/info/poems.py   (.../trunk) (revision 1)
103#IF SVN1.9 +++ 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 --- module/hello_constants.f90 (.../trunk) (revision 1)
143#IF SVN1.9 +++ 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 --- module/hello_constants.inc (.../trunk) (revision 1)
155#IF SVN1.9 +++ 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 --- module/hello_constants_dummy.inc (.../trunk) (revision 1)
163#IF SVN1.9 +++ 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.sorted.out" "$TEST_KEY.sorted.out" \
168    "$TEST_DIR/$TEST_KEY.sorted.ctrl"
169file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
170#-------------------------------------------------------------------------------
171# Tests fcm bdi
172TEST_KEY=$TEST_KEY_BASE-bdi
173run_pass "$TEST_KEY" fcm bdi
174diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
175diff_svn_version_filter >"$TEST_DIR/$TEST_KEY.sorted.ctrl" <<__OUT__
176
177Index: added_directory/hello_constants.f90
178===================================================================
179#IF SVN1.8 --- added_directory/hello_constants.f90 ($ROOT_URL/trunk) (revision 0)
180#IF SVN1.8 +++ added_directory/hello_constants.f90 (revision 6)
181#IF SVN1.9 --- added_directory/hello_constants.f90 (.../trunk) (working copy)
182#IF SVN1.9 +++ added_directory/hello_constants.f90 (.../branches/dev/Share/branch_test)   (revision 6)
183@@ -0,0 +1,5 @@
184+MODULE Hello_Constants
185+
186+INCLUDE 'hello_constants_dummy.INc'
187+
188+END MODULE Hello_Constants
189Index: added_directory/hello_constants.inc
190===================================================================
191#IF SVN1.8 --- added_directory/hello_constants.inc ($ROOT_URL/trunk) (revision 0)
192#IF SVN1.8 +++ added_directory/hello_constants.inc (revision 6)
193#IF SVN1.9 --- added_directory/hello_constants.inc (.../trunk) (working copy)
194#IF SVN1.9 +++ added_directory/hello_constants.inc (.../branches/dev/Share/branch_test)   (revision 6)
195@@ -0,0 +1,2 @@
196+CHARACTER (
197+LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!'
198Index: added_directory/hello_constants_dummy.inc
199===================================================================
200#IF SVN1.8 --- added_directory/hello_constants_dummy.inc ($ROOT_URL/trunk) (revision 0)
201#IF SVN1.8 +++ added_directory/hello_constants_dummy.inc (revision 6)
202#IF SVN1.9 --- added_directory/hello_constants_dummy.inc (.../trunk) (working copy)
203#IF SVN1.9 +++ added_directory/hello_constants_dummy.inc (.../branches/dev/Share/branch_test)   (revision 6)
204@@ -0,0 +1 @@
205+INCLUDE 'hello_constants.INc'
206Index: added_file
207===================================================================
208#IF SVN1.8 --- added_file  ($ROOT_URL/trunk) (revision 0)
209#IF SVN1.8 +++ added_file  (revision 6)
210#IF SVN1.9 --- added_file  (.../trunk) (working copy)
211#IF SVN1.9 +++ added_file  (.../branches/dev/Share/branch_test)   (revision 6)
212@@ -0,0 +1 @@
213+INCLUDE 'hello_constants.INc'
214Index: lib/python/info/poems.py
215===================================================================
216#IF SVN1.8 --- lib/python/info/poems.py   ($ROOT_URL/trunk) (revision 1)
217#IF SVN1.8 +++ lib/python/info/poems.py   (working copy)
218#IF SVN1.9 --- lib/python/info/poems.py   (.../trunk) (revision 1)
219#IF SVN1.9 +++ lib/python/info/poems.py   (.../branches/dev/Share/branch_test)   (working copy)
220@@ -1,24 +1,23 @@
221-#!/usr/bin/env python
222-# -*- coding: utf-8 -*-
223 """The Python, by Hilaire Belloc
224 
225 A Python I should not advise,--
226-It needs a doctor for its eyes,
227+It needs a doctor FOR its eyes,
228 And has the measles yearly.
229-However, if you feel inclined
230-To get one (to improve your mind,
231+However, if you feel INclINed
232+To get one (
233+to improve your mINd,
234 And not from fashion merely),
235 Allow no music near its cage;
236-And when it flies into a rage
237+And when it flies INto a rage
238 Chastise it, most severely.
239-I had an aunt in Yucatan
240+I had an aunt IN Yucatan
241 Who bought a Python from a man
242-And kept it for a pet.
243+And kept it FOR a pet.
244 She died, because she never knew
245 These simple little rules and few;--
246-The Snake is living yet.
247+The Snake is livINg yet.
248 """
249 
250 import this
251 
252-print "\n",  __doc__
253+prINt "\n",  __doc__
254Index: module/hello_constants.f90
255===================================================================
256#IF SVN1.8 --- module/hello_constants.f90 ($ROOT_URL/trunk) (revision 1)
257#IF SVN1.8 +++ module/hello_constants.f90 (working copy)
258#IF SVN1.9 --- module/hello_constants.f90 (.../trunk) (revision 1)
259#IF SVN1.9 +++ module/hello_constants.f90 (.../branches/dev/Share/branch_test)   (working copy)
260@@ -1,5 +0,0 @@
261-MODULE Hello_Constants
262-
263-INCLUDE 'hello_constants_dummy.inc'
264-
265-END MODULE Hello_Constants
266Index: module/hello_constants.inc
267===================================================================
268#IF SVN1.8 --- module/hello_constants.inc ($ROOT_URL/trunk) (revision 1)
269#IF SVN1.8 +++ module/hello_constants.inc (working copy)
270#IF SVN1.9 --- module/hello_constants.inc (.../trunk) (revision 1)
271#IF SVN1.9 +++ module/hello_constants.inc (.../branches/dev/Share/branch_test)   (working copy)
272@@ -1 +0,0 @@
273-CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!'
274Index: module/hello_constants_dummy.inc
275===================================================================
276#IF SVN1.8 --- module/hello_constants_dummy.inc ($ROOT_URL/trunk) (revision 1)
277#IF SVN1.8 +++ module/hello_constants_dummy.inc (working copy)
278#IF SVN1.9 --- module/hello_constants_dummy.inc (.../trunk) (revision 1)
279#IF SVN1.9 +++ module/hello_constants_dummy.inc (.../branches/dev/Share/branch_test)   (working copy)
280@@ -1 +0,0 @@
281-INCLUDE 'hello_constants.inc'
282__OUT__
283file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" \
284    "$TEST_DIR/$TEST_KEY.sorted.ctrl"
285file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
286#-------------------------------------------------------------------------------
287# Tests fcm branch-diff --wiki
288TEST_KEY=$TEST_KEY_BASE-wiki
289run_pass "$TEST_KEY" fcm branch-diff --wiki
290file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
291diff:/${PROJECT}trunk@1///${PROJECT}branches/dev/Share/branch_test@6
292__OUT__
293file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
294#-------------------------------------------------------------------------------
295# Tests fcm bdi --wiki
296TEST_KEY=$TEST_KEY_BASE-bdi-wiki
297run_pass "$TEST_KEY" fcm bdi --wiki
298file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
299diff:/${PROJECT}trunk@1///${PROJECT}branches/dev/Share/branch_test@6
300__OUT__
301file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
302#-------------------------------------------------------------------------------
303# Tests fcm bdi on the trunk
304svn switch -q $ROOT_URL/trunk
305TEST_KEY=$TEST_KEY_BASE-bdi-trunk
306run_fail "$TEST_KEY" fcm bdi
307file_cmp "$TEST_KEY.out" "$TEST_KEY.out" </dev/null
308file_cmp "$TEST_KEY.err" "$TEST_KEY.err" <<__ERR__
309[FAIL] $ROOT_URL/trunk@6: not a valid URL of a standard FCM branch.
310
311__ERR__
312#-------------------------------------------------------------------------------
313# Tests fcm bdi with working copy changes
314svn switch -q $ROOT_URL/branches/dev/Share/branch_test
315TEST_KEY=$TEST_KEY_BASE-bdi-wc-changes
316echo "foo" > added_directory/foo$TEST_KEY
317svn add -q added_directory/foo$TEST_KEY
318echo "bar" > added_directory/bar$TEST_KEY
319run_pass "$TEST_KEY" fcm bdi
320diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
321diff_svn_version_filter >"$TEST_DIR/$TEST_KEY.sorted.ctrl" <<__OUT__
322
323Index: added_directory/foo00-simple-bdi-wc-changes
324===================================================================
325#IF SVN1.8 --- added_directory/foo00-simple-bdi-wc-changes  ($ROOT_URL/trunk) (revision 0)
326#IF SVN1.8 +++ added_directory/foo00-simple-bdi-wc-changes  (working copy)
327#IF SVN1.9 --- added_directory/foo00-simple-bdi-wc-changes  (.../trunk) (working copy)
328#IF SVN1.9 +++ added_directory/foo00-simple-bdi-wc-changes  (.../branches/dev/Share/branch_test)   (working copy)
329@@ -0,0 +1 @@
330+foo
331Index: added_directory/hello_constants.f90
332===================================================================
333#IF SVN1.8 --- added_directory/hello_constants.f90 ($ROOT_URL/trunk) (revision 0)
334#IF SVN1.8 +++ added_directory/hello_constants.f90 (revision 6)
335#IF SVN1.9 --- added_directory/hello_constants.f90 (.../trunk) (working copy)
336#IF SVN1.9 +++ added_directory/hello_constants.f90 (.../branches/dev/Share/branch_test)   (revision 6)
337@@ -0,0 +1,5 @@
338+MODULE Hello_Constants
339+
340+INCLUDE 'hello_constants_dummy.INc'
341+
342+END MODULE Hello_Constants
343Index: added_directory/hello_constants.inc
344===================================================================
345#IF SVN1.8 --- added_directory/hello_constants.inc ($ROOT_URL/trunk) (revision 0)
346#IF SVN1.8 +++ added_directory/hello_constants.inc (revision 6)
347#IF SVN1.9 --- added_directory/hello_constants.inc (.../trunk) (working copy)
348#IF SVN1.9 +++ added_directory/hello_constants.inc (.../branches/dev/Share/branch_test)   (revision 6)
349@@ -0,0 +1,2 @@
350+CHARACTER (
351+LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!'
352Index: added_directory/hello_constants_dummy.inc
353===================================================================
354#IF SVN1.8 --- added_directory/hello_constants_dummy.inc ($ROOT_URL/trunk) (revision 0)
355#IF SVN1.8 +++ added_directory/hello_constants_dummy.inc (revision 6)
356#IF SVN1.9 --- added_directory/hello_constants_dummy.inc (.../trunk) (working copy)
357#IF SVN1.9 +++ added_directory/hello_constants_dummy.inc (.../branches/dev/Share/branch_test)   (revision 6)
358@@ -0,0 +1 @@
359+INCLUDE 'hello_constants.INc'
360Index: added_file
361===================================================================
362#IF SVN1.8 --- added_file  ($ROOT_URL/trunk) (revision 0)
363#IF SVN1.8 +++ added_file  (revision 6)
364#IF SVN1.9 --- added_file  (.../trunk) (working copy)
365#IF SVN1.9 +++ added_file  (.../branches/dev/Share/branch_test)   (revision 6)
366@@ -0,0 +1 @@
367+INCLUDE 'hello_constants.INc'
368Index: lib/python/info/poems.py
369===================================================================
370#IF SVN1.8 --- lib/python/info/poems.py   ($ROOT_URL/trunk) (revision 1)
371#IF SVN1.8 +++ lib/python/info/poems.py   (working copy)
372#IF SVN1.9 --- lib/python/info/poems.py   (.../trunk) (revision 1)
373#IF SVN1.9 +++ lib/python/info/poems.py   (.../branches/dev/Share/branch_test)   (working copy)
374@@ -1,24 +1,23 @@
375-#!/usr/bin/env python
376-# -*- coding: utf-8 -*-
377 """The Python, by Hilaire Belloc
378 
379 A Python I should not advise,--
380-It needs a doctor for its eyes,
381+It needs a doctor FOR its eyes,
382 And has the measles yearly.
383-However, if you feel inclined
384-To get one (to improve your mind,
385+However, if you feel INclINed
386+To get one (
387+to improve your mINd,
388 And not from fashion merely),
389 Allow no music near its cage;
390-And when it flies into a rage
391+And when it flies INto a rage
392 Chastise it, most severely.
393-I had an aunt in Yucatan
394+I had an aunt IN Yucatan
395 Who bought a Python from a man
396-And kept it for a pet.
397+And kept it FOR a pet.
398 She died, because she never knew
399 These simple little rules and few;--
400-The Snake is living yet.
401+The Snake is livINg yet.
402 """
403 
404 import this
405 
406-print "\n",  __doc__
407+prINt "\n",  __doc__
408Index: module/hello_constants.f90
409===================================================================
410#IF SVN1.8 --- module/hello_constants.f90 ($ROOT_URL/trunk) (revision 1)
411#IF SVN1.8 +++ module/hello_constants.f90 (working copy)
412#IF SVN1.9 --- module/hello_constants.f90 (.../trunk) (revision 1)
413#IF SVN1.9 +++ module/hello_constants.f90 (.../branches/dev/Share/branch_test)   (working copy)
414@@ -1,5 +0,0 @@
415-MODULE Hello_Constants
416-
417-INCLUDE 'hello_constants_dummy.inc'
418-
419-END MODULE Hello_Constants
420Index: module/hello_constants.inc
421===================================================================
422#IF SVN1.8 --- module/hello_constants.inc ($ROOT_URL/trunk) (revision 1)
423#IF SVN1.8 +++ module/hello_constants.inc (working copy)
424#IF SVN1.9 --- module/hello_constants.inc (.../trunk) (revision 1)
425#IF SVN1.9 +++ module/hello_constants.inc (.../branches/dev/Share/branch_test)   (working copy)
426@@ -1 +0,0 @@
427-CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!'
428Index: module/hello_constants_dummy.inc
429===================================================================
430#IF SVN1.8 --- module/hello_constants_dummy.inc ($ROOT_URL/trunk) (revision 1)
431#IF SVN1.8 +++ module/hello_constants_dummy.inc (working copy)
432#IF SVN1.9 --- module/hello_constants_dummy.inc (.../trunk) (revision 1)
433#IF SVN1.9 +++ module/hello_constants_dummy.inc (.../branches/dev/Share/branch_test)   (working copy)
434@@ -1 +0,0 @@
435-INCLUDE 'hello_constants.inc'
436__OUT__
437file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" \
438    "$TEST_DIR/$TEST_KEY.sorted.ctrl"
439file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
440teardown
441#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.