| 1 |
#!/usr/bin/env bash |
| 2 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. |
| 3 |
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
#------------------------------------------------------------------------------ |
| 19 |
# Test rsync of workflow installation |
| 20 |
. "$(dirname "$0")/test_header" |
| 21 |
if ! command -v 'tree' >'/dev/null'; then |
| 22 |
skip_all '"tree" command not available' |
| 23 |
fi |
| 24 |
set_test_number 9 |
| 25 |
|
| 26 |
# Need to override any symlink dirs set in global.cylc: |
| 27 |
create_test_global_config "" " |
| 28 |
[install] |
| 29 |
[[symlink dirs]] |
| 30 |
[[[localhost]]] |
| 31 |
run = |
| 32 |
log = |
| 33 |
work = |
| 34 |
share = |
| 35 |
share/cycle = |
| 36 |
" |
| 37 |
|
| 38 |
# Test cylc install copies files to run dir successfully. |
| 39 |
TEST_NAME="${TEST_NAME_BASE}-basic" |
| 40 |
make_rnd_workflow |
| 41 |
pushd "${RND_WORKFLOW_SOURCE}" || exit 1 |
| 42 |
mkdir .git .svn dir1 dir2 |
| 43 |
touch .git/file1 .svn/file1 dir1/file1 dir2/file1 file1 file2 |
| 44 |
run_ok "${TEST_NAME}" cylc install --no-run-name |
| 45 |
|
| 46 |
# If rose-cylc plugin is installed add install files to tree. |
| 47 |
export ROSE_FILES='' |
| 48 |
|
| 49 |
tree -a -v -I '*.log|03-file-transfer*' --charset=ascii --noreport "${RND_WORKFLOW_RUNDIR}/" > 'basic-tree.out' |
| 50 |
|
| 51 |
cmp_ok 'basic-tree.out' <<__OUT__ |
| 52 |
${RND_WORKFLOW_RUNDIR}/ |
| 53 |
|-- _cylc-install |
| 54 |
| \`-- source -> ${RND_WORKFLOW_SOURCE} |
| 55 |
|-- dir1 |
| 56 |
| \`-- file1 |
| 57 |
|-- dir2 |
| 58 |
| \`-- file1 |
| 59 |
|-- file1 |
| 60 |
|-- file2 |
| 61 |
|-- flow.cylc |
| 62 |
\`-- log |
| 63 |
\`-- install |
| 64 |
__OUT__ |
| 65 |
|
| 66 |
contains_ok "${TEST_NAME}.stdout" <<__OUT__ |
| 67 |
INSTALLED $RND_WORKFLOW_NAME from ${RND_WORKFLOW_SOURCE} |
| 68 |
__OUT__ |
| 69 |
popd || exit 1 |
| 70 |
purge_rnd_workflow |
| 71 |
|
| 72 |
# Test cylc install copies files to run dir successfully, exluding files from |
| 73 |
# .cylcignore file. |
| 74 |
# Should work if we run "cylc install" from source dir or not (see GH #5066) |
| 75 |
for RUN_IN_SRC_DIR in true false; do |
| 76 |
TEST_NAME="${TEST_NAME_BASE}-cylcignore-${RUN_IN_SRC_DIR}" |
| 77 |
make_rnd_workflow |
| 78 |
pushd "${RND_WORKFLOW_SOURCE}" || exit 1 |
| 79 |
mkdir .git .svn dir1 dir2 extradir1 extradir2 |
| 80 |
touch .git/file1 .svn/file1 dir1/file1 dir2/file1 extradir1/file1 extradir2/file1 file1 file2 .cylcignore |
| 81 |
cat > .cylcignore <<__END__ |
| 82 |
dir* |
| 83 |
extradir* |
| 84 |
file2 |
| 85 |
__END__ |
| 86 |
|
| 87 |
if ${RUN_IN_SRC_DIR}; then |
| 88 |
run_ok "${TEST_NAME}" cylc install --no-run-name |
| 89 |
CWD="${PWD}" |
| 90 |
else |
| 91 |
DTMP=$(mktemp -d) |
| 92 |
pushd "${DTMP}" || exit 1 |
| 93 |
run_ok "${TEST_NAME}" cylc install --no-run-name "${RND_WORKFLOW_SOURCE}" |
| 94 |
CWD="${PWD}" |
| 95 |
popd || exit 1 |
| 96 |
fi |
| 97 |
|
| 98 |
OUT="cylc-ignore-tree-${RUN_IN_SRC_DIR}.out" |
| 99 |
tree -a -v -I '*.log|03-file-transfer*' --charset=ascii --noreport "${RND_WORKFLOW_RUNDIR}/" > "$OUT" |
| 100 |
|
| 101 |
cmp_ok "$OUT" <<__OUT__ |
| 102 |
${RND_WORKFLOW_RUNDIR}/ |
| 103 |
|-- _cylc-install |
| 104 |
| \`-- source -> ${RND_WORKFLOW_SOURCE} |
| 105 |
|-- file1 |
| 106 |
|-- flow.cylc |
| 107 |
\`-- log |
| 108 |
\`-- install |
| 109 |
__OUT__ |
| 110 |
|
| 111 |
contains_ok "${CWD}/${TEST_NAME}.stdout" <<__OUT__ |
| 112 |
INSTALLED $RND_WORKFLOW_NAME from ${RND_WORKFLOW_SOURCE} |
| 113 |
__OUT__ |
| 114 |
|
| 115 |
popd || exit 1 |
| 116 |
purge_rnd_workflow |
| 117 |
done |