Skip to content
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

loadContents testing. #822

Open
wants to merge 3 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 73 additions & 0 deletions v1.0/conformance_test_v1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2590,3 +2590,76 @@
doc: Test an anonymous enum inside an array inside a record, SchemaDefRequirement
tags: [command_line_tool, schema_def]

- tool: v1.0/loadContents-output-contains-b.cwl
job: v1.0/64kbplus1-job.json
should_fail: true
id: 198
label: ouptut_loadContents_fails_over_64kb
doc: Test loadContents on output binding fails over 64kb.
tags: [command_line_tool, inline_javascript]

- tool: v1.0/loadContents-output-contains-b.cwl
job: v1.0/64kbminus1-job.json
output:
contains_b: true
id: 199
label: ouptut_loadContents_fails_over_64kb_control
doc: Test loadContents on output binding fails over 64kb (control for previous test)
tags: [command_line_tool, inline_javascript]

- tool: v1.0/loadContents-input-contains-b-wf.cwl
job: v1.0/64kbplus1-job.json
should_fail: true
id: 200
label: step_input_loadContents_fails_over_64kb
doc: Test loadContents on step input fails over 64kb.
tags: [workflow, inline_javascript]

- tool: v1.0/loadContents-input-contains-b-wf.cwl
job: v1.0/64kbminus1-job.json
output:
contains_b: true
id: 201
label: step_input_loadContents_fails_over_64kb_control
doc: Test loadContents on step input fails over 64kb (control for previous test)
tags: [workflow, inline_javascript]

- tool: v1.0/file-literal-output-size.cwl
job: v1.0/size_64kb_plus_1.json
should_fail: true
id: 202
label: file_literal_size_fails_over_64kb
doc: Test file literals of size over 64kb fail.
tags: [ expression_tool ]

- tool: v1.0/file-literal-output-size.cwl
job: v1.0/size_64kb.json
output:
lit:
class: File
checksum: "sha1$79db5888b5d38e10afbdbd14a19cd1caa9044c65"
size: 65536
id: 203
label: file_literal_size_fails_over_64kb_control
doc: Test file literals of size over 64kb fail (control for previous test)
tags: [ expression_tool ]

- tool: v1.0/cat-default-file-literal-64kb-plus-1.cwl
job: v1.0/empty.json
should_fail: true
id: 204
label: file_literal_as_default_size_fails_over_64kb
doc: Test file literals as tool defaults of size over 64kb fail (control for previous test)
tags: [ command_line_tool ]

- tool: v1.0/cat-default-file-literal-64kb.cwl
job: v1.0/empty.json
output:
output:
class: File
checksum: "sha1$79db5888b5d38e10afbdbd14a19cd1caa9044c65"
size: 65536
id: 205
label: file_literal_as_default_size_fails_over_64kb_control
doc: Test file literals as tool defaults of size over 64kb fail (control for previous test)
tags: [ command_line_tool ]
1 change: 1 addition & 0 deletions v1.0/v1.0/64kbminus1

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions v1.0/v1.0/64kbminus1-job.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"in": {"class": "File", "location": "64kbminus1"}}
1 change: 1 addition & 0 deletions v1.0/v1.0/64kbplus1

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions v1.0/v1.0/64kbplus1-job.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"in": {"class": "File", "location": "64kbplus1"}}
21 changes: 21 additions & 0 deletions v1.0/v1.0/cat-default-file-literal-64kb-plus-1.cwl

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions v1.0/v1.0/cat-default-file-literal-64kb.cwl

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions v1.0/v1.0/file-literal-output-size.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env cwl-runner

class: ExpressionTool
cwlVersion: v1.0
requirements:
- class: InlineJavascriptRequirement

inputs:
size: int
outputs: { lit: File }
expression: |
${
var contents = "a".repeat(inputs.size);
return { "lit": { "class": "File", "basename": "lit", "contents": contents } };
}
52 changes: 52 additions & 0 deletions v1.0/v1.0/loadContents-input-contains-b-wf.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cwlVersion: v1.0
class: Workflow

requirements:
StepInputExpressionRequirement: {}
InlineJavascriptRequirement: {}

inputs:
in:
type: File

outputs:
contains_b:
type: boolean
outputSource: check_file/contains_b

steps:

create_file:
run:
class: CommandLineTool
inputs:
file1:
type: File
inputBinding: {position: 1}
outputs:
output:
type: File
outputBinding: {glob: out.txt}

baseCommand: cat
stdout: out.txt

in: {file1: in}
out: [ output ]

check_file:
run:
class: ExpressionTool
requirements: { InlineJavascriptRequirement: {} }
inputs:
- { id: bytes, type: File, inputBinding: { loadContents: true } }
outputs: { contains_b: boolean }
expression: |
${
return {"contains_b": inputs.bytes.contents.indexOf("b") >= 0};
}
in:
bytes:
source: create_file/output

out: [ contains_b ]
21 changes: 21 additions & 0 deletions v1.0/v1.0/loadContents-output-contains-b.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env cwl-runner

class: CommandLineTool
cwlVersion: v1.0

requirements:
- class: InlineJavascriptRequirement

inputs:
in:
type: File
inputBinding: {position: 1}
outputs:
contains_b:
type: boolean
outputBinding:
glob: out.txt
loadContents: true
outputEval: $(self[0].contents.indexOf("b") >= 0)
baseCommand: cat
stdout: out.txt
1 change: 1 addition & 0 deletions v1.0/v1.0/size_64kb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"size": 65536}
1 change: 1 addition & 0 deletions v1.0/v1.0/size_64kb_plus_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"size": 65537}