| 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 |
# Test cylc config |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
#------------------------------------------------------------------------------- |
| 21 |
set_test_number 19 |
| 22 |
#------------------------------------------------------------------------------- |
| 23 |
init_workflow "${TEST_NAME_BASE}" "${TEST_SOURCE_DIR}/${TEST_NAME_BASE}/flow.cylc" |
| 24 |
#------------------------------------------------------------------------------- |
| 25 |
TEST_NAME="${TEST_NAME_BASE}-all" |
| 26 |
run_ok "${TEST_NAME}" cylc config -d "${WORKFLOW_NAME}" |
| 27 |
mkdir tmp_src |
| 28 |
cp "${TEST_NAME}.stdout" tmp_src/flow.cylc |
| 29 |
run_ok "${TEST_NAME}-validate" cylc validate --check-circular ./tmp_src |
| 30 |
cmp_ok "${TEST_NAME}.stderr" <'/dev/null' |
| 31 |
rm -rf tmp_src |
| 32 |
#------------------------------------------------------------------------------- |
| 33 |
TEST_NAME="${TEST_NAME_BASE}-section1" |
| 34 |
run_ok "${TEST_NAME}" cylc config -d --item=[scheduling] "${WORKFLOW_NAME}" |
| 35 |
cmp_ok "${TEST_NAME}.stdout" "$TEST_SOURCE_DIR/${TEST_NAME_BASE}/section1.stdout" |
| 36 |
cmp_ok "${TEST_NAME}.stderr" - </dev/null |
| 37 |
#------------------------------------------------------------------------------- |
| 38 |
TEST_NAME="${TEST_NAME_BASE}-section1-section" |
| 39 |
run_ok "${TEST_NAME}" cylc config -d --item=[scheduling][graph] "${WORKFLOW_NAME}" |
| 40 |
cmp_ok "${TEST_NAME}.stdout" - <<__OUT__ |
| 41 |
R1 = OPS:finish-all => VAR |
| 42 |
__OUT__ |
| 43 |
cmp_ok "${TEST_NAME}.stderr" - </dev/null |
| 44 |
#------------------------------------------------------------------------------- |
| 45 |
TEST_NAME="${TEST_NAME_BASE}-section1-section-option" |
| 46 |
run_ok "${TEST_NAME}" \ |
| 47 |
cylc config -d --item=[scheduling][graph]R1 "${WORKFLOW_NAME}" |
| 48 |
cmp_ok "${TEST_NAME}.stdout" - <<__OUT__ |
| 49 |
OPS:finish-all => VAR |
| 50 |
__OUT__ |
| 51 |
cmp_ok "${TEST_NAME}.stderr" - </dev/null |
| 52 |
#------------------------------------------------------------------------------- |
| 53 |
TEST_NAME="${TEST_NAME_BASE}-section2" |
| 54 |
run_ok "${TEST_NAME}" cylc config -d --item=[runtime] "${WORKFLOW_NAME}" |
| 55 |
cmp_ok "${TEST_NAME}.stdout" "$TEST_SOURCE_DIR/${TEST_NAME_BASE}/section2.stdout" |
| 56 |
cmp_ok "${TEST_NAME}.stderr" - </dev/null |
| 57 |
#------------------------------------------------------------------------------- |
| 58 |
# Basic test that --print-hierarchy works |
| 59 |
TEST_NAME="${TEST_NAME_BASE}-hierarchy" |
| 60 |
run_ok "${TEST_NAME}-global" cylc config -d --print-hierarchy |
| 61 |
run_ok "${TEST_NAME}-all" cylc config -d --print-hierarchy "${WORKFLOW_NAME}" |
| 62 |
# The two should be same with last line of latter removed |
| 63 |
cmp_ok "${TEST_NAME}-global.stdout" <<< "$( sed '$d' "${TEST_NAME}-all.stdout" )" |
| 64 |
# The last line should be the workflow run dir |
| 65 |
sed '$!d' "${TEST_NAME}-all.stdout" > "flow_path.out" |
| 66 |
cmp_ok "flow_path.out" <<< "${WORKFLOW_RUN_DIR}/flow.cylc" |
| 67 |
|
| 68 |
purge |
| 69 |
exit |