From b581ab2f8c75674f3a50b7315e703da6f4cc4d8a Mon Sep 17 00:00:00 2001 From: Hilary James Oliver Date: Mon, 26 Sep 2022 23:26:33 +1300 Subject: [PATCH] Add new func tests. --- tests/functional/alpha-omega/00-basic.t | 30 ++++++++++++++++ .../alpha-omega/00-basic/.cylcignore | 1 + .../functional/alpha-omega/00-basic/flow.cylc | 12 +++++++ .../alpha-omega/00-basic/reference.graph | 13 +++++++ .../alpha-omega/00-basic/reference.log | 9 +++++ tests/functional/alpha-omega/01-restart.t | 34 +++++++++++++++++++ .../alpha-omega/01-restart/flow.cylc | 23 +++++++++++++ .../alpha-omega/01-restart/reference.log.1 | 1 + .../alpha-omega/01-restart/reference.log.2 | 3 ++ .../alpha-omega/01-restart/reference.log.3 | 4 +++ .../alpha-omega/01-restart/reference.log.4 | 1 + tests/functional/alpha-omega/02-retrigger.t | 24 +++++++++++++ .../alpha-omega/02-retrigger/flow.cylc | 24 +++++++++++++ .../alpha-omega/02-retrigger/reference.log | 9 +++++ tests/functional/alpha-omega/test_header | 1 + 15 files changed, 189 insertions(+) create mode 100644 tests/functional/alpha-omega/00-basic.t create mode 100644 tests/functional/alpha-omega/00-basic/.cylcignore create mode 100644 tests/functional/alpha-omega/00-basic/flow.cylc create mode 100644 tests/functional/alpha-omega/00-basic/reference.graph create mode 100644 tests/functional/alpha-omega/00-basic/reference.log create mode 100644 tests/functional/alpha-omega/01-restart.t create mode 100644 tests/functional/alpha-omega/01-restart/flow.cylc create mode 100644 tests/functional/alpha-omega/01-restart/reference.log.1 create mode 100644 tests/functional/alpha-omega/01-restart/reference.log.2 create mode 100644 tests/functional/alpha-omega/01-restart/reference.log.3 create mode 100644 tests/functional/alpha-omega/01-restart/reference.log.4 create mode 100644 tests/functional/alpha-omega/02-retrigger.t create mode 100644 tests/functional/alpha-omega/02-retrigger/flow.cylc create mode 100644 tests/functional/alpha-omega/02-retrigger/reference.log create mode 120000 tests/functional/alpha-omega/test_header diff --git a/tests/functional/alpha-omega/00-basic.t b/tests/functional/alpha-omega/00-basic.t new file mode 100644 index 00000000000..c753503bf82 --- /dev/null +++ b/tests/functional/alpha-omega/00-basic.t @@ -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 . +#------------------------------------------------------------------------------- + +# 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 diff --git a/tests/functional/alpha-omega/00-basic/.cylcignore b/tests/functional/alpha-omega/00-basic/.cylcignore new file mode 100644 index 00000000000..6ded72ca000 --- /dev/null +++ b/tests/functional/alpha-omega/00-basic/.cylcignore @@ -0,0 +1 @@ +twat diff --git a/tests/functional/alpha-omega/00-basic/flow.cylc b/tests/functional/alpha-omega/00-basic/flow.cylc new file mode 100644 index 00000000000..6e3b45ff681 --- /dev/null +++ b/tests/functional/alpha-omega/00-basic/flow.cylc @@ -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]] diff --git a/tests/functional/alpha-omega/00-basic/reference.graph b/tests/functional/alpha-omega/00-basic/reference.graph new file mode 100644 index 00000000000..8bfc40edead --- /dev/null +++ b/tests/functional/alpha-omega/00-basic/reference.graph @@ -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 diff --git a/tests/functional/alpha-omega/00-basic/reference.log b/tests/functional/alpha-omega/00-basic/reference.log new file mode 100644 index 00000000000..5d44fb3261f --- /dev/null +++ b/tests/functional/alpha-omega/00-basic/reference.log @@ -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 diff --git a/tests/functional/alpha-omega/01-restart.t b/tests/functional/alpha-omega/01-restart.t new file mode 100644 index 00000000000..5a40023cb4d --- /dev/null +++ b/tests/functional/alpha-omega/01-restart.t @@ -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 . +#------------------------------------------------------------------------------- + +# 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 diff --git a/tests/functional/alpha-omega/01-restart/flow.cylc b/tests/functional/alpha-omega/01-restart/flow.cylc new file mode 100644 index 00000000000..2140de2eb37 --- /dev/null +++ b/tests/functional/alpha-omega/01-restart/flow.cylc @@ -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]] diff --git a/tests/functional/alpha-omega/01-restart/reference.log.1 b/tests/functional/alpha-omega/01-restart/reference.log.1 new file mode 100644 index 00000000000..7554e7516e0 --- /dev/null +++ b/tests/functional/alpha-omega/01-restart/reference.log.1 @@ -0,0 +1 @@ +alpha/a -triggered off [] in flow 1 diff --git a/tests/functional/alpha-omega/01-restart/reference.log.2 b/tests/functional/alpha-omega/01-restart/reference.log.2 new file mode 100644 index 00000000000..ae6c028f2fc --- /dev/null +++ b/tests/functional/alpha-omega/01-restart/reference.log.2 @@ -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 diff --git a/tests/functional/alpha-omega/01-restart/reference.log.3 b/tests/functional/alpha-omega/01-restart/reference.log.3 new file mode 100644 index 00000000000..cc9e663fd41 --- /dev/null +++ b/tests/functional/alpha-omega/01-restart/reference.log.3 @@ -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 diff --git a/tests/functional/alpha-omega/01-restart/reference.log.4 b/tests/functional/alpha-omega/01-restart/reference.log.4 new file mode 100644 index 00000000000..c47f0b3c77f --- /dev/null +++ b/tests/functional/alpha-omega/01-restart/reference.log.4 @@ -0,0 +1 @@ +omega/y -triggered off ['omega/x'] in flow 3 diff --git a/tests/functional/alpha-omega/02-retrigger.t b/tests/functional/alpha-omega/02-retrigger.t new file mode 100644 index 00000000000..1eecf2c5cbd --- /dev/null +++ b/tests/functional/alpha-omega/02-retrigger.t @@ -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 . +#------------------------------------------------------------------------------- + +# Check manual triggering of alpha and omega graph tasks. + +. "$(dirname "$0")/test_header" +set_test_number 2 +reftest +exit diff --git a/tests/functional/alpha-omega/02-retrigger/flow.cylc b/tests/functional/alpha-omega/02-retrigger/flow.cylc new file mode 100644 index 00000000000..7f1889a9f19 --- /dev/null +++ b/tests/functional/alpha-omega/02-retrigger/flow.cylc @@ -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]] diff --git a/tests/functional/alpha-omega/02-retrigger/reference.log b/tests/functional/alpha-omega/02-retrigger/reference.log new file mode 100644 index 00000000000..807771322ac --- /dev/null +++ b/tests/functional/alpha-omega/02-retrigger/reference.log @@ -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 diff --git a/tests/functional/alpha-omega/test_header b/tests/functional/alpha-omega/test_header new file mode 120000 index 00000000000..90bd5a36f92 --- /dev/null +++ b/tests/functional/alpha-omega/test_header @@ -0,0 +1 @@ +../lib/bash/test_header \ No newline at end of file