Debian Codegraph @

tests/f/cylc-combination-scripts/10-CYLC_WORKFLOW_SRC_DIR.t

raw
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_WORKFLOW_SRC_DIR.t` is set
20
21 . "$(dirname "$0")/test_header"
22
23 set_test_number 6
24
25 WORKFLOW_NAME="cylctb-x$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6)"
26
27 cat > flow.cylc <<__HERE__
28 #!jinja2
29 # TEST: {{ CYLC_WORKFLOW_SRC_DIR }}
30 [scheduler]
31 allow implicit tasks = true
32 [scheduling]
33 [[graph]]
34 R1 = foo
35 __HERE__
36
37 run_ok "${TEST_NAME_BASE}-view" cylc view -p .
38
39 named_grep_ok "src-path-in-view-p" "TEST: $PWD" \
40 "${TEST_NAME_BASE}-view.stdout"
41
42 # It starts playing:
43 run_ok "${TEST_NAME_BASE}-vip" \
44 cylc vip \
45 --pause \
46 --no-run-name \
47 --workflow-name "${WORKFLOW_NAME}"
48
49 # It can get CYLC_WORKFLOW_SRC_DIR
50 named_grep_ok "src-path-available" \
51 "TEST: $PWD" "${RUN_DIR}/${WORKFLOW_NAME}/log/config/flow-processed.cylc"
52
53 # It can be updated with Cylc VR
54 echo "[meta]" >> flow.cylc
55 run_ok "${TEST_NAME_BASE}-vr" \
56 cylc vr "${WORKFLOW_NAME}"
57 poll_grep "meta" "${RUN_DIR}/${WORKFLOW_NAME}/log/config/flow-processed.cylc"
58
59 # It can get CYLC_WORKFLOW_SRC_DIR
60 named_grep_ok "src-path-available" \
61 "TEST: $PWD" "${RUN_DIR}/${WORKFLOW_NAME}/log/config/flow-processed.cylc"
62
63 cylc stop "${WORKFLOW_NAME}"
64
65 purge "${WORKFLOW_NAME}"