summaryrefslogtreecommitdiff
path: root/share/common/lib/runcmd.yaml
blob: b20eac88fc9df5bf523c09f29298677e52833348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# Bindings for the runcmd steplibrary

- given: helper script {script} for runcmd
  impl:
    python:
      function: runcmd_helper_script
    rust:
      function: subplotlib::steplibrary::runcmd::helper_script
  types:
    script: file
  doc: |
    Install a helper script from an embedded file.

- given: srcdir is in the PATH
  impl:
    python:
      function: runcmd_helper_srcdir_path
    rust:
      function: subplotlib::steplibrary::runcmd::helper_srcdir_path
  doc: |
    Make sure the source directory of the project being testes is on
    the shell PATH. This makes it easy for tests to invoke programs
    from the source tree.

- when: I run {argv0}{args:text}
  impl:
    python:
      function: runcmd_step
    rust:
      function: subplotlib::steplibrary::runcmd::run
  doc: |
    Run a program, and make sure it succeeds.

- when: I run, in {dirname}, {argv0}{args}
  impl:
    python:
      function: runcmd_step_in
    rust:
      function: subplotlib::steplibrary::runcmd::run_in
  types:
    dirname: path
    argv0: word
    args: text
  doc: |
    Change to a different directory and run a program, and make sure
    it succeeds;

- when: I try to run {argv0}{args:text}
  impl:
    python:
      function: runcmd_try_to_run
    rust:
      function: subplotlib::steplibrary::runcmd::try_to_run
  doc: |
    Run a program, but allow it to fail. Other steps can check if it
    succeeded.

- when: I try to run, in {dirname}, {argv0}{args}
  impl:
    python:
      function: runcmd_try_to_run_in
    rust:
      function: subplotlib::steplibrary::runcmd::try_to_run_in
  types:
    dirname: path
    argv0: word
    args: text
  doc: |
    Change to a different directory and run a program, but allow it to
    fail. Other steps can check if it succeeded.

# Steps to examine exit code of latest command.

- then: exit code is {exit}
  impl:
    python:
      function: runcmd_exit_code_is
    rust:
      function: subplotlib::steplibrary::runcmd::exit_code_is
  types:
    exit: int
  doc: |
    Make sure the latest command run by `lib/runcmd` had a specific
    exit code.

- then: exit code is not {exit}
  impl:
    python:
      function: runcmd_exit_code_is_not
    rust:
      function: subplotlib::steplibrary::runcmd::exit_code_is_not
  types:
    exit: int
  doc: |
    Make sure the latest command run by `lib/runcmd` did not have a
    specific exit code.

- then: command is successful
  impl:
    python:
      function: runcmd_exit_code_is_zero
    rust:
      function: subplotlib::steplibrary::runcmd::exit_code_is_zero
  doc: |
    Make sure the latest command run by `lib/runcmd` indicated the
    command succeeded.

- then: command fails
  impl:
    python:
      function: runcmd_exit_code_is_nonzero
    rust:
      function: subplotlib::steplibrary::runcmd::exit_code_is_nonzero
  doc: |
    Make sure the latest command run by `lib/runcmd` indicated the
    command failed.

# Steps to examine stdout/stderr for exact content.

- then: stdout is exactly "{text:text}"
  impl:
    python:
      function: runcmd_stdout_is
    rust:
      function: subplotlib::steplibrary::runcmd::stdout_is
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` is exactly as desired.

- then: 'stdout isn''t exactly "{text:text}"'
  impl:
    python:
      function: runcmd_stdout_isnt
    rust:
      function: subplotlib::steplibrary::runcmd::stdout_isnt
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` is different from what is not wanted.

- then: stderr is exactly "{text:text}"
  impl:
    python:
      function: runcmd_stderr_is
    rust:
      function: subplotlib::steplibrary::runcmd::stderr_is
  doc: |
    Make sure the standard error output of the latest command run by
    `lib/runcmd` is exactly as desired.

- then: 'stderr isn''t exactly "{text:text}"'
  impl:
    python:
      function: runcmd_stderr_isnt
    rust:
      function: subplotlib::steplibrary::runcmd::stderr_isnt
  doc: |
    Make sure the standard error output of the latest command run by
    `lib/runcmd` is different from what is not wanted.

# Steps to examine stdout/stderr for sub-strings.

- then: stdout contains "{text:text}"
  impl:
    python:
      function: runcmd_stdout_contains
    rust:
      function: subplotlib::steplibrary::runcmd::stdout_contains
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` contains the desired sub-string.

- then: 'stdout doesn''t contain "{text:text}"'
  impl:
    python:
      function: runcmd_stdout_doesnt_contain
    rust:
      function: subplotlib::steplibrary::runcmd::stdout_doesnt_contain
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` does not contain the sub-string.

- then: stderr contains "{text:text}"
  impl:
    python:
      function: runcmd_stderr_contains
    rust:
      function: subplotlib::steplibrary::runcmd::stderr_contains
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` contains the desired sub-string.

- then: 'stderr doesn''t contain "{text:text}"'
  impl:
    python:
      function: runcmd_stderr_doesnt_contain
    rust:
      function: subplotlib::steplibrary::runcmd::stderr_doesnt_contain
  doc: |
    Make sure the standard error output of the latest command run by
    `lib/runcmd` does not contain the sub-string.

# Steps to match stdout/stderr against regular expressions.

- then: stdout matches regex {regex:text}
  impl:
    python:
      function: runcmd_stdout_matches_regex
    rust:
      function: subplotlib::steplibrary::runcmd::stdout_matches_regex
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` matches the desired regular expression.

- then: stdout doesn't match regex {regex:text}
  impl:
    python:
      function: runcmd_stdout_doesnt_match_regex
    rust:
      function: subplotlib::steplibrary::runcmd::stdout_doesnt_match_regex
  doc: |
    Make sure the standard output of the latest command run by
    `lib/runcmd` does not match a regular expression.

- then: stderr matches regex {regex:text}
  impl:
    python:
      function: runcmd_stderr_matches_regex
    rust:
      function: subplotlib::steplibrary::runcmd::stderr_matches_regex
  doc: |
    Make sure the standard error output of the latest command run by
    `lib/runcmd` matches the desired regular expression.

- then: stderr doesn't match regex {regex:text}
  impl:
    python:
      function: runcmd_stderr_doesnt_match_regex
    rust:
      function: subplotlib::steplibrary::runcmd::stderr_doesnt_match_regex
  doc: |
    Make sure the standard error output of the latest command run by
    `lib/runcmd` does not match a regular expression.