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.
47-build-target-modifier-ns.t in vendors/t/fcm-make – NEMO

source: vendors/t/fcm-make/47-build-target-modifier-ns.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.7 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# Test "fcm make", build.target{category} and build.target{task} with namespace.
21#-------------------------------------------------------------------------------
22. "$(dirname "$0")/test_header"
23#-------------------------------------------------------------------------------
24tests 12
25mkdir 'i0'
26cp -r "${TEST_SOURCE_DIR}/${TEST_KEY_BASE}/"* 'i0'
27#-------------------------------------------------------------------------------
28TEST_KEY="${TEST_KEY_BASE}"
29run_pass "${TEST_KEY}" fcm make -C 'i0'
30
31grep -F 'build.target{category}' 'i0/.fcm-make/config-on-success.cfg' \
32    >'edited-config-on-success.cfg'
33file_cmp "${TEST_KEY}-edited-config-on-success.cfg" \
34    'edited-config-on-success.cfg' <<'__CFG__'
35build.target{category}[hello] = bin
36__CFG__
37
38find 'i0/build' -type f | sort >'find-i0-build.out'
39file_cmp "${TEST_KEY}-find-i0-build.out" 'find-i0-build.out' <<'__FIND__'
40i0/build/bin/hello
41i0/build/o/hello.o
42__FIND__
43
44"${PWD}/i0/build/bin/hello" <<<'&world_nl /' >'hello.out'
45file_cmp "${TEST_KEY}-hello.out" 'hello.out' <<<'Hello World'
46#-------------------------------------------------------------------------------
47TEST_KEY="${TEST_KEY_BASE}-inherit"
48run_pass "${TEST_KEY}" fcm make -C 'i1' \
49    "use=${PWD}/i0" \
50    'build.target{category}[greet] = etc'
51
52grep -F 'build.target{category}' 'i1/.fcm-make/config-on-success.cfg' \
53    >'edited-config-on-success.cfg'
54file_cmp "${TEST_KEY}-edited-config-on-success.cfg" \
55    'edited-config-on-success.cfg' <<'__CFG__'
56build.target{category}[greet] = etc
57build.target{category}[hello] = bin
58__CFG__
59
60find 'i1/build' -type f | sort >'find-i1-build.out'
61file_cmp "${TEST_KEY}-find-i1-build.out" 'find-i1-build.out' <<'__FIND__'
62i1/build/bin/hello
63i1/build/etc/greet/.etc
64i1/build/etc/greet/world.nl
65__FIND__
66
67"${PWD}/i1/build/bin/hello" <'i1/build/etc/greet/world.nl' >'hello.out'
68file_cmp "${TEST_KEY}-hello.out" 'hello.out' <<<'Hello Earth'
69#-------------------------------------------------------------------------------
70TEST_KEY="${TEST_KEY_BASE}-inherit-incr"
71touch 'before'
72run_pass "${TEST_KEY}" fcm make -C 'i1' \
73    "use=${PWD}/i0" \
74    'build.target{category}[greet] = bin etc'
75
76grep -F 'build.target{category}' 'i1/.fcm-make/config-on-success.cfg' \
77    >'edited-config-on-success.cfg'
78file_cmp "${TEST_KEY}-edited-config-on-success.cfg" \
79    'edited-config-on-success.cfg' <<'__CFG__'
80build.target{category}[greet] = bin etc
81build.target{category}[hello] = bin
82__CFG__
83
84find 'i1/build' -type f -newer 'before' | sort >'find-i1-build.out'
85file_cmp "${TEST_KEY}-find-i1-build.out" 'find-i1-build.out' <<'__FIND__'
86i1/build/bin/greet
87i1/build/o/greet.o
88__FIND__
89
90"${PWD}/i1/build/bin/greet" <'i1/build/etc/greet/world.nl' >'greet.out'
91file_cmp "${TEST_KEY}-greet.out" 'greet.out' <<<'Greet Earth'
92#-------------------------------------------------------------------------------
93exit 0
Note: See TracBrowser for help on using the repository browser.