Skip to content

New test for file and directory literals #657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion v1.0/conformance_test_v1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@
"args": []
}
tool: v1.0/empty-array-input.cwl
doc: "Test that empty array input does not add anything to command line"
doc: "Test that empty array input does not add anything to command line"
tags: [ required ]

- job: v1.0/empty.json
Expand All @@ -1551,3 +1551,47 @@
tool: v1.0/valueFrom-constant.cwl
doc: Test valueFrom with constant value overriding provided array inputs
tags: [ inline_javascript ]

- job: v1.0/new-dir-job.yml
output: {
"out": {
"checksum": "sha1$ada861e58d3ca64224d5b8ded8cd0e1e7f775057",
"class": "File",
"location": "output.txt",
"size": 26
},
"outdir": {
"location": "sample1",
"listing": [
{
"checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709",
"location": "sample1.bam",
"class": "File",
"size": 0
},
{
"checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709",
"location": "sample1.other",
"class": "File",
"size": 0
}
],
"class": "Directory"
}
}
tool: v1.0/new-dir.cwl
doc: Test returning directory literal in expression for InitialWorkDir listing
tags: [ required ]

- job: v1.0/empty.json
output: {
"out": {
"checksum": "sha1$2aae6c35c94fcfb415dbe95f408b9ce91ee846ed",
"class": "File",
"location": "output.txt",
"size": 11
}
}
tool: v1.0/new-file.cwl
doc: Test returning file literal in expression for InitialWorkDir listing
tags: [ required ]
Empty file added v1.0/v1.0/bams/sample1.bam
Empty file.
Empty file added v1.0/v1.0/bams/sample1.other
Empty file.
4 changes: 4 additions & 0 deletions v1.0/v1.0/new-dir-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
input:
class: Directory
location: bams
# location: keep:d287705ded77ef04295b906135fad6b8+53
33 changes: 33 additions & 0 deletions v1.0/v1.0/new-dir.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cwlVersion: v1.0
class: CommandLineTool
requirements:
InlineJavascriptRequirement: {}
InitialWorkDirRequirement:
listing: |
${
var samplename = null;
var arr = [];
var bam = RegExp('.*\\.bam$')
for (var i in inputs.input.listing) {
if (!(samplename)) {
if (inputs.input.listing[i].basename.match(bam)) {
samplename = inputs.input.listing[i].basename.split('.')[0];
}
}
}
var inputdir = {"class": "Directory",
"basename": samplename,
"listing": inputs.input.listing};
arr.push(inputdir)
return arr;
}
inputs:
input: Directory
stdout: output.txt
outputs:
out: stdout
outdir:
type: Directory
outputBinding:
glob: sample1
baseCommand: [ls, sample1/]
19 changes: 19 additions & 0 deletions v1.0/v1.0/new-file.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cwlVersion: v1.0
class: CommandLineTool
requirements:
InlineJavascriptRequirement: {}
InitialWorkDirRequirement:
listing: |
${
var arr = [];
var inputfile = {"class": "File",
"basename": "input.txt",
"contents": "hello world"};
arr.push(inputfile);
return arr;
}
inputs: []
stdout: output.txt
outputs:
out: stdout
baseCommand: [cat, input.txt]