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-env.t in vendors/t/fcm-cfg-print – NEMO

source: vendors/t/fcm-cfg-print/00-env.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.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# Configuration file load and dump. Test environment variable substitution
21# issues.
22#-------------------------------------------------------------------------------
23. "$(dirname "$0")/test_header"
24tests 15
25
26echo 'include=$FCM_WHATEVER' >'foo.cfg'
27echo >'bar.cfg'
28#-------------------------------------------------------------------------------
29TEST_KEY="${TEST_KEY_BASE}-undef"
30run_fail "${TEST_KEY}" fcm 'cfg-print' 'foo.cfg'
31file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <'/dev/null'
32file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <<__ERR__
33[FAIL] ${PWD}/foo.cfg:1: reference to undefined variable
34[FAIL] include =
35[FAIL] undef(\$FCM_WHATEVER)
36
37__ERR__
38#-------------------------------------------------------------------------------
39TEST_KEY="${TEST_KEY_BASE}-null"
40FCM_WHATEVER= run_pass "${TEST_KEY}" fcm 'cfg-print' 'foo.cfg'
41file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <'/dev/null'
42file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <'/dev/null'
43#-------------------------------------------------------------------------------
44TEST_KEY="${TEST_KEY_BASE}-bad-0"
45FCM_WHATEVER='0' run_fail "${TEST_KEY}" fcm 'cfg-print' 'foo.cfg'
46file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <'/dev/null'
47file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <<__ERR__
48[FAIL] config-file=${PWD}/foo.cfg:1
49[FAIL] ${PWD}/foo.cfg: cannot load config file
50[FAIL] include=0
51
52__ERR__
53#-------------------------------------------------------------------------------
54TEST_KEY="${TEST_KEY_BASE}-bad"
55FCM_WHATEVER='bad.cfg' run_fail "${TEST_KEY}" fcm 'cfg-print' 'foo.cfg'
56file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <'/dev/null'
57file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <<__ERR__
58[FAIL] config-file=${PWD}/foo.cfg:1
59[FAIL] ${PWD}/foo.cfg: cannot load config file
60[FAIL] include=bad.cfg
61
62__ERR__
63#-------------------------------------------------------------------------------
64TEST_KEY="${TEST_KEY_BASE}-good"
65FCM_WHATEVER='bar.cfg' run_pass "${TEST_KEY}" fcm 'cfg-print' 'foo.cfg'
66file_cmp "${TEST_KEY}.out" "${TEST_KEY}.out" <'/dev/null'
67file_cmp "${TEST_KEY}.err" "${TEST_KEY}.err" <'/dev/null'
68#-------------------------------------------------------------------------------
69exit 0
Note: See TracBrowser for help on using the repository browser.