| 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 message" with multiple messages. |
| 20 |
|
| 21 |
export REQUIRE_PLATFORM='loc:* comms:?(tcp|ssh)' |
| 22 |
. "$(dirname "$0")/test_header" |
| 23 |
|
| 24 |
set_test_number 3 |
| 25 |
init_workflow "${TEST_NAME_BASE}" <<__FLOW__ |
| 26 |
[scheduling] |
| 27 |
[[graph]] |
| 28 |
R1 = foo |
| 29 |
[runtime] |
| 30 |
[[foo]] |
| 31 |
platform = $CYLC_TEST_PLATFORM |
| 32 |
script = """ |
| 33 |
cylc__job__wait_cylc_message_started |
| 34 |
cylc message -p WARNING "\${CYLC_WORKFLOW_ID}" "\${CYLC_TASK_JOB}" \ |
| 35 |
"Warn this" "INFO: Greeting" - <<'__MESSAGES__' |
| 36 |
Warn that |
| 37 |
|
| 38 |
DEBUG: Remove stuffs such as |
| 39 |
badness |
| 40 |
slowness |
| 41 |
and other incorrectness. |
| 42 |
|
| 43 |
CUSTOM: whatever |
| 44 |
__MESSAGES__ |
| 45 |
""" |
| 46 |
__FLOW__ |
| 47 |
|
| 48 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 49 |
workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 50 |
|
| 51 |
LOG="${WORKFLOW_RUN_DIR}/log/scheduler/log" |
| 52 |
sed -r -n -e 's/^.* ([A-Z]+ .* \(received\).*$)/\1/p' \ |
| 53 |
-e '/badness|slowness|and other incorrectness/p' \ |
| 54 |
"${LOG}" >'sed.out' |
| 55 |
sed -i 's/\(^.*\) at .*$/\1/;' 'sed.out' |
| 56 |
|
| 57 |
# Note: the continuation bit gets printed twice, because the message gets a |
| 58 |
# warning as being unhandled. |
| 59 |
cmp_ok 'sed.out' <<__LOG__ |
| 60 |
DEBUG - [1/foo/01:submitted] (received)started |
| 61 |
WARNING - [1/foo/01:running] (received)Warn this |
| 62 |
INFO - [1/foo/01:running] (received)Greeting |
| 63 |
WARNING - [1/foo/01:running] (received)Warn that |
| 64 |
DEBUG - [1/foo/01:running] (received)Remove stuffs such as |
| 65 |
${LOG_INDENT}badness |
| 66 |
${LOG_INDENT}slowness |
| 67 |
${LOG_INDENT}and other incorrectness. |
| 68 |
${LOG_INDENT}badness |
| 69 |
${LOG_INDENT}slowness |
| 70 |
${LOG_INDENT}and other incorrectness. |
| 71 |
INFO - [1/foo/01:running] (received)whatever |
| 72 |
DEBUG - [1/foo/01:running] (received)succeeded |
| 73 |
__LOG__ |
| 74 |
|
| 75 |
purge |
| 76 |
exit |