Skip to content

Commit e7b2f63

Browse files
committed
Added new test on loop with literal files
1 parent 1a2d3ac commit e7b2f63

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

tests/loop/test-index.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,31 @@
123123
o1: 10
124124
doc: "Test a loop case with two variables but one is optional"
125125
tags: [ loop, inline_javascript, workflow ]
126+
127+
- tool: value-from-loop-2.cwl
128+
id: loop_value_from-2
129+
output: {
130+
"result": [
131+
"first,0-sha1$e445e7ebf0b1e19e5eb7f3e8e4d86f5424c4b103",
132+
"first,1-sha1$c2ee1cb0abf988529ae1d67c5a6798a9db9e133a",
133+
"first,2-sha1$7663c0076cdf1dbe14373237e8c2eea8735b04f2",
134+
"first,3-sha1$83b77de68c3c6cce92a381adc9159d6e59332545",
135+
"first,4-sha1$eb74efd51e4399144f465534f4077f515d996d57"
136+
]
137+
}
138+
doc: "Test a loop case with a literal file generated by a valueFrom directive inside the loop."
139+
tags: [ conditional, loop, inline_javascript, workflow ]
140+
141+
- tool: value-from-loop-3.cwl
142+
id: loop_and_value_from
143+
output: {
144+
"result": [
145+
"first,0-sha1$e445e7ebf0b1e19e5eb7f3e8e4d86f5424c4b103",
146+
"first,0-sha1$e445e7ebf0b1e19e5eb7f3e8e4d86f5424c4b103",
147+
"first,0-sha1$e445e7ebf0b1e19e5eb7f3e8e4d86f5424c4b103",
148+
"first,0-sha1$e445e7ebf0b1e19e5eb7f3e8e4d86f5424c4b103",
149+
"first,0-sha1$e445e7ebf0b1e19e5eb7f3e8e4d86f5424c4b103"
150+
]
151+
}
152+
doc: "Test a loop case with a literal file generated by a valueFrom directive outside the loop."
153+
tags: [ conditional, loop, inline_javascript, workflow ]

tests/loop/value-from-loop-2.cwl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.3.0-dev1
3+
class: Workflow
4+
requirements:
5+
InlineJavascriptRequirement: {}
6+
StepInputExpressionRequirement: {}
7+
inputs:
8+
limit:
9+
type: int
10+
default: 5
11+
12+
outputs:
13+
- id: result
14+
type: string[]
15+
outputSource: step1/result
16+
17+
steps:
18+
step1:
19+
run:
20+
class: CommandLineTool
21+
inputs:
22+
lfile:
23+
type: File
24+
inputBinding:
25+
position: 1
26+
stdout: "out.txt"
27+
outputs:
28+
result:
29+
type: string
30+
outputBinding:
31+
glob: "out.txt"
32+
loadContents: true
33+
outputEval: $(self[0].contents)-$(self[0].checksum)
34+
baseCommand: ["cat"]
35+
in:
36+
counter:
37+
default: 0
38+
limit: limit
39+
lfile:
40+
valueFrom: "${return {'class': 'File', 'basename': 'init-value-from.' + inputs.counter, 'contents': 'first,' + inputs.counter }}"
41+
out:
42+
- id: result
43+
when: $(inputs.counter < inputs.limit)
44+
loop:
45+
counter:
46+
valueFrom: $(inputs.counter + 1)
47+
lfile:
48+
valueFrom: "${return {'class': 'File', 'basename': 'iter-value-from.' + (inputs.counter + 1), 'contents': 'first,' + (inputs.counter + 1)}}"
49+
outputMethod: all_iterations

tests/loop/value-from-loop-3.cwl

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.3.0-dev1
3+
class: Workflow
4+
requirements:
5+
InlineJavascriptRequirement: {}
6+
StepInputExpressionRequirement: {}
7+
inputs:
8+
limit:
9+
type: int
10+
default: 5
11+
12+
outputs:
13+
- id: result
14+
type: string[]
15+
outputSource: step1/result
16+
17+
steps:
18+
step1:
19+
run:
20+
class: CommandLineTool
21+
inputs:
22+
lfile:
23+
type: File
24+
inputBinding:
25+
position: 1
26+
stdout: "out.txt"
27+
outputs:
28+
result:
29+
type: string
30+
outputBinding:
31+
glob: "out.txt"
32+
loadContents: true
33+
outputEval: $(self[0].contents)-$(self[0].checksum)
34+
baseCommand: ["cat"]
35+
in:
36+
counter:
37+
default: 0
38+
limit: limit
39+
lfile:
40+
valueFrom: "${return {'class': 'File', 'basename': 'init-value-from.' + inputs.counter, 'contents': 'first,' + inputs.counter }}"
41+
out:
42+
- id: result
43+
when: $(inputs.counter < inputs.limit)
44+
loop:
45+
counter:
46+
valueFrom: $(inputs.counter + 1)
47+
outputMethod: all_iterations

0 commit comments

Comments
 (0)