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.
01-build-link-opts.t in vendors/t/fcm-make – NEMO

source: vendors/t/fcm-make/01-build-link-opts.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.1 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 some linker options for "fcm make".
21#-------------------------------------------------------------------------------
22. "$(dirname "$0")/test_header"
23#-------------------------------------------------------------------------------
24tests 14
25cp -r "${TEST_SOURCE_DIR}/${TEST_KEY_BASE}/"* .
26PATH="${PWD}/bin:${PATH}"
27#-------------------------------------------------------------------------------
28TEST_KEY="${TEST_KEY_BASE}-ld-link-without-ar-new"
29run_pass "${TEST_KEY}" fcm make --new 'build.prop{link-without-ar}=true'
30find 'build' -type f | sort >"${TEST_KEY}.find"
31file_cmp "${TEST_KEY}.find" "${TEST_KEY}.find" <<'__OUT__'
32build/bin/hello.exe
33build/include/world.mod
34build/o/hello.o
35build/o/world.o
36__OUT__
37sed -n 's/^.*\(gfortran -obin.*\)$/\1/p' 'fcm-make.log' >"${TEST_KEY}.log.edited"
38file_cmp "${TEST_KEY}.log.edited" "${TEST_KEY}.log.edited" <<'__OUT__'
39gfortran -obin/hello.exe o/hello.o o/world.o
40__OUT__
41#-------------------------------------------------------------------------------
42TEST_KEY="$TEST_KEY_BASE-keep-lib-o-incr"
43fcm make -q --new
44echo 'build.prop{keep-lib-o} = true' >>fcm-make.cfg
45find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime.old"
46run_pass "$TEST_KEY" fcm make
47find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime"
48if cmp -s "$TEST_KEY.mtime.old" "$TEST_KEY.mtime"; then
49    fail "$TEST_KEY.mtime"
50else
51    pass "$TEST_KEY.mtime"
52fi
53file_grep "$TEST_KEY.mtime.grep" 'lib/libhello[.]a' "$TEST_KEY.mtime"
54sed -i '/hello[.]exe/d' "$TEST_KEY.mtime.old"
55sed -i '/libhello[.]a/d; /hello[.]exe/d' "$TEST_KEY.mtime"
56file_cmp "$TEST_KEY.mtime.old" "$TEST_KEY.mtime.old" "$TEST_KEY.mtime"
57#-------------------------------------------------------------------------------
58TEST_KEY="$TEST_KEY_BASE-keep-lib-o-new"
59# echo 'build.prop{keep-lib-o} = true' >>fcm-make.cfg # already done above
60run_pass "$TEST_KEY" fcm make --new
61find build -type f | sort >"$TEST_KEY.find"
62file_cmp "$TEST_KEY.find" "$TEST_KEY.find" <<'__OUT__'
63build/bin/hello.exe
64build/include/world.mod
65build/lib/libhello.a
66build/o/hello.o
67build/o/world.o
68__OUT__
69#-------------------------------------------------------------------------------
70TEST_KEY="$TEST_KEY_BASE-ld-incr"
71cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/fcm-make.cfg .
72fcm make -q --new
73find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime.old"
74echo 'build.prop{ld} = my-ld' >>fcm-make.cfg
75run_pass "$TEST_KEY" fcm make
76find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime"
77file_grep "$TEST_KEY.mtime.grep" 'build/my-ld[.]out' "$TEST_KEY.mtime"
78sed -i '/hello[.]exe/d' "$TEST_KEY.mtime.old"
79sed -i '/hello[.]exe/d; /my-ld[.]out/d' "$TEST_KEY.mtime"
80file_cmp "$TEST_KEY.mtime.old" "$TEST_KEY.mtime.old" "$TEST_KEY.mtime"
81#-------------------------------------------------------------------------------
82TEST_KEY="$TEST_KEY_BASE-ld-new"
83# echo 'build.prop{ld} = my-ld' >>fcm-make.cfg # already done above
84run_pass "$TEST_KEY" fcm make --new
85find build -type f | sort >"$TEST_KEY.find"
86file_cmp "$TEST_KEY.find" "$TEST_KEY.find" <<'__OUT__'
87build/bin/hello.exe
88build/include/world.mod
89build/my-ld.out
90build/o/hello.o
91build/o/world.o
92__OUT__
93#-------------------------------------------------------------------------------
94exit 0
Note: See TracBrowser for help on using the repository browser.