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.
00-build-basic.t in vendors/FCM-2017.10.0/t/fcm-make – NEMO

source: vendors/FCM-2017.10.0/t/fcm-make/00-build-basic.t @ 11668

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

Reimport latest FCM release

File size: 4.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# Basic tests for "fcm make".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23#-------------------------------------------------------------------------------
24tests 18
25cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/* .
26#-------------------------------------------------------------------------------
27TEST_KEY="$TEST_KEY_BASE"
28run_pass "$TEST_KEY" fcm make
29find .fcm-make build -type f | sed 's/^\(\.fcm-make\/log\).*$/\1/' \
30    | sort >"$TEST_KEY.find"
31sort >"${TEST_KEY}.find.expected" <<'__OUT__'
32.fcm-make/config-as-parsed.cfg
33.fcm-make/config-on-success.cfg
34.fcm-make/ctx.gz
35.fcm-make/log
36build/bin/hello.exe
37build/include/world.mod
38build/o/hello.o
39build/o/world.o
40__OUT__
41file_cmp "$TEST_KEY.find" "$TEST_KEY.find" "${TEST_KEY}.find.expected"
42file_test "$TEST_KEY.log" fcm-make.log
43file_test "$TEST_KEY.fcm-make-as-parsed.cfg" fcm-make-as-parsed.cfg
44file_test "$TEST_KEY.fcm-make-on-success.cfg" fcm-make-on-success.cfg
45readlink fcm-make.log >"$TEST_KEY.log.readlink"
46file_cmp "$TEST_KEY.log.readlink" "$TEST_KEY.log.readlink" <<<'.fcm-make/log'
47sed '/^\[info\] \(source->target\|target\|required-target\) /!d' \
48    .fcm-make/log >"$TEST_KEY.log.sed"
49file_cmp "$TEST_KEY.log.sed" "$TEST_KEY.log.sed" <<'__LOG__'
50[info] source->target / -> (archive) lib/ libo.a
51[info] source->target hello.f90 -> (link) bin/ hello.exe
52[info] source->target hello.f90 -> (install) include/ hello.f90
53[info] source->target hello.f90 -> (compile) o/ hello.o
54[info] source->target world.f90 -> (install) include/ world.f90
55[info] source->target world.f90 -> (compile+) include/ world.mod
56[info] source->target world.f90 -> (compile) o/ world.o
57[info] target hello.exe
58[info] target  - hello.o
59[info] target  -  - world.mod
60[info] target  -  -  - world.o
61[info] target  - world.o
62__LOG__
63file_test "$TEST_KEY-as-parsed.cfg" fcm-make-as-parsed.cfg
64readlink fcm-make-as-parsed.cfg >"$TEST_KEY-as-parsed.cfg.out"
65file_cmp "$TEST_KEY-as-parsed.cfg.out" "$TEST_KEY-as-parsed.cfg.out" \
66    <<<'.fcm-make/config-as-parsed.cfg'
67file_test "$TEST_KEY-on-success.cfg" fcm-make-on-success.cfg
68readlink fcm-make-on-success.cfg >"$TEST_KEY-on-success.cfg.out"
69file_cmp "$TEST_KEY-on-success.cfg.out" "$TEST_KEY-on-success.cfg.out" \
70    <<<'.fcm-make/config-on-success.cfg'
71run_pass "$TEST_KEY.exe" $PWD/build/bin/hello.exe
72file_cmp "$TEST_KEY.exe.out" "$TEST_KEY.exe.out" <<<'Hello Earth'
73#-------------------------------------------------------------------------------
74TEST_KEY="$TEST_KEY_BASE-incr"
75find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime.old"
76run_pass "$TEST_KEY" fcm make
77find build -type f -exec stat -c'%Y %n' {} \; | sort >"$TEST_KEY.mtime"
78file_cmp "$TEST_KEY.mtime" "$TEST_KEY.mtime.old" "$TEST_KEY.mtime"
79#-------------------------------------------------------------------------------
80TEST_KEY="$TEST_KEY_BASE-incr-fail"
81echo 'build.target=foo' >>fcm-make.cfg
82run_fail "$TEST_KEY" fcm make
83run_fail "$TEST_KEY.config-on-success" test -e .fcm-make/config-on-success
84run_fail "$TEST_KEY.fcm-make-on-success.cfg" test -e fcm-make-on-success.cfg
85#-------------------------------------------------------------------------------
86exit 0
Note: See TracBrowser for help on using the repository browser.