[10672] | 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 "fcm make", build detects dependencies in OMP sentinels. |
---|
| 21 | #------------------------------------------------------------------------------- |
---|
| 22 | . $(dirname $0)/test_header |
---|
| 23 | #------------------------------------------------------------------------------- |
---|
| 24 | tests 16 |
---|
| 25 | cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/* . |
---|
| 26 | yes 6.0 | head -n 100 >"$TEST_KEY_BASE.exe.on.out" |
---|
| 27 | yes 1.0 | head -n 100 >"$TEST_KEY_BASE.exe.off.out" |
---|
| 28 | #------------------------------------------------------------------------------- |
---|
| 29 | TEST_KEY=$TEST_KEY_BASE-on # fc.flag-omp on in new mode |
---|
| 30 | run_pass "$TEST_KEY" fcm make |
---|
| 31 | grep ' !\$' fcm-make.log | sort >"$TEST_KEY.log.deps" |
---|
| 32 | sort >"${TEST_KEY}.log.deps.expected" <<'__LOG__' |
---|
| 33 | [info] -> ( include) !$i1.f90 |
---|
| 34 | [info] -> ( include) !$i2.f90 |
---|
| 35 | [info] -> ( f.module) !$m1 |
---|
| 36 | [info] -> ( f.module) !$m2 |
---|
| 37 | __LOG__ |
---|
| 38 | file_cmp "${TEST_KEY}.log.deps" \ |
---|
| 39 | "${TEST_KEY}.log.deps" "${TEST_KEY}.log.deps.expected" |
---|
| 40 | run_pass "$TEST_KEY.exe" $PWD/build/bin/p1.exe |
---|
| 41 | file_cmp "$TEST_KEY.exe.out" "$TEST_KEY_BASE.exe.on.out" "$TEST_KEY.exe.out" |
---|
| 42 | #------------------------------------------------------------------------------- |
---|
| 43 | TEST_KEY=$TEST_KEY_BASE-on-off # fc.flag-omp on->off in incremental mode |
---|
| 44 | echo 'build.prop{fc.flag-omp}=' >>fcm-make.cfg |
---|
| 45 | run_pass "$TEST_KEY" fcm make |
---|
| 46 | run_pass "$TEST_KEY.exe" $PWD/build/bin/p1.exe |
---|
| 47 | file_cmp "$TEST_KEY.exe.out" "$TEST_KEY_BASE.exe.off.out" "$TEST_KEY.exe.out" |
---|
| 48 | #------------------------------------------------------------------------------- |
---|
| 49 | TEST_KEY=$TEST_KEY_BASE-on-off-on # fc.flag-omp on->off->on in incremental mode |
---|
| 50 | echo 'build.prop{fc.flag-omp}=-fopenmp' >>fcm-make.cfg |
---|
| 51 | run_pass "$TEST_KEY" fcm make |
---|
| 52 | run_pass "$TEST_KEY.exe" $PWD/build/bin/p1.exe |
---|
| 53 | file_cmp "$TEST_KEY.exe.out" "$TEST_KEY_BASE.exe.on.out" "$TEST_KEY.exe.out" |
---|
| 54 | #------------------------------------------------------------------------------- |
---|
| 55 | TEST_KEY=$TEST_KEY_BASE-off # fc.flag-omp off in new mode |
---|
| 56 | cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/fcm-make.cfg . |
---|
| 57 | echo 'build.prop{fc.flag-omp}=' >>fcm-make.cfg |
---|
| 58 | run_pass "$TEST_KEY" fcm make --new |
---|
| 59 | run_pass "$TEST_KEY.exe" $PWD/build/bin/p1.exe |
---|
| 60 | file_cmp "$TEST_KEY.exe.out" "$TEST_KEY_BASE.exe.off.out" "$TEST_KEY.exe.out" |
---|
| 61 | #------------------------------------------------------------------------------- |
---|
| 62 | TEST_KEY=$TEST_KEY_BASE-off-on # fc.flag-omp off->on in incremental mode |
---|
| 63 | cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/fcm-make.cfg . |
---|
| 64 | run_pass "$TEST_KEY" fcm make |
---|
| 65 | run_pass "$TEST_KEY.exe" $PWD/build/bin/p1.exe |
---|
| 66 | file_cmp "$TEST_KEY.exe.out" "$TEST_KEY_BASE.exe.on.out" "$TEST_KEY.exe.out" |
---|
| 67 | #------------------------------------------------------------------------------- |
---|
| 68 | exit |
---|