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.
46-archive-mode.t in vendors/t/fcm-make – NEMO

source: vendors/t/fcm-make/46-archive-mode.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.9 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 --archive"
21#-------------------------------------------------------------------------------
22. "$(dirname "$0")/test_header"
23
24file_cmp_sorted() {
25    sort - >"${1}.expected"
26    file_cmp "$1" "${2}" "${1}.expected"
27}
28
29tests 11
30#-------------------------------------------------------------------------------
31# Create a repository to extract
32svnadmin create 'repos'
33T_REPOS="file://${PWD}/repos"
34mkdir 't'
35cat >'t/hello.f90' <<'__FORTRAN__'
36program hello
37use world_mod, only: world
38write(*, '(a,1x,a)') 'Hello', world
39end program hello
40__FORTRAN__
41cat >'t/world_mod.f90' <<'__FORTRAN__'
42module world_mod
43character(*), parameter :: world = 'Earth'
44end module world_mod
45__FORTRAN__
46svn import --no-auth-cache -q -m'Test' t "${T_REPOS}/hello/trunk"
47rm -r 't'
48
49# Create a fcm-make.cfg to do some extract and build
50cat >'fcm-make.cfg' <<__CFG__
51steps = extract build
52extract.ns = hello
53extract.location{primary}[hello] = ${T_REPOS}/hello
54build.target{task} = link
55build.prop{file-ext.bin} =
56__CFG__
57#-------------------------------------------------------------------------------
58TEST_KEY="${TEST_KEY_BASE}-on-new"
59run_pass "${TEST_KEY}" fcm make -a
60find '.fcm-make/cache' 'build' -type f | sort >"${TEST_KEY}.find"
61file_cmp_sorted "${TEST_KEY}.find" "${TEST_KEY}.find" <<'__FIND__'
62.fcm-make/cache/extract.tar.gz
63build/bin/hello
64build/include.tar.gz
65build/o.tar.gz
66__FIND__
67
68touch 'new'
69sleep 1
70
71TEST_KEY="${TEST_KEY_BASE}-on-incr"
72run_pass "${TEST_KEY}" fcm make -a
73find '.fcm-make/cache' 'build' -type f -newer 'new' \
74    | sort >"${TEST_KEY}.find.new"
75file_cmp_sorted "${TEST_KEY}.find.new" "${TEST_KEY}.find.new" <<'__FIND__'
76.fcm-make/cache/extract.tar.gz
77build/include.tar.gz
78build/o.tar.gz
79__FIND__
80find '.fcm-make/cache' 'build' -type f '!' -newer 'new' \
81    | sort >"${TEST_KEY}.find.old"
82file_cmp_sorted "${TEST_KEY}.find.old" "${TEST_KEY}.find.old" <<'__FIND__'
83build/bin/hello
84__FIND__
85
86TEST_KEY="${TEST_KEY_BASE}-on-incr-build-o"
87run_pass "${TEST_KEY}" \
88    fcm make -a 'build.prop{archive-ok-target-category}=o'
89find '.fcm-make/cache' 'build' -type f -newer 'new' \
90    | sort >"${TEST_KEY}.find.new"
91file_cmp_sorted "${TEST_KEY}.find.new" "${TEST_KEY}.find.new" <<'__FIND__'
92.fcm-make/cache/extract.tar.gz
93build/o.tar.gz
94__FIND__
95find '.fcm-make/cache' 'build' -type f '!' -newer 'new' \
96    | sort >"${TEST_KEY}.find.old"
97file_cmp_sorted "${TEST_KEY}.find.old" "${TEST_KEY}.find.old" <<'__FIND__'
98build/bin/hello
99build/include/world_mod.mod
100__FIND__
101
102run_pass "${TEST_KEY_BASE}-off" fcm make
103find '.fcm-make/cache' 'build' -type f -newer 'new' \
104    | sort >"${TEST_KEY}.find.new"
105file_cmp_sorted "${TEST_KEY}.find.new" "${TEST_KEY}.find.new" <'/dev/null'
106find '.fcm-make/cache' 'build' -type f '!' -newer 'new' \
107    | sort >"${TEST_KEY}.find.old"
108file_cmp_sorted "${TEST_KEY}.find.old" "${TEST_KEY}.find.old" <<'__FIND__'
109.fcm-make/cache/extract/hello/0/hello.f90
110.fcm-make/cache/extract/hello/0/world_mod.f90
111build/bin/hello
112build/include/world_mod.mod
113build/o/hello.o
114build/o/world_mod.o
115__FIND__
116#-------------------------------------------------------------------------------
117exit 0
Note: See TracBrowser for help on using the repository browser.