Skip to content

Commit 5332d8c

Browse files
tetronmr-c
andauthored
Add tests for relative reference in cwl.output.json (#199)
Co-authored-by: Michael R. Crusoe <[email protected]>
1 parent f8f4dfe commit 5332d8c

File tree

4 files changed

+92
-6
lines changed

4 files changed

+92
-6
lines changed

conformance_tests.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,36 @@
963963
and just 'location' is provided.
964964
tags: [ shell_command, command_line_tool ]
965965

966+
- job: tests/empty.json
967+
output: {
968+
"foo": {
969+
"location": "foo",
970+
"class": "File",
971+
"checksum": "sha1$f1d2d2f924e986ac86fdf7b36c94bcdf32beec15",
972+
"size": 4
973+
}
974+
}
975+
tool: tests/test-cwl-out3.cwl
976+
id: json_output_path_relative
977+
doc: >-
978+
Test support for reading cwl.output.json where 'path' is relative path in output dir.
979+
tags: [ shell_command, command_line_tool ]
980+
981+
- job: tests/empty.json
982+
output: {
983+
"foo": {
984+
"location": "foo",
985+
"class": "File",
986+
"checksum": "sha1$f1d2d2f924e986ac86fdf7b36c94bcdf32beec15",
987+
"size": 4
988+
}
989+
}
990+
tool: tests/test-cwl-out4.cwl
991+
id: json_output_location_relative
992+
doc: >-
993+
Test support for reading cwl.output.json where 'location' is relative reference to output dir.
994+
tags: [ shell_command, command_line_tool ]
995+
966996
- job: tests/abc.json
967997
output:
968998
files: [{
@@ -3314,7 +3344,7 @@
33143344
`echo a && echo b > out.txt`, but instead will produce the correct `echo a && echo b`,
33153345
and capture the output correctly.
33163346
tags: [ shell_command, command_line_tool ]
3317-
3347+
33183348
- label: multiple-input-feature-requirement
33193349
output: {
33203350
"hello_world_in_two_lines": [

invocation.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,29 @@ The exit code of the process is available to expressions in
156156

157157
## Output binding
158158

159-
If the output directory contains a file named "cwl.output.json", that file
160-
must be loaded and used as the output object. Otherwise, the output object
161-
must be generated by walking the parameters listed in `outputs` and
162-
applying output bindings to the tool output. Output bindings are
163-
associated with output parameters using the `outputBinding` field. See
159+
If the output directory contains a file named "cwl.output.json", that
160+
file must be loaded and used as the output object. In this case, the
161+
output object should still be type-checked against the `outputs`
162+
section, but `outputBinding` is ignored.
163+
164+
For Files and Directories, if the value of `path` is a relative path
165+
pattern (does not begin with a slash '/') then it is resolved relative
166+
to the output directory. If the value of the "path" is an absolute
167+
path pattern (it does begin with a slash '/') then it must refer to a
168+
path within the output directory. It is an error for "path" to refer
169+
outside the output directory.
170+
171+
Similarly, if a File or Directory "cwl.output.json" contains
172+
`location`, it is resolved as relative reference URI with a base URI
173+
representing the output directory. If `location` contains some other
174+
absolute URI with a scheme supported by the implementation, the
175+
implementation may choose to accept it.
176+
177+
If both `path` and `location` are provided on a File or Directory in
178+
"cwl.output.json", `path` takes precedence.
179+
180+
If there is no "cwl.output.json", the output object must be generated
181+
by walking the parameters listed in `outputs` and applying output
182+
bindings to the tool output. Output bindings are associated with
183+
output parameters using the `outputBinding` field. See
164184
[`CommandOutputBinding`](#CommandOutputBinding) for details.

tests/test-cwl-out3.cwl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class: CommandLineTool
2+
cwlVersion: v1.2
3+
requirements:
4+
- class: ShellCommandRequirement
5+
hints:
6+
DockerRequirement:
7+
dockerPull: docker.io/debian:stable-slim
8+
9+
inputs: []
10+
11+
outputs:
12+
- id: foo
13+
type: File
14+
15+
arguments:
16+
- valueFrom: >
17+
echo foo > foo && echo '{"foo": {"path": "foo", "class": "File"} }' > cwl.output.json
18+
shellQuote: false

tests/test-cwl-out4.cwl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class: CommandLineTool
2+
cwlVersion: v1.2
3+
requirements:
4+
- class: ShellCommandRequirement
5+
hints:
6+
DockerRequirement:
7+
dockerPull: docker.io/debian:stable-slim
8+
9+
inputs: []
10+
11+
outputs:
12+
- id: foo
13+
type: File
14+
15+
arguments:
16+
- valueFrom: >
17+
echo foo > foo && echo '{"foo": {"location": "foo", "class": "File"} }' > cwl.output.json
18+
shellQuote: false

0 commit comments

Comments
 (0)