summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-08-22 13:22:59 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-09-07 17:32:20 +0100
commit6d7ad78dd405f3f1f21b905483f7b85a95b5b5b1 (patch)
tree45470a094608482aa7f0451f25fe0d9e4f25c545 /share
parentdd97ce7e9ddf146e70d0d7d966f001c64d8b03a5 (diff)
downloadsubplot-6d7ad78dd405f3f1f21b905483f7b85a95b5b5b1.tar.gz
share: Make runcmd.yaml properly polyglot and common
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'share')
-rw-r--r--share/common/lib/runcmd.yaml (renamed from share/rust/lib/runcmd.yaml)44
-rw-r--r--share/python/lib/runcmd.md2
-rw-r--r--share/python/lib/runcmd.py6
-rw-r--r--share/python/lib/runcmd.yaml135
4 files changed, 48 insertions, 139 deletions
diff --git a/share/rust/lib/runcmd.yaml b/share/common/lib/runcmd.yaml
index 1043876..bde2f69 100644
--- a/share/rust/lib/runcmd.yaml
+++ b/share/common/lib/runcmd.yaml
@@ -2,6 +2,8 @@
- given: helper script {script} for runcmd
impl:
+ python:
+ function: runcmd_helper_script
rust:
function: subplotlib::steplibrary::runcmd::helper_script
types:
@@ -9,30 +11,40 @@
- given: srcdir is in the PATH
impl:
+ python:
+ function: runcmd_helper_srcdir_path
rust:
function: subplotlib::steplibrary::runcmd::helper_srcdir_path
- when: I run (?P<argv0>\S+)(?P<args>.*)
regex: true
impl:
+ python:
+ function: runcmd_step
rust:
function: subplotlib::steplibrary::runcmd::run
- when: I run, in (?P<dirname>\S+), (?P<argv0>\S+)(?P<args>.*)
regex: true
impl:
+ python:
+ function: runcmd_step_in
rust:
function: subplotlib::steplibrary::runcmd::run_in
- when: I try to run (?P<argv0>\S+)(?P<args>.*)
regex: true
impl:
+ python:
+ function: runcmd_try_to_run
rust:
function: subplotlib::steplibrary::runcmd::try_to_run
- when: I try to run, in (?P<dirname>\S+), (?P<argv0>\S+)(?P<args>.*)
regex: true
impl:
+ python:
+ function: runcmd_try_to_run_in
rust:
function: subplotlib::steplibrary::runcmd::try_to_run_in
@@ -40,6 +52,8 @@
- then: exit code is {exit}
impl:
+ python:
+ function: runcmd_exit_code_is
rust:
function: subplotlib::steplibrary::runcmd::exit_code_is
types:
@@ -47,6 +61,8 @@
- then: exit code is not {exit}
impl:
+ python:
+ function: runcmd_exit_code_is_not
rust:
function: subplotlib::steplibrary::runcmd::exit_code_is_not
types:
@@ -54,11 +70,15 @@
- then: command is successful
impl:
+ python:
+ function: runcmd_exit_code_is_zero
rust:
function: subplotlib::steplibrary::runcmd::exit_code_is_zero
- then: command fails
impl:
+ python:
+ function: runcmd_exit_code_is_nonzero
rust:
function: subplotlib::steplibrary::runcmd::exit_code_is_nonzero
@@ -67,24 +87,32 @@
- then: stdout is exactly "(?P<text>.*)"
regex: true
impl:
+ python:
+ function: runcmd_stdout_is
rust:
function: subplotlib::steplibrary::runcmd::stdout_is
- then: 'stdout isn''t exactly "(?P<text>.*)"'
regex: true
impl:
+ python:
+ function: runcmd_stdout_isnt
rust:
function: subplotlib::steplibrary::runcmd::stdout_isnt
- then: stderr is exactly "(?P<text>.*)"
regex: true
impl:
+ python:
+ function: runcmd_stderr_is
rust:
function: subplotlib::steplibrary::runcmd::stderr_is
- then: 'stderr isn''t exactly "(?P<text>.*)"'
regex: true
impl:
+ python:
+ function: runcmd_stderr_isnt
rust:
function: subplotlib::steplibrary::runcmd::stderr_isnt
@@ -93,24 +121,32 @@
- then: stdout contains "(?P<text>.*)"
regex: true
impl:
+ python:
+ function: runcmd_stdout_contains
rust:
function: subplotlib::steplibrary::runcmd::stdout_contains
- then: 'stdout doesn''t contain "(?P<text>.*)"'
regex: true
impl:
+ python:
+ function: runcmd_stdout_doesnt_contain
rust:
function: subplotlib::steplibrary::runcmd::stdout_doesnt_contain
- then: stderr contains "(?P<text>.*)"
regex: true
impl:
+ python:
+ function: runcmd_stderr_contains
rust:
function: subplotlib::steplibrary::runcmd::stderr_contains
- then: 'stderr doesn''t contain "(?P<text>.*)"'
regex: true
impl:
+ python:
+ function: runcmd_stderr_doesnt_contain
rust:
function: subplotlib::steplibrary::runcmd::stderr_doesnt_contain
@@ -119,23 +155,31 @@
- then: stdout matches regex (?P<regex>.*)
regex: true
impl:
+ python:
+ function: runcmd_stdout_matches_regex
rust:
function: subplotlib::steplibrary::runcmd::stdout_matches_regex
- then: stdout doesn't match regex (?P<regex>.*)
regex: true
impl:
+ python:
+ function: runcmd_stdout_doesnt_match_regex
rust:
function: subplotlib::steplibrary::runcmd::stdout_doesnt_match_regex
- then: stderr matches regex (?P<regex>.*)
regex: true
impl:
+ python:
+ function: runcmd_stderr_matches_regex
rust:
function: subplotlib::steplibrary::runcmd::stderr_matches_regex
- then: stderr doesn't match regex (?P<regex>.*)
regex: true
impl:
+ python:
+ function: runcmd_stderr_doesnt_match_regex
rust:
function: subplotlib::steplibrary::runcmd::stderr_doesnt_match_regex
diff --git a/share/python/lib/runcmd.md b/share/python/lib/runcmd.md
index 5f99b2a..f28ec2a 100644
--- a/share/python/lib/runcmd.md
+++ b/share/python/lib/runcmd.md
@@ -204,7 +204,7 @@ title: Acceptance criteria for the lib/runcmd Subplot library
author: The Subplot project
template: python
bindings:
-- runcmd.yaml
+- lib/runcmd.yaml
- runcmd_test.yaml
- files.yaml
functions:
diff --git a/share/python/lib/runcmd.py b/share/python/lib/runcmd.py
index da6c3fd..c4a6a12 100644
--- a/share/python/lib/runcmd.py
+++ b/share/python/lib/runcmd.py
@@ -93,10 +93,10 @@ def runcmd_helper_srcdir_path(ctx):
# Step: This creates a helper script.
-def runcmd_helper_script(ctx, filename=None):
+def runcmd_helper_script(ctx, script=None):
get_file = globals()["get_file"]
- with open(filename, "wb") as f:
- f.write(get_file(filename))
+ with open(script, "wb") as f:
+ f.write(get_file(script))
#
diff --git a/share/python/lib/runcmd.yaml b/share/python/lib/runcmd.yaml
deleted file mode 100644
index a01cfac..0000000
--- a/share/python/lib/runcmd.yaml
+++ /dev/null
@@ -1,135 +0,0 @@
-# Steps to run commands.
-
-- given: helper script {filename} for runcmd
- impl:
- python:
- function: runcmd_helper_script
-
-- given: srcdir is in the PATH
- impl:
- python:
- function: runcmd_helper_srcdir_path
-
-- when: I run (?P<argv0>\S+)(?P<args>.*)
- regex: true
- impl:
- python:
- function: runcmd_step
-
-- when: I run, in (?P<dirname>\S+), (?P<argv0>\S+)(?P<args>.*)
- regex: true
- impl:
- python:
- function: runcmd_step_in
-
-- when: I try to run (?P<argv0>\S+)(?P<args>.*)
- regex: true
- impl:
- python:
- function: runcmd_try_to_run
-
-- when: I try to run, in (?P<dirname>\S+), (?P<argv0>\S+)(?P<args>.*)
- regex: true
- impl:
- python:
- function: runcmd_try_to_run_in
-
-# Steps to examine exit code of latest command.
-
-- then: exit code is {exit}
- impl:
- python:
- function: runcmd_exit_code_is
-
-- then: exit code is not {exit}
- impl:
- python:
- function: runcmd_exit_code_is_not
-
-- then: command is successful
- impl:
- python:
- function: runcmd_exit_code_is_zero
-
-- then: command fails
- impl:
- python:
- function: runcmd_exit_code_is_nonzero
-
-# Steps to examine stdout/stderr for exact content.
-
-- then: stdout is exactly "(?P<text>.*)"
- regex: true
- impl:
- python:
- function: runcmd_stdout_is
-
-- then: 'stdout isn''t exactly "(?P<text>.*)"'
- regex: true
- impl:
- python:
- function: runcmd_stdout_isnt
-
-- then: stderr is exactly "(?P<text>.*)"
- regex: true
- impl:
- python:
- function: runcmd_stderr_is
-
-- then: 'stderr isn''t exactly "(?P<text>.*)"'
- regex: true
- impl:
- python:
- function: runcmd_stderr_isnt
-
-# Steps to examine stdout/stderr for sub-strings.
-
-- then: stdout contains "(?P<text>.*)"
- regex: true
- impl:
- python:
- function: runcmd_stdout_contains
-
-- then: 'stdout doesn''t contain "(?P<text>.*)"'
- regex: true
- impl:
- python:
- function: runcmd_stdout_doesnt_contain
-
-- then: stderr contains "(?P<text>.*)"
- regex: true
- impl:
- python:
- function: runcmd_stderr_contains
-
-- then: 'stderr doesn''t contain "(?P<text>.*)"'
- regex: true
- impl:
- python:
- function: runcmd_stderr_doesnt_contain
-
-# Steps to match stdout/stderr against regular expressions.
-
-- then: stdout matches regex (?P<regex>.*)
- regex: true
- impl:
- python:
- function: runcmd_stdout_matches_regex
-
-- then: stdout doesn't match regex (?P<regex>.*)
- regex: true
- impl:
- python:
- function: runcmd_stdout_doesnt_match_regex
-
-- then: stderr matches regex (?P<regex>.*)
- regex: true
- impl:
- python:
- function: runcmd_stderr_matches_regex
-
-- then: stderr doesn't match regex (?P<regex>.*)
- regex: true
- impl:
- python:
- function: runcmd_stderr_doesnt_match_regex