Skip to content

Commit

Permalink
Add new func tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Sep 26, 2022
1 parent 8d09900 commit b581ab2
Show file tree
Hide file tree
Showing 15 changed files with 189 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/functional/alpha-omega/00-basic.t
Original file line number Diff line number Diff line change
@@ -0,0 1,30 @@
#!/usr/bin/env bash
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------

# Check basic separate triggering of alpha, omega, and main graphs.
. "$(dirname "$0")/test_header"
set_test_number 3

install_and_validate

reftest_run

graph_workflow "${WORKFLOW_NAME}" "${WORKFLOW_NAME}.graph"
cmp_ok "${WORKFLOW_NAME}.graph" "$TEST_SOURCE_DIR/${TEST_NAME_BASE}/reference.graph"

purge
1 change: 1 addition & 0 deletions tests/functional/alpha-omega/00-basic/.cylcignore
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
twat
12 changes: 12 additions & 0 deletions tests/functional/alpha-omega/00-basic/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 1,12 @@

[scheduling]
cycling mode = integer
final cycle point = 2
[[graph]]
alpha = "a => b"
omega = "x => y"
R1 = "foo => bar"
P1 = "bar => baz"
[runtime]
[[a, b, x, y]]
[[foo, bar, baz]]
13 changes: 13 additions & 0 deletions tests/functional/alpha-omega/00-basic/reference.graph
Original file line number Diff line number Diff line change
@@ -0,0 1,13 @@
edge "alpha/a" "alpha/b"
edge "1/bar" "1/baz"
edge "2/bar" "2/baz"
edge "1/foo" "1/bar"
graph
node "alpha/a" "a\nalpha"
node "alpha/b" "b\nalpha"
node "1/bar" "bar\n1"
node "2/bar" "bar\n2"
node "1/baz" "baz\n1"
node "2/baz" "baz\n2"
node "1/foo" "foo\n1"
stop
9 changes: 9 additions & 0 deletions tests/functional/alpha-omega/00-basic/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 1,9 @@
alpha/a -triggered off [] in flow 1
alpha/b -triggered off ['alpha/a'] in flow 1
1/foo -triggered off [] in flow 2
2/bar -triggered off [] in flow 2
1/bar -triggered off ['1/foo'] in flow 2
2/baz -triggered off ['2/bar'] in flow 2
1/baz -triggered off ['1/bar'] in flow 2
omega/x -triggered off [] in flow 3
omega/y -triggered off ['omega/x'] in flow 3
34 changes: 34 additions & 0 deletions tests/functional/alpha-omega/01-restart.t
Original file line number Diff line number Diff line change
@@ -0,0 1,34 @@
#!/usr/bin/env bash
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------

# Check restart in alpha, maind, and omega graphs.

. "$(dirname "$0")/test_header"
set_test_number 5

install_and_validate

SRC_DIR="$TEST_SOURCE_DIR/${TEST_NAME_BASE}"
RUN_DIR="$WORKFLOW_RUN_DIR"

for RUN in 1 2 3 4; do
cp "${SRC_DIR}/reference.log.$RUN" "${RUN_DIR}/reference.log"
reftest_run "${TEST_NAME_BASE}-${RUN}"
done

purge
23 changes: 23 additions & 0 deletions tests/functional/alpha-omega/01-restart/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 1,23 @@
[scheduling]
cycling mode = integer
final cycle point = 2
[[graph]]
alpha = "a => b"
omega = "x => y"
R1 = "foo => bar"
P1 = "bar[-P1] => bar => baz"
[runtime]
[[a]]
script = cylc stop $CYLC_WORKFLOW_ID
[[b]]
[[x]]
script = cylc stop $CYLC_WORKFLOW_ID
[[y]]
[[foo]]
[[bar]]
script = """
if ((CYLC_TASK_CYCLE_POINT == 1)); then
cylc stop $CYLC_WORKFLOW_ID
fi
"""
[[baz]]
1 change: 1 addition & 0 deletions tests/functional/alpha-omega/01-restart/reference.log.1
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
alpha/a -triggered off [] in flow 1
3 changes: 3 additions & 0 deletions tests/functional/alpha-omega/01-restart/reference.log.2
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
alpha/b -triggered off ['alpha/a'] in flow 1
1/foo -triggered off [] in flow 2
1/bar -triggered off ['0/bar', '1/foo'] in flow 2
4 changes: 4 additions & 0 deletions tests/functional/alpha-omega/01-restart/reference.log.3
Original file line number Diff line number Diff line change
@@ -0,0 1,4 @@
1/baz -triggered off ['1/bar'] in flow 2
2/bar -triggered off ['1/bar'] in flow 2
2/baz -triggered off ['2/bar'] in flow 2
omega/x -triggered off [] in flow 3
1 change: 1 addition & 0 deletions tests/functional/alpha-omega/01-restart/reference.log.4
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
omega/y -triggered off ['omega/x'] in flow 3
24 changes: 24 additions & 0 deletions tests/functional/alpha-omega/02-retrigger.t
Original file line number Diff line number Diff line change
@@ -0,0 1,24 @@
#!/usr/bin/env bash
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------

# Check manual triggering of alpha and omega graph tasks.

. "$(dirname "$0")/test_header"
set_test_number 2
reftest
exit
24 changes: 24 additions & 0 deletions tests/functional/alpha-omega/02-retrigger/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 1,24 @@

# 1. alpha graph completes
# 2. then main graph starts, and triggers alpha/a and omega/x with --flow=none
# 3. then when all tasks finish, omega graph runs

# TODO alpha and omega graphs need special flow number treatment?

[scheduling]
[[graph]]
alpha = "a => b"
omega = "x => y"
R1 = "foo => bar => baz"
[runtime]
[[a]]
[[b]]
[[x]]
[[y]]
[[foo]]
[[bar]]
script = """
cylc trigger --flow=none $CYLC_WORKFLOW_ID//alpha/a
cylc trigger --flow=none $CYLC_WORKFLOW_ID//omega/x
"""
[[baz]]
9 changes: 9 additions & 0 deletions tests/functional/alpha-omega/02-retrigger/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 1,9 @@
alpha/a -triggered off [] in flow 1
alpha/b -triggered off ['alpha/a'] in flow 1
1/foo -triggered off [] in flow 2
1/bar -triggered off ['1/foo'] in flow 2
alpha/a -triggered off [] in flow none
omega/x -triggered off [] in flow none
1/baz -triggered off ['1/bar'] in flow 2
omega/x -triggered off [] in flow 3
omega/y -triggered off ['omega/x'] in flow 3
1 change: 1 addition & 0 deletions tests/functional/alpha-omega/test_header

0 comments on commit b581ab2

Please sign in to comment.