diff --git a/cylc-remote-tests/Jinja2Filters/tests.py b/cylc-remote-tests/Jinja2Filters/tests.py new file mode 100644 index 0000000..4a61703 --- /dev/null +++ b/cylc-remote-tests/Jinja2Filters/tests.py @@ -0,0 +1,39 @@ +"""Filter provides a list of cylc tests for each job runner. + +Use thus: `{{ "" | tests }}` +""" + +BS_TESTS = """ +tests/functional/cylc-poll/06-loadleveler.t +tests/functional/cylc-poll/07-pbs.t +tests/functional/cylc-poll/08-slurm.t +tests/functional/cylc-poll/09-lsf.t +tests/functional/directives/00-loadleveler.t +tests/functional/directives/02-slurm.t +tests/functional/directives/03-pbs.t +tests/functional/execution-time-limit/02-slurm.t +tests/functional/execution-time-limit/03-pbs.t +tests/functional/job-kill/02-loadleveler.t +tests/functional/job-kill/03-slurm.t +tests/functional/job-kill/04-pbs.t +""".strip().split('\n') + + +def tests(group='slurm'): + # Tests: + # Remove / + # Remove leading tests/functional + # Remove trailing .t + # Add the word test because cylc is not an allowed task name start + sep = ', ' + tests = [] + for test in BS_TESTS: + if group in test: + tests.append(test) + tests = [ + f"test_{t.split('/')[2]}---{t.split('/')[3]}".replace('.t', '') + for t in tests + ] + + fin = sep.join(tests) + return fin diff --git a/cylc-remote-tests/README.md b/cylc-remote-tests/README.md new file mode 100644 index 0000000..0e6b367 --- /dev/null +++ b/cylc-remote-tests/README.md @@ -0,0 +1,6 @@ +Test Cylc Job Runner Specific tests + +Run Cylc tests which use job runners. +Options for Cylc commands +* `-z groups=slurm,pbs,lsf,loadleveler`. Defaults to slurm. +* `-s 'platform="spice"'`. Defaults to spice. diff --git a/cylc-remote-tests/bin/get-test-name b/cylc-remote-tests/bin/get-test-name new file mode 100755 index 0000000..3bf7368 --- /dev/null +++ b/cylc-remote-tests/bin/get-test-name @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import sys + +name = sys.argv[1] +path = name[5:].split('---') +path[1] += '.t' +print('/'.join(path)) + + diff --git a/cylc-remote-tests/etc/readmemaker.sh b/cylc-remote-tests/etc/readmemaker.sh new file mode 100755 index 0000000..9f84974 --- /dev/null +++ b/cylc-remote-tests/etc/readmemaker.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Create the readmefile + +cylc config . -i '[meta]title' > README.md +echo "" >> README.md +cylc config . -i '[meta]description' >> README.md \ No newline at end of file diff --git a/cylc-remote-tests/flow.cylc b/cylc-remote-tests/flow.cylc new file mode 100644 index 0000000..43c6c7e --- /dev/null +++ b/cylc-remote-tests/flow.cylc @@ -0,0 +1,62 @@ +#!jinja2 +{% if groups is not defined %} + {% set groups=["slurm"] %} +{% endif %} + +[meta] + title = Test Cylc Job Runner Specific tests + description = """ + Run Cylc tests which use job runners. + + Options for Cylc commands + + * `-z groups=slurm,pbs,lsf,loadleveler`. Defaults to slurm. + * `-s 'platform="spice"'`. Defaults to spice. + """ + created on = 2024-12-16T15 + +{% for group in groups %} +[task parameters] + {{group}}test = {{ group | tests }} + [[templates]] + {{group}}test = %({{group}}test)s +{% endfor %} + +[scheduling] + cycling mode = integer + [[graph]] +{% for group in groups %} + R1 = {{ group | upper }}:succeed-all => fin +{% endfor %} + +[runtime] +{% for group in groups %} + [[{{ group | upper }}]] +{% endfor %} + [[SLURM, PBS, LOADLEVELLER]] + [[TESTS]] + script = """ + micromamba activate cylc.dev + set -eux pipefail + CYLC_PATH="${HOME}/repos/cylc-flow" + TEST=${CYLC_PATH}/tests/functional/$(get-test-name ${CYLC_TASK_NAME}) + echo ${TEST} + ${CYLC_PATH}/etc/bin/run-functional-tests -vvv -p '*' ${TEST} + + if [[ $(grep NOTEST ${CYLC_TASK_LOG_ROOT}.out) ]]; then + echo "No test actually run" + cylc message -- "No test run" + exit 1 + fi + """ + platform = {{ platform | default("spice", true) }} + [[[outputs]]] + no_platform = "No test run" + +{% for group in groups %} + [[<{{group}}test>]] + inherit = {{ group | upper }}, TESTS +{% endfor %} + + [[fin]] +