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.
42-make-mirror-make2.t in vendors/t/fcm-make – NEMO

source: vendors/t/fcm-make/42-make-mirror-make2.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: 4.3 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 "fcm make" with mirror to same location, then "fcm make --name=2".
21#-------------------------------------------------------------------------------
22. "$(dirname "$0")/test_header"
23
24file_cmp_sorted() {
25    sort - >"${1}.expected"
26    file_cmp "$1" "${2}" "${1}.expected"
27}
28
29find_fcm_make_files() {
30    find . "$@" -type f \
31        '(' -path '*/build/*' -o \
32            -path '*/extract/*' -o \
33            -path '*/mirror/*' -o \
34            -path '*/.fcm-make*/c*' ')' \
35        | sort
36}
37
38tests 11
39
40mkdir -p 'src/hello'
41cat >'src/hello/hello.f90' <<'__FORTRAN__'
42program hello
43write(*, '(a)') 'Hello!'
44end program hello
45__FORTRAN__
46
47cat >'fcm-make.cfg' <<'__CFG__'
48steps=extract mirror
49extract.ns = hello
50extract.location[hello]=$HERE/src/hello
51mirror.target=$HERE
52mirror.prop{config-file.name}=2
53mirror.prop{config-file.steps}=build
54build.target{task}=link
55__CFG__
56
57#-------------------------------------------------------------------------------
58run_pass "${TEST_KEY_BASE}-1" fcm make
59find_fcm_make_files >"${TEST_KEY_BASE}-1.find.new"
60file_cmp_sorted \
61    "${TEST_KEY_BASE}-1.find.new" "${TEST_KEY_BASE}-1.find.new" <<'__FIND__'
62./.fcm-make/config-as-parsed.cfg
63./.fcm-make/config-on-success.cfg
64./.fcm-make/ctx.gz
65./extract/hello/hello.f90
66./mirror/fcm-make2.cfg
67./mirror/fcm-make2.cfg.orig
68__FIND__
69
70touch 'marker'
71sleep 1
72run_pass "${TEST_KEY_BASE}-2" fcm make -f fcm-make2.cfg
73find_fcm_make_files '!' -newer 'marker' >"${TEST_KEY_BASE}-2.find.old"
74file_cmp "${TEST_KEY_BASE}-2.find.old" \
75    "${TEST_KEY_BASE}-2.find.old" "${TEST_KEY_BASE}-1.find.new"
76find_fcm_make_files -newer 'marker' >"${TEST_KEY_BASE}-2.find.new"
77file_cmp_sorted \
78    "${TEST_KEY_BASE}-2.find.new" "${TEST_KEY_BASE}-2.find.new" <<'__FIND__'
79./.fcm-make2/config-as-parsed.cfg
80./.fcm-make2/config-on-success.cfg
81./.fcm-make2/ctx.gz
82./build/bin/hello.exe
83./build/o/hello.o
84__FIND__
85
86touch 'marker'
87sleep 1
88run_pass "${TEST_KEY_BASE}-1-incr" fcm make
89find_fcm_make_files '!' -newer 'marker' >"${TEST_KEY_BASE}-1-incr.find.old"
90file_cmp_sorted "${TEST_KEY_BASE}-1-incr.find.old" \
91    "${TEST_KEY_BASE}-1-incr.find.old" <<'__FIND__'
92./.fcm-make2/config-as-parsed.cfg
93./.fcm-make2/config-on-success.cfg
94./.fcm-make2/ctx.gz
95./build/bin/hello.exe
96./build/o/hello.o
97./extract/hello/hello.f90
98__FIND__
99find_fcm_make_files -newer 'marker' >"${TEST_KEY_BASE}-1-incr.find.new"
100file_cmp_sorted "${TEST_KEY_BASE}-1-incr.find.new" \
101    "${TEST_KEY_BASE}-1-incr.find.new" <<'__FIND__'
102./.fcm-make/config-as-parsed.cfg
103./.fcm-make/config-on-success.cfg
104./.fcm-make/ctx.gz
105./mirror/fcm-make2.cfg
106./mirror/fcm-make2.cfg.orig
107__FIND__
108
109touch 'marker'
110sleep 1
111run_pass "${TEST_KEY_BASE}-2-incr" fcm make -f fcm-make2.cfg
112find_fcm_make_files '!' -newer 'marker' >"${TEST_KEY_BASE}-2-incr.find.old"
113file_cmp_sorted "${TEST_KEY_BASE}-2-incr.find.old" \
114    "${TEST_KEY_BASE}-2-incr.find.old" <<'__FIND__'
115./.fcm-make/config-as-parsed.cfg
116./.fcm-make/config-on-success.cfg
117./.fcm-make/ctx.gz
118./build/bin/hello.exe
119./build/o/hello.o
120./extract/hello/hello.f90
121./mirror/fcm-make2.cfg
122./mirror/fcm-make2.cfg.orig
123__FIND__
124find_fcm_make_files -newer 'marker' >"${TEST_KEY_BASE}-2-incr.find.new"
125file_cmp_sorted "${TEST_KEY_BASE}-2-incr.find.new" \
126    "${TEST_KEY_BASE}-2-incr.find.new" <<'__FIND__'
127./.fcm-make2/config-as-parsed.cfg
128./.fcm-make2/config-on-success.cfg
129./.fcm-make2/ctx.gz
130__FIND__
131#-------------------------------------------------------------------------------
132exit
Note: See TracBrowser for help on using the repository browser.