| 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 the export of CYLC_WORKFLOW_ID and CYLC_WORKFLOW_ID |
| 20 |
|
| 21 |
. "$(dirname "$0")/test_header" |
| 22 |
|
| 23 |
set_test_number 4 |
| 24 |
|
| 25 |
create_test_global_config '' " |
| 26 |
[install] |
| 27 |
max depth = 5 |
| 28 |
" |
| 29 |
|
| 30 |
cat > flow.cylc <<'__FLOW_CONFIG__' |
| 31 |
[scheduler] |
| 32 |
cycle point format = %Y |
| 33 |
[[events]] |
| 34 |
stall timeout = PT0S |
| 35 |
|
| 36 |
[scheduling] |
| 37 |
initial cycle point = 1066 |
| 38 |
|
| 39 |
[[dependencies]] |
| 40 |
R1 = foo |
| 41 |
|
| 42 |
[runtime] |
| 43 |
[[foo]] |
| 44 |
script = """ |
| 45 |
echo "CYLC_WORKFLOW_ID is: ${CYLC_WORKFLOW_ID}" |
| 46 |
echo "CYLC_WORKFLOW_ID is: ${CYLC_WORKFLOW_ID}" |
| 47 |
""" |
| 48 |
__FLOW_CONFIG__ |
| 49 |
|
| 50 |
init_workflow "${TEST_NAME_BASE}" flow.cylc true |
| 51 |
|
| 52 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 53 |
workflow_run_ok "${TEST_NAME_BASE}-play" cylc play "${WORKFLOW_NAME}" --no-detach |
| 54 |
named_grep_ok \ |
| 55 |
"${TEST_NAME_BASE}-check-CYLC_WORKFLOW_ID" \ |
| 56 |
"CYLC_WORKFLOW_ID is:.* ${WORKFLOW_NAME}" \ |
| 57 |
"${WORKFLOW_RUN_DIR}/runN/log/job/1066/foo/NN/job.out" |
| 58 |
named_grep_ok \ |
| 59 |
"${TEST_NAME_BASE}-check-CYLC_WORKFLOW_ID" \ |
| 60 |
"CYLC_WORKFLOW_ID is:.* ${WORKFLOW_NAME}/run1" \ |
| 61 |
"${WORKFLOW_RUN_DIR}/runN/log/job/1066/foo/NN/job.out" |