| 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 validation of a workflow with self-edges fails. |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
|
| 21 |
set_test_number 13 |
| 22 |
|
| 23 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 24 |
[scheduler] |
| 25 |
allow implicit tasks = True |
| 26 |
[scheduling] |
| 27 |
[[graph]] |
| 28 |
R1 = a => a |
| 29 |
__FLOW_CONFIG__ |
| 30 |
|
| 31 |
run_fail "${TEST_NAME_BASE}-simple-1" cylc validate . |
| 32 |
contains_ok "${TEST_NAME_BASE}-simple-1.stderr" <<'__ERR__' |
| 33 |
WorkflowConfigError: self-edge detected: a:succeeded => a |
| 34 |
__ERR__ |
| 35 |
|
| 36 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 37 |
[scheduler] |
| 38 |
allow implicit tasks = True |
| 39 |
[scheduling] |
| 40 |
[[graph]] |
| 41 |
R1 = a => b => c => d => a => z |
| 42 |
__FLOW_CONFIG__ |
| 43 |
|
| 44 |
run_fail "${TEST_NAME_BASE}-simple-2" cylc validate . |
| 45 |
contains_ok "${TEST_NAME_BASE}-simple-2.stderr" <<'__ERR__' |
| 46 |
WorkflowConfigError: circular edges detected: 1/d => 1/a 1/a => 1/b 1/b => 1/c 1/c => 1/d |
| 47 |
__ERR__ |
| 48 |
|
| 49 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 50 |
[scheduler] |
| 51 |
allow implicit tasks = True |
| 52 |
[scheduling] |
| 53 |
[[graph]] |
| 54 |
R1 = FAM:succeed-all => f & g => z |
| 55 |
[runtime] |
| 56 |
[[FAM]] |
| 57 |
[[f,g,h]] |
| 58 |
inherit = FAM |
| 59 |
__FLOW_CONFIG__ |
| 60 |
|
| 61 |
run_fail "${TEST_NAME_BASE}-simple-fam" cylc validate . |
| 62 |
contains_ok "${TEST_NAME_BASE}-simple-fam.stderr" <<'__ERR__' |
| 63 |
WorkflowConfigError: self-edge detected: f:succeeded => f |
| 64 |
__ERR__ |
| 65 |
|
| 66 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 67 |
[scheduler] |
| 68 |
allow implicit tasks = True |
| 69 |
cycle point format = %Y |
| 70 |
[scheduling] |
| 71 |
initial cycle point = 2001 |
| 72 |
final cycle point = 2010 |
| 73 |
[[graph]] |
| 74 |
P1Y = ''' |
| 75 |
a[-P1Y] => a |
| 76 |
a[+P1Y] => a |
| 77 |
''' |
| 78 |
__FLOW_CONFIG__ |
| 79 |
|
| 80 |
run_fail "${TEST_NAME_BASE}-intercycle-1" cylc validate . |
| 81 |
contains_ok "${TEST_NAME_BASE}-intercycle-1.stderr" <<'__ERR__' |
| 82 |
WorkflowConfigError: circular edges detected: 2002/a => 2001/a 2001/a => 2002/a 2003/a => 2002/a 2002/a => 2003/a |
| 83 |
__ERR__ |
| 84 |
|
| 85 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 86 |
[scheduler] |
| 87 |
allow implicit tasks = True |
| 88 |
[scheduling] |
| 89 |
cycling mode = integer |
| 90 |
initial cycle point = 1 |
| 91 |
[[graph]] |
| 92 |
2/P3 = foo => bar => baz |
| 93 |
8/P1 = baz => foo |
| 94 |
__FLOW_CONFIG__ |
| 95 |
|
| 96 |
run_fail "${TEST_NAME_BASE}-intercycle-2" cylc validate . |
| 97 |
contains_ok "${TEST_NAME_BASE}-intercycle-2.stderr" <<'__ERR__' |
| 98 |
WorkflowConfigError: circular edges detected: 8/foo => 8/bar 8/bar => 8/baz 8/baz => 8/foo |
| 99 |
__ERR__ |
| 100 |
|
| 101 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 102 |
[scheduler] |
| 103 |
allow implicit tasks = True |
| 104 |
[task parameters] |
| 105 |
foo = 1..5 |
| 106 |
[scheduling] |
| 107 |
[[graph]] |
| 108 |
R1 = """ |
| 109 |
fool<foo-1> => fool<foo> |
| 110 |
fool<foo=2> => fool<foo=1> |
| 111 |
""" |
| 112 |
__FLOW_CONFIG__ |
| 113 |
|
| 114 |
run_fail "${TEST_NAME_BASE}-param-1" cylc validate . |
| 115 |
contains_ok "${TEST_NAME_BASE}-param-1.stderr" <<'__ERR__' |
| 116 |
WorkflowConfigError: circular edges detected: 1/fool_foo2 => 1/fool_foo1 1/fool_foo1 => 1/fool_foo2 |
| 117 |
__ERR__ |
| 118 |
|
| 119 |
cat >'flow.cylc' <<'__FLOW_CONFIG__' |
| 120 |
[scheduler] |
| 121 |
allow implicit tasks = True |
| 122 |
[scheduling] |
| 123 |
cycling mode = integer |
| 124 |
initial cycle point = 1 |
| 125 |
[[graph]] |
| 126 |
1/P3 = foo => bar |
| 127 |
2/P3 = bar => foo |
| 128 |
__FLOW_CONFIG__ |
| 129 |
|
| 130 |
run_ok "${TEST_NAME_BASE}-param-2" cylc validate . |
| 131 |
|
| 132 |
exit |