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.
48-build-sha1.t in vendors/t/fcm-make – NEMO

source: vendors/t/fcm-make/48-build-sha1.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: 2.8 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, using SHA1 checksum to determine changes.
21#-------------------------------------------------------------------------------
22. "$(dirname "$0")/test_header"
23
24get-hello-checksum() {
25    PERL5LIB="${FCM_HOME}/lib" perl - <<'__PERL__'
26use strict;
27use warnings;
28use IO::Uncompress::Gunzip qw{gunzip};
29use Storable;
30gunzip('.fcm-make/ctx.gz', 'ctx');
31my $m_ctx = retrieve('ctx');
32printf(
33    "%s  %s\n",
34    $m_ctx->{'ctx_of'}{'build'}{'source_of'}{'hello.f90'}{'checksum'},
35    'src/hello.f90',
36);
37unlink('ctx')
38__PERL__
39}
40#-------------------------------------------------------------------------------
41tests 8
42cp -r "${TEST_SOURCE_DIR}/${TEST_KEY_BASE}/"* .
43#-------------------------------------------------------------------------------
44TEST_KEY="${TEST_KEY_BASE}"
45run_pass "${TEST_KEY}" fcm make
46run_pass "${TEST_KEY}-sha1sum-check" sha1sum -c - <<<"$(get-hello-checksum)"
47HELLO_O_MTIME="$(stat -c '%Y' 'build/o/hello.o')"
48#-------------------------------------------------------------------------------
49TEST_KEY="${TEST_KEY_BASE}-incr"
50run_pass "${TEST_KEY}" fcm make
51run_pass "${TEST_KEY}-sha1sum-check" sha1sum -c - <<<"$(get-hello-checksum)"
52HELLO_O_MTIME_INCR="$(stat -c '%Y' 'build/o/hello.o')"
53run_pass "${TEST_KEY}-mtime-of-hello.o" \
54    test "${HELLO_O_MTIME_INCR}" -eq "${HELLO_O_MTIME}"
55#-------------------------------------------------------------------------------
56TEST_KEY="${TEST_KEY_BASE}-incr-2"
57sed -i 's/Hello/Greet/' 'src/hello.f90'
58sleep 1  # In case computer is very fast, when everything can happen within 1s.
59run_pass "${TEST_KEY}" fcm make
60run_pass "${TEST_KEY}-sha1sum-check" sha1sum -c - <<<"$(get-hello-checksum)"
61HELLO_O_MTIME_INCR="$(stat -c '%Y' 'build/o/hello.o')"
62run_pass "${TEST_KEY}-mtime-of-hello.o" \
63    test "${HELLO_O_MTIME_INCR}" -gt "${HELLO_O_MTIME}"
64#-------------------------------------------------------------------------------
65exit 0
Note: See TracBrowser for help on using the repository browser.