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 `cylc vip` (Validate Install Play)
20+
21+ . " $( dirname " $0 " ) /test_header"
22+
23+ CYLC_ROSE=$( python -c " " "
24+ try:
25+ import cylc.rose
26+ print('true')
27+ except:
28+ print('false')
29+ " " " )
30+
31+ set_test_number 7
32+
33+ WORKFLOW_NAME=" cylctb-x$( < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6) "
34+
35+ cat > flow.cylc << __HERE__
36+ #!jinja2
37+ # TEST: {{ CYLC_SOURCE_DIRECTORY }}
38+ [scheduler]
39+ allow implicit tasks = true
40+ [scheduling]
41+ [[graph]]
42+ R1 = foo
43+ __HERE__
44+
45+ # It starts playing:
46+ run_ok " ${TEST_NAME_BASE} -vip" \
47+ cylc vip \
48+ --pause \
49+ --no-run-name \
50+ --workflow-name ${WORKFLOW_NAME}
51+
52+ # It can get CYLC_SOURCE_DIRECTORY
53+ grep_ok " $PWD " " ${RUN_DIR} /${WORKFLOW_NAME} /log/config/flow-processed.cylc"
54+
55+ # It can be updated with Cylc VR
56+ echo " [meta]" >> flow.cylc
57+ run_ok " ${TEST_NAME_BASE} -vr" \
58+ cylc vr ${WORKFLOW_NAME}
59+ poll_grep " meta" " ${RUN_DIR} /${WORKFLOW_NAME} /log/config/flow-processed.cylc"
60+
61+ # It can get CYLC_SOURCE_DIRECTORY
62+ grep_ok " $PWD " " ${RUN_DIR} /${WORKFLOW_NAME} /log/config/flow-processed.cylc"
63+
64+ purge " ${WORKFLOW_NAME} "
65+
66+ # If we have Cylc Rose installed, check that Rose Stem workflows
67+ # Also have access to WORKFLOW_SOURCE_DIR
68+ if [[ " $CYLC_ROSE " == ' false' ]]; then
69+ skip 3 " Install cylc-rose to run this test."
70+ exit 0
71+ else
72+ WORKFLOW_NAME=" cylctb-x$( < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6) "
73+ mkdir rose-stem
74+ mv flow.cylc rose-stem/flow.cylc
75+ echo " ROSE_STEM_VERSION=1" > rose-stem/rose-suite.conf
76+ fi
77+
78+ run_ok " ${TEST_NAME_BASE} -rose-stem" \
79+ rose stem \
80+ --source=${WORKFLOW_NAME} =${PWD} \
81+ --workflow-name ${WORKFLOW_NAME} \
82+ --no-run-name
83+ run_ok " ${TEST_NAME_BASE} -run-rose-stem" \
84+ cylc play " ${WORKFLOW_NAME} " --no-detach
85+ grep_ok " $PWD " " ${RUN_DIR} /${WORKFLOW_NAME} /log/config/flow-processed.cylc"
86+
87+ purge " ${WORKFLOW_NAME} "
88+
89+ exit 0
0 commit comments