diff --git a/lib/cylc/graph_parser.py b/lib/cylc/graph_parser.py index a704852dbfc..a7731bb6fb9 100644 --- a/lib/cylc/graph_parser.py +++ b/lib/cylc/graph_parser.py @@ -317,10 +317,13 @@ def _proc_dep_pair(self, left, right): n_info = [] expr = left for name, offset, trig in info: - offset = offset or '' if not trig: trig = self.__class__.TRIG_SUCCEED - this = r'\b%s\b%s(?!:)' % (name, re.escape(offset)) + if offset: + this = r'\b%s\b%s(?!:)' % (name, re.escape(offset)) + else: + this = r'\b%s\b(?![\[:])' % name + that = name + offset + trig expr = re.sub(this, that, expr) n_info.append((name, offset, trig)) diff --git a/tests/cylc-cat-log/06-log-rotation.t b/tests/cylc-cat-log/06-log-rotation.t index 743d403ca31..6b3e3eb6be7 100755 --- a/tests/cylc-cat-log/06-log-rotation.t +++ b/tests/cylc-cat-log/06-log-rotation.t @@ -15,37 +15,29 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . #------------------------------------------------------------------------------- -. $(dirname $0)/test_header -#------------------------------------------------------------------------------- -set_test_number 1 -#------------------------------------------------------------------------------- # Tests that cylc cat-log correctly handes log rotation. - -# Create dummy suite. -TMP_DIR=$(mktemp -d) -SUITE_NAME="$(basename ${TMP_DIR})-cat-log" -echo '' >> $TMP_DIR/suite.rc -cylc register ${SUITE_NAME} ${TMP_DIR} +. "$(dirname "$0")/test_header" +set_test_number 1 +init_suite "${TEST_NAME_BASE}" '/dev/null' # Populate its cylc-run dir with empty log files. -LOG_DIR=$(dirname $(cylc cat-log ${SUITE_NAME} -l)) -mkdir -p ${LOG_DIR} -touch $LOG_DIR/out.20000103T00Z -touch $LOG_DIR/out.20000102T00Z -touch $LOG_DIR/out.20000101T00Z -touch $LOG_DIR/out.0 # Back compatability to old log rotation system. -touch $LOG_DIR/out.1 -touch $LOG_DIR/out.2 +LOG_DIR="$(dirname "$(cylc cat-log "${SUITE_NAME}" -l)")" +mkdir -p "${LOG_DIR}" +# Note: .0 .1 .2: back compatability to old log rotation system +touch \ + "${LOG_DIR}/out.20000103T00Z" \ + "${LOG_DIR}/out.20000102T00Z" \ + "${LOG_DIR}/out.20000101T00Z" \ + "${LOG_DIR}/out.0" \ + "${LOG_DIR}/out.1" \ + "${LOG_DIR}/out.2" # Test log rotation. -cylc cat-log ${SUITE_NAME} -o -l -r 0 |xargs basename >> "$TMP_DIR/result" -cylc cat-log ${SUITE_NAME} -o -l -r 1 |xargs basename >> "$TMP_DIR/result" -cylc cat-log ${SUITE_NAME} -o -l -r 2 |xargs basename >> "$TMP_DIR/result" -cylc cat-log ${SUITE_NAME} -o -l -r 3 |xargs basename >> "$TMP_DIR/result" -cylc cat-log ${SUITE_NAME} -o -l -r 4 |xargs basename >> "$TMP_DIR/result" -cylc cat-log ${SUITE_NAME} -o -l -r 5 |xargs basename >> "$TMP_DIR/result" -cylc unregister ${SUITE_NAME} -cmp_ok "$TMP_DIR/result" <<__CMP__ +for I in {0..5}; do + basename "$(cylc cat-log "${SUITE_NAME}" -o -l -r "${I}")" +done >'result' + +cmp_ok 'result' <<'__CMP__' out.20000103T00Z out.20000102T00Z out.20000101T00Z @@ -53,10 +45,6 @@ out.0 out.1 out.2 __CMP__ -#------------------------------------------------------------------------------- -# Tidy up. -#rm -rf $TMP_DIR -#rm -rf $LOG_DIR -echo $TMP_DIR -echo $LOG_DIR -#------------------------------------------------------------------------------- + +purge_suite "${SUITE_NAME}" +exit diff --git a/tests/events/25-held-not-stalled/suite.rc b/tests/events/25-held-not-stalled/suite.rc index c6d3869fa4f..8c0c253a678 100644 --- a/tests/events/25-held-not-stalled/suite.rc +++ b/tests/events/25-held-not-stalled/suite.rc @@ -1,5 +1,6 @@ [cylc] [[events]] + abort on inactivity = False abort on stalled = True inactivity handler = cylc release '%(suite)s' inactivity = PT5S diff --git a/tests/validate/59-offset-no-offset.t b/tests/validate/59-offset-no-offset.t new file mode 100755 index 00000000000..7b861fa482e --- /dev/null +++ b/tests/validate/59-offset-no-offset.t @@ -0,0 +1,39 @@ +#!/bin/bash +# THIS FILE IS PART OF THE CYLC SUITE ENGINE. +# Copyright (C) 2008-2016 NIWA +# +# 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 . + +# GitHub PR #2002 - validation of "foo | foo[-P1D] => bar" was failing because +# the explicit ':succeed' trigger was being substituted before the offset +# instead of after, creating an invalid trigger expression. + +. "$(dirname "$0")/test_header" + +set_test_number 1 + +cat >'suite.rc' <<'__SUITE_RC__' +[scheduling] + initial cycle point = 2010 +[[dependencies]] + [[[P1D]]] + graph = foo | foo[-P1D] => bar +[runtime] + [[root]] + script = true +__SUITE_RC__ + +run_ok "${TEST_NAME_BASE}" cylc validate 'suite.rc' + +exit