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.
44-ctx-name-inherit-compat.t in vendors/FCM-2017.10.0/t/fcm-make – NEMO

source: vendors/FCM-2017.10.0/t/fcm-make/44-ctx-name-inherit-compat.t @ 13688

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

Reimport latest FCM release

File size: 3.0 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", inherit, with context name, back compat.
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 '*/.fcm-make*/c*' ')' \
34        | sort
35}
36
37tests 2
38
39#-------------------------------------------------------------------------------
40mkdir -p 'hello/src'
41cat >'hello/fcm-make.cfg' <<'__CFG__'
42steps=build
43build.source=$HERE/src
44build.target{task}=link
45__CFG__
46cat >'hello/src/friend.f90' <<'__FORTRAN__'
47module friend
48character(*), parameter :: name = 'friend'
49end module friend
50__FORTRAN__
51cat >'hello/src/hello.f90' <<'__FORTRAN__'
52program hello
53use friend, only: name
54write(*, '(a,1x,a)') 'Hello', name
55end program hello
56__FORTRAN__
57
58fcm make -q -C "${PWD}/hello"
59
60# Remove "name" from make ctx to make it look like a make ctx generated from an
61# old version of "fcm make".
62gunzip "${PWD}/hello/.fcm-make/ctx.gz"
63perl - "${PWD}/hello/.fcm-make/ctx" <<'__PERL__'
64use Storable qw{nstore retrieve};
65my $m_ctx = retrieve($ARGV[0]);
66delete $m_ctx->{'name'};
67nstore($m_ctx, $ARGV[0]);
68__PERL__
69gzip "${PWD}/hello/.fcm-make/ctx"
70#-------------------------------------------------------------------------------
71mkdir -p 'greet/src'
72cat >'greet/fcm-make-friend.cfg' <<'__CFG__'
73use=$HERE/../hello
74name=-friend
75steps=build
76build.source=$HERE/src
77build.target{task}=link
78__CFG__
79cat >'greet/src/greet.f90' <<'__FORTRAN__'
80program greet
81use friend, only: name
82write(*, '(a,1x,a)') 'Greet', name
83end program greet
84__FORTRAN__
85
86run_pass "${TEST_KEY_BASE}" fcm make -C "${PWD}/greet" -n '-friend'
87(cd 'greet' && find_fcm_make_files) >"${TEST_KEY_BASE}.find"
88file_cmp_sorted "${TEST_KEY_BASE}.find" "${TEST_KEY_BASE}.find" <<'__FIND__'
89./.fcm-make-friend/config-as-parsed.cfg
90./.fcm-make-friend/config-on-success.cfg
91./.fcm-make-friend/ctx.gz
92./build/bin/greet.exe
93./build/bin/hello.exe
94./build/o/greet.o
95__FIND__
96#-------------------------------------------------------------------------------
97exit
Note: See TracBrowser for help on using the repository browser.