Skip to content

Commit

Permalink
networkAcess, envDef, and initialWorkDir tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Jul 19, 2024
1 parent c15818a commit cd34765
Show file tree
Hide file tree
Showing 56 changed files with 2,220 additions and 45 deletions.
510 changes: 492 additions & 18 deletions conformance_tests.yaml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions tests/dir5_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class: CommandLineTool
cwlVersion: v1.3.0-dev1
requirements:
- class: ShellCommandRequirement
initialWorkDir: $(inputs.indir.listing)
inputs:
indir:
type: Directory
loadListing: shallow_listing
outputs:
outlist:
type: File
outputBinding:
glob: output.txt
arguments: ["find", "-L", ".", "!", "-path", "*.txt",
{shellQuote: false, valueFrom: "|"},
"sort"]
stdout: output.txt
16 changes: 16 additions & 0 deletions tests/env-tool1_noreq.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class: CommandLineTool
cwlVersion: v1.3.0-dev1
inputs:
in: string
outputs:
out:
type: File
outputBinding:
glob: out

envDef:
TEST_ENV: $(inputs.in)

baseCommand: ["/bin/sh", "-c", "echo $TEST_ENV"]

stdout: out
16 changes: 16 additions & 0 deletions tests/env-tool4_noreq.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class: CommandLineTool
cwlVersion: v1.3.0-dev1
inputs:
in: string
outputs:
out:
type: File
outputBinding:
glob: out

envDef:
TEST_ENV: conflict_original

baseCommand: ["/bin/bash", "-c", "echo $TEST_ENV"]

stdout: out
23 changes: 23 additions & 0 deletions tests/env-wf1_noreq.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.3.0-dev1

inputs:
in: string

outputs:
out:
type: File
outputSource: step1/out

requirements:
EnvVarRequirement:
envDef:
TEST_ENV: override

steps:
step1:
run: env-tool1_noreq.cwl
in:
in: in
out: [out]
14 changes: 14 additions & 0 deletions tests/initialwork-path_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class: CommandLineTool
cwlVersion: v1.3.0-dev1
requirements:
ShellCommandRequirement: {}
initialWorkDir:
- entry: $(inputs.file1)
entryname: bob.txt
inputs:
file1: File
outputs: []
arguments:
- shellQuote: false
valueFrom: |
test "$(inputs.file1.path)" = "$(runtime.outdir)/bob.txt"
26 changes: 26 additions & 0 deletions tests/initialworkdir-glob-fullpath_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env cwl-runner

cwlVersion: v1.3.0-dev1

initialWorkDir:
- $(inputs.INPUT)

class: CommandLineTool

inputs:
- id: INPUT
type: File

outputs:
- id: OUTPUT
type: File
outputBinding:
glob: $(runtime.outdir)/$(inputs.INPUT.basename)
secondaryFiles:
- .fai

arguments:
- valueFrom: $(inputs.INPUT.basename).fai
position: 0

baseCommand: [touch]
30 changes: 30 additions & 0 deletions tests/initialworkdirrequirement-docker-out_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env cwl-runner

cwlVersion: v1.3.0-dev1

requirements:
- class: DockerRequirement
dockerPull: docker.io/debian:stable-slim

initialWorkDir:
- $(inputs.INPUT)

class: CommandLineTool

inputs:
- id: INPUT
type: File

outputs:
- id: OUTPUT
type: File
outputBinding:
glob: $(inputs.INPUT.basename)
secondaryFiles:
- .fai

arguments:
- valueFrom: $(inputs.INPUT.basename).fai
position: 0

baseCommand: [touch]
33 changes: 33 additions & 0 deletions tests/inp_update_wf_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.3.0-dev1
inputs: []
outputs:
a:
type: int
outputSource: step3/output
b:
type: int
outputSource: step4/output
steps:
step1:
in:
in: {default: "3"}
out: [out]
run: echo-file-tool.cwl
step2:
in:
r: step1/out
out: [out]
run: updateval_inplace_noiwdr.cwl
step3:
in:
file1: step1/out
wait: step2/out
out: [output]
run: parseInt-tool.cwl
step4:
in:
file1: step2/out
out: [output]
run: parseInt-tool.cwl
42 changes: 42 additions & 0 deletions tests/inpdir_update_wf_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.3.0-dev1
inputs: []
requirements:
InlineJavascriptRequirement: {}
outputs:
a:
type: File[]
outputSource: step3/d1out
b:
type: File[]
outputSource: step3/d2out
steps:
step1:
in:
dirname: {default: step1dir}
out: [out]
run: mkdir.cwl
step2:
in:
r: step1/out
out: [out]
run: updatedir_inplace_noiwdr.cwl
step3:
in:
d1: step1/out
d2: step2/out
out: [d1out, d2out]
run:
class: ExpressionTool
inputs:
d1:
type: Directory
loadListing: shallow_listing
d2:
type: Directory
loadListing: shallow_listing
outputs:
d1out: File[]
d2out: File[]
expression: "$({d1out: inputs.d1.listing, d2out: inputs.d2.listing})"
27 changes: 27 additions & 0 deletions tests/iwd/iwd-container-entryname1_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cwlVersion: v1.3.0-dev1
class: CommandLineTool
doc: |
When executing in a container, entryname can have an absolute path
to a mount location inside the container.

inputs:
filelist: File

outputs:
head:
type: File
outputBinding:
glob: head.txt

requirements:
DockerRequirement:
dockerPull: docker.io/debian:stable-slim
dockerOutputDirectory: /output
ShellCommandRequirement: {}

initialWorkDir:
- entryname: /tmp2j3y7rpb/input/stuff.txt # Give it a weird prefix to minimize chance of conflict with a real file
entry: $(inputs.filelist)

arguments:
- {shellQuote: false, valueFrom: "head -n10 /tmp2j3y7rpb/input/stuff.txt > /output/head.txt"}
21 changes: 21 additions & 0 deletions tests/iwd/iwd-container-entryname2_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cwlVersion: v1.3.0-dev1
class: CommandLineTool
doc: |
Must fail if entryname is an absolute path and DockerRequirement is
not in the 'requirements' section.
inputs:
filelist: File
outputs:
head:
type: File
outputBinding:
glob: head.txt
requirements:
ShellCommandRequirement: {}

initialWorkDir:
- entryname: /tmp2j3y7rpb/input/stuff.txt # Give it a weird prefix to minimize chance of conflict with a real file
entry: $(inputs.filelist)

arguments:
- {shellQuote: false, valueFrom: "head -n10 /tmp2j3y7rpb/input/stuff.txt > /output/head.txt"}
24 changes: 24 additions & 0 deletions tests/iwd/iwd-container-entryname3_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cwlVersion: v1.3.0-dev1
class: CommandLineTool
doc: |
Must fail if entryname is an absolute path and DockerRequirement is
not in the 'requirements' section.
inputs:
filelist: File
outputs:
head:
type: File
outputBinding:
glob: head.txt
hints:
DockerRequirement:
dockerPull: docker.io/debian:stable-slim
dockerOutputDirectory: /output
requirements:
ShellCommandRequirement: {}

initialWorkDir:
- entryname: /tmp2j3y7rpb/input/stuff.txt # Give it a weird prefix to minimize chance of conflict with a real file
entry: $(inputs.filelist)
arguments:
- {shellQuote: false, valueFrom: "head -n10 /tmp2j3y7rpb/input/stuff.txt > /output/head.txt"}
21 changes: 21 additions & 0 deletions tests/iwd/iwd-container-entryname4_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cwlVersion: v1.3.0-dev1
class: CommandLineTool
doc: |
Must fail if entryname starts with ../
inputs:
filelist: File
outputs:
head:
type: File
outputBinding:
glob: head.txt

initialWorkDir:
- entryname: ../input/stuff.txt # Illegal
entry: $(inputs.filelist)

requirements:
ShellCommandRequirement: {}

arguments:
- {shellQuote: false, valueFrom: "head -n10 ../input/stuff.txt > head.txt"}
20 changes: 20 additions & 0 deletions tests/iwd/iwd-fileobjs1_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.3.0-dev1
doc: Can have a file declared directly in an initialWorkDir
initialWorkDir:
- class: File
location: ../loadContents/inp-filelist.txt
- class: Directory
location: ../testdir
inputs: []
outputs:
filelist:
type: File
outputBinding:
glob: inp-filelist.txt
testdir:
type: Directory
outputBinding:
glob: testdir
baseCommand: "true"
18 changes: 18 additions & 0 deletions tests/iwd/iwd-fileobjs2_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.3.0-dev1
doc: Can have a file declared directly in initialWorkDir
initialWorkDir:
- [{class: File, location: ../loadContents/inp-filelist.txt},
{class: Directory, location: ../testdir}]
inputs: []
outputs:
filelist:
type: File
outputBinding:
glob: inp-filelist.txt
testdir:
type: Directory
outputBinding:
glob: testdir
baseCommand: "true"
22 changes: 22 additions & 0 deletions tests/iwd/iwd-jsondump1-nl_noiwdr.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.3.0-dev1
initialWorkDir:
- entryname: "out-filelist.json"
entry: |
${
var ls = [];
for (var i = 1; i < 10000; i++) {
ls.push("example_input_file"+i+".txt");
}
return ls;
}
requirements:
InlineJavascriptRequirement: {}
inputs: []
outputs:
filelist:
type: File
outputBinding:
glob: out-filelist.json
arguments: ["true"]
Loading

0 comments on commit cd34765

Please sign in to comment.