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

source: vendors/t/fcm-make/43-ctx-name-inherit.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: 3.4 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.
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 5
38
39#-------------------------------------------------------------------------------
40mkdir -p 'hello/src'
41cat >'hello/fcm-make-friend.cfg' <<'__CFG__'
42name=-friend
43steps=build
44build.source=$HERE/src
45build.target{task}=link
46__CFG__
47cat >'hello/src/friend.f90' <<'__FORTRAN__'
48module friend
49character(*), parameter :: name = 'friend'
50end module friend
51__FORTRAN__
52cat >'hello/src/hello.f90' <<'__FORTRAN__'
53program hello
54use friend, only: name
55write(*, '(a,1x,a)') 'Hello', name
56end program hello
57__FORTRAN__
58
59run_pass "${TEST_KEY_BASE}-hello" fcm make -C "${PWD}/hello" -n '-friend'
60#-------------------------------------------------------------------------------
61mkdir -p 'greet/src'
62cat >'greet/fcm-make-friend.cfg' <<'__CFG__'
63use=$HERE/../hello
64name=-friend
65steps=build
66build.source=$HERE/src
67build.target{task}=link
68__CFG__
69cat >'greet/src/greet.f90' <<'__FORTRAN__'
70program greet
71use friend, only: name
72write(*, '(a,1x,a)') 'Greet', name
73end program greet
74__FORTRAN__
75
76run_pass "${TEST_KEY_BASE}-greet" fcm make -C "${PWD}/greet" -n '-friend'
77(cd 'greet' && find_fcm_make_files) >"${TEST_KEY_BASE}-greet.find"
78file_cmp_sorted \
79    "${TEST_KEY_BASE}-greet.find" "${TEST_KEY_BASE}-greet.find" <<'__FIND__'
80./.fcm-make-friend/config-as-parsed.cfg
81./.fcm-make-friend/config-on-success.cfg
82./.fcm-make-friend/ctx.gz
83./build/bin/greet.exe
84./build/bin/hello.exe
85./build/o/greet.o
86__FIND__
87#-------------------------------------------------------------------------------
88mkdir -p 'snub/src'
89cat >'snub/fcm-make-no-friend.cfg' <<'__CFG__'
90use=$HERE/../hello
91name=-no-friend
92steps=build
93build.source=$HERE/src
94build.target{task}=link
95__CFG__
96run_fail "${TEST_KEY_BASE}-snub" fcm make -C "${PWD}/snub" -n '-no-friend'
97sed -i '3q' "${TEST_KEY_BASE}-snub.err"  # 3 lines only
98file_cmp "${TEST_KEY_BASE}-snub.err" "${TEST_KEY_BASE}-snub.err" <<__ERR__
99[FAIL] use = ${PWD}/hello: incorrect value in declaration
100[FAIL] config-file=${PWD}/snub/fcm-make-no-friend.cfg:1
101[FAIL] ${PWD}/hello/.fcm-make/ctx.gz: cannot retrieve cache
102__ERR__
103#-------------------------------------------------------------------------------
104exit
Note: See TracBrowser for help on using the repository browser.