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.
04-build-libs.t in vendors/t/fcm-make – NEMO

source: vendors/t/fcm-make/04-build-libs.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.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 for "fcm make", "build.prop{fc.lib-paths}" and "build.prop{fc.libs}".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23
24function get_linker_log() {
25    sed '/^\[info\] shell(0.*) gfortran/!d;
26         s/^\[info\] shell(0.*) //' .fcm-make/log
27}
28#-------------------------------------------------------------------------------
29tests 11
30set -e
31cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/* .
32gfortran -c src-lib/*
33mkdir -p greet/lib
34ar rs greet/lib/libgreet.a greet.o 2>/dev/null
35ar rs greet/lib/libearth.a earth.o 2>/dev/null
36ar rs greet/lib/libmoon.a moon.o 2>/dev/null
37rm *.o
38set +e
39#-------------------------------------------------------------------------------
40TEST_KEY="$TEST_KEY_BASE-control"
41run_fail "$TEST_KEY" fcm make
42#-------------------------------------------------------------------------------
43TEST_KEY="$TEST_KEY_BASE"
44FCM_TEST_FC_LIBS='greet earth' run_pass "$TEST_KEY" fcm make
45$PWD/build/bin/hello.exe >"$TEST_KEY.command.out"
46file_cmp "$TEST_KEY.command.out" "$TEST_KEY.command.out" <<<'Hello Earth'
47get_linker_log >"$TEST_KEY.gfortran.log"
48file_cmp "$TEST_KEY.gfortran.log" "$TEST_KEY.gfortran.log" <<__LOG__
49gfortran -obin/hello.exe o/hello.o -L$PWD/greet/lib -lgreet -learth
50__LOG__
51#-------------------------------------------------------------------------------
52TEST_KEY="$TEST_KEY_BASE-incr0"
53find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime.old"
54FCM_TEST_FC_LIBS='greet earth' run_pass "$TEST_KEY" fcm make
55find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime"
56file_cmp "$TEST_KEY.mtime" "$TEST_KEY.mtime.old" "$TEST_KEY.mtime"
57$PWD/build/bin/hello.exe >"$TEST_KEY.command.out"
58file_cmp "$TEST_KEY.command.out" "$TEST_KEY.command.out" <<<'Hello Earth'
59get_linker_log >"$TEST_KEY.gfortran.log"
60file_cmp "$TEST_KEY.gfortran.log" "$TEST_KEY.gfortran.log" </dev/null
61#-------------------------------------------------------------------------------
62TEST_KEY="$TEST_KEY_BASE-incr1"
63FCM_TEST_FC_LIBS='greet moon' run_pass "$TEST_KEY" fcm make
64$PWD/build/bin/hello.exe >"$TEST_KEY.command.out"
65file_cmp "$TEST_KEY.command.out" "$TEST_KEY.command.out" <<<'Hello Moon'
66get_linker_log >"$TEST_KEY.gfortran.log"
67file_cmp "$TEST_KEY.gfortran.log" "$TEST_KEY.gfortran.log" <<__LOG__
68gfortran -obin/hello.exe o/hello.o -L$PWD/greet/lib -lgreet -lmoon
69__LOG__
70#-------------------------------------------------------------------------------
71exit 0
Note: See TracBrowser for help on using the repository browser.