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.
15-extract-loc-reset.t in vendors/FCM-2017.10.0/t/fcm-make – NEMO

source: vendors/FCM-2017.10.0/t/fcm-make/15-extract-loc-reset.t @ 13688

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

Reimport latest FCM release

File size: 6.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# Tests for "fcm make", "extract", location reset and base eq diff cases.
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23#-------------------------------------------------------------------------------
24N_TESTS=34
25tests $N_TESTS
26#-------------------------------------------------------------------------------
27svnadmin create repos
28T_REPOS=file://$PWD/repos
29mkdir t
30echo "Hello World" >t/hello.txt
31echo "Hi World" >t/hi.txt
32svn import -q -m'Test' t/hello.txt $T_REPOS/trunk/hello.txt
33svn import -q -m'Test' t $T_REPOS/branch
34rm t/hello.txt t/hi.txt
35rmdir t
36#-------------------------------------------------------------------------------
37cat >fcm-make.cfg.0 <<__FCM_MAKE_CFG__
38steps=extract
39extract.ns=t
40extract.location{primary}[t]=$T_REPOS
41__FCM_MAKE_CFG__
42#-------------------------------------------------------------------------------
43base_tests() {
44    run_pass "$TEST_KEY" fcm make --new
45    find extract -type f >"$TEST_KEY.find"
46    file_cmp "$TEST_KEY.find" "$TEST_KEY.find" <<<'extract/t/hello.txt'
47    sed '/^\[info\] location     t: /!d; s/^\[info\] location     t: //' \
48        .fcm-make/log > "$TEST_KEY.log"
49    file_cmp "$TEST_KEY.log" "$TEST_KEY.log" <<__LOG__
500: $T_REPOS/trunk@2 (1)
51__LOG__
52}
53#-------------------------------------------------------------------------------
54diff_tests() {
55    run_pass "$TEST_KEY" fcm make --new
56    find extract -type f | sort >"$TEST_KEY.find"
57    file_cmp "$TEST_KEY.find" "$TEST_KEY.find" <<'__FIND__'
58extract/t/hello.txt
59extract/t/hi.txt
60__FIND__
61    sed '/^\[info\] location     t: /!d; s/^\[info\] location     t: //' \
62        .fcm-make/log > "$TEST_KEY.log"
63file_cmp "$TEST_KEY.log" "$TEST_KEY.log" <<__LOG__
640: $T_REPOS/trunk@2 (1)
651: $T_REPOS/branch@2 (2)
66__LOG__
67}
68#-------------------------------------------------------------------------------
69TEST_KEY="$TEST_KEY_BASE-primary"
70{
71    cat fcm-make.cfg.0
72    echo "extract.location{primary}[t]="
73    echo "extract.location[t]=$T_REPOS/trunk"
74} >fcm-make.cfg
75base_tests
76#-------------------------------------------------------------------------------
77TEST_KEY="$TEST_KEY_BASE-base-0"
78{
79    cat fcm-make.cfg.0
80    echo "extract.location[t]="
81} >fcm-make.cfg
82base_tests
83#-------------------------------------------------------------------------------
84TEST_KEY="$TEST_KEY_BASE-base-0-with-eq-diff"
85{
86    cat fcm-make.cfg.0
87    echo "extract.location{diff}[t]=$T_REPOS/trunk"
88} >fcm-make.cfg
89base_tests
90#-------------------------------------------------------------------------------
91TEST_KEY="$TEST_KEY_BASE-base"
92{
93    cat fcm-make.cfg.0
94    echo "extract.location[t]=$T_REPOS/trunk"
95    echo "extract.location[t]="
96} >fcm-make.cfg
97base_tests
98#-------------------------------------------------------------------------------
99TEST_KEY="$TEST_KEY_BASE-base-with-eq-diff"
100{
101    cat fcm-make.cfg.0
102    echo "extract.location[t]=$T_REPOS/trunk"
103    echo "extract.location{diff}[t]=$T_REPOS/trunk"
104} >fcm-make.cfg
105base_tests
106#-------------------------------------------------------------------------------
107TEST_KEY="$TEST_KEY_BASE-base-with-diff"
108{
109    cat fcm-make.cfg.0
110    echo "extract.location[t]=$T_REPOS/trunk"
111    echo "extract.location{diff}[t]=$T_REPOS/branch"
112    echo "extract.location[t]="
113} >fcm-make.cfg
114diff_tests
115#-------------------------------------------------------------------------------
116TEST_KEY="$TEST_KEY_BASE-base-with-1-eq-diff"
117{
118    cat fcm-make.cfg.0
119    echo "extract.location[t]=$T_REPOS/trunk"
120    echo "extract.location{diff}[t]=$T_REPOS/trunk $T_REPOS/branch"
121    echo "extract.location[t]="
122} >fcm-make.cfg
123diff_tests
124#-------------------------------------------------------------------------------
125TEST_KEY="$TEST_KEY_BASE-diff-0"
126{
127    cat fcm-make.cfg.0
128    echo "extract.location{diff}[t]="
129} >fcm-make.cfg
130base_tests
131#-------------------------------------------------------------------------------
132TEST_KEY="$TEST_KEY_BASE-diff"
133{
134    cat fcm-make.cfg.0
135    echo "extract.location{diff}[t]=$T_REPOS/branch"
136    echo "extract.location{diff}[t]="
137} >fcm-make.cfg
138base_tests
139#-------------------------------------------------------------------------------
140TEST_KEY="$TEST_KEY_BASE-diff-with-base"
141{
142    cat fcm-make.cfg.0
143    echo "extract.location{diff}[t]=$T_REPOS/branch"
144    echo "extract.location[t]=$T_REPOS/trunk"
145    echo "extract.location{diff}[t]="
146} >fcm-make.cfg
147base_tests
148#-------------------------------------------------------------------------------
149TEST_KEY="$TEST_KEY_BASE-inherit-base-eq-my-diff"
150mkdir -p i0 i1
151cat fcm-make.cfg.0 >i0/fcm-make.cfg
152fcm make --new -q -C i0
153{
154    echo 'use=$HERE/../i0'
155    echo "extract.location{diff}[t]=$T_REPOS/trunk"
156} >i1/fcm-make.cfg
157run_pass "$TEST_KEY" fcm make --new -C i1
158sed '/^\[info\] location     t: /!d; s/^\[info\] location     t: //' \
159    i1/.fcm-make/log > "$TEST_KEY.log"
160file_cmp "$TEST_KEY.log" "$TEST_KEY.log" <<__LOG__
1610: $T_REPOS/trunk@2 (1)
162__LOG__
163#-------------------------------------------------------------------------------
164TEST_KEY="$TEST_KEY_BASE-inherit-base-eq-1-of-my-diff"
165# N.B. The 3 lines below have been done in the test above.
166#      Uncomment them if the above test is removed.
167#mkdir -p i0 i1
168#cat fcm-make.cfg.0 >i0/fcm-make.cfg
169#fcm make --new -q -C i0
170{
171    echo 'use=$HERE/../i0'
172    echo "extract.location{diff}[t]=$T_REPOS/branch $T_REPOS/trunk"
173} >i1/fcm-make.cfg
174run_pass "$TEST_KEY" fcm make --new -C i1
175sed '/^\[info\] location     t: /!d; s/^\[info\] location     t: //' \
176    i1/.fcm-make/log > "$TEST_KEY.log"
177file_cmp "$TEST_KEY.log" "$TEST_KEY.log" <<__LOG__
1780: $T_REPOS/trunk@2 (1)
1791: $T_REPOS/branch@2 (2)
180__LOG__
181#-------------------------------------------------------------------------------
182exit 0
Note: See TracBrowser for help on using the repository browser.