Skip to content

Commit 15b64b7

Browse files
author
Kaushik Ghose
committed
Add tests for staging File[]
1. Add three conformance tests to check staging of an array of Files to initial Directory 2. Tests check that entryname and basename work by themselves and if both are supplied, entryname overrides basename Fixes: common-workflow-language/common-workflow-language#777
1 parent dab1b18 commit 15b64b7

9 files changed

+192
-0
lines changed

conformance_tests.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,3 +2728,108 @@
27282728
class: "Directory"
27292729
listing: []
27302730
tags: [ required, command_line_tool ]
2731+
2732+
2733+
- doc: Test that array of input files can be staged to directory with entryname
2734+
label: stage_file_array
2735+
tool: tests/stage_file_array.cwl
2736+
job: tests/stage_file_array.job.json
2737+
output:
2738+
output:
2739+
[
2740+
{
2741+
"basename": "sfa-1.txt",
2742+
"checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6",
2743+
"class": "File",
2744+
"size": 49
2745+
},
2746+
{
2747+
"basename": "sfa-1.txt.sec",
2748+
"checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a",
2749+
"class": "File",
2750+
"size": 59
2751+
},
2752+
{
2753+
"basename": "sfa-2.txt",
2754+
"checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6",
2755+
"class": "File",
2756+
"size": 49
2757+
},
2758+
{
2759+
"basename": "sfa-2.txt.sec",
2760+
"checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a",
2761+
"class": "File",
2762+
"size": 59
2763+
}
2764+
]
2765+
tags: [ required, command_line_tool ]
2766+
2767+
2768+
- doc: Test that array of input files can be staged to directory with basename
2769+
label: stage_file_array
2770+
tool: tests/stage_file_array_basename.cwl
2771+
job: tests/stage_file_array.job.json
2772+
output:
2773+
output:
2774+
[
2775+
{
2776+
"basename": "sfa-1.txt",
2777+
"checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6",
2778+
"class": "File",
2779+
"size": 49
2780+
},
2781+
{
2782+
"basename": "sfa-1.txt.sec",
2783+
"checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a",
2784+
"class": "File",
2785+
"size": 59
2786+
},
2787+
{
2788+
"basename": "sfa-2.txt",
2789+
"checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6",
2790+
"class": "File",
2791+
"size": 49
2792+
},
2793+
{
2794+
"basename": "sfa-2.txt.sec",
2795+
"checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a",
2796+
"class": "File",
2797+
"size": 59
2798+
}
2799+
]
2800+
tags: [ required, command_line_tool ]
2801+
2802+
2803+
- doc: Test that if array of input files are staged to directory with basename and entryname, entryname overrides
2804+
label: stage_file_array
2805+
tool: tests/stage_file_array_basename_and_entryname.cwl
2806+
job: tests/stage_file_array.job.json
2807+
output:
2808+
output:
2809+
[
2810+
{
2811+
"basename": "sfa-1.txt",
2812+
"checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6",
2813+
"class": "File",
2814+
"size": 49
2815+
},
2816+
{
2817+
"basename": "sfa-1.txt.sec",
2818+
"checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a",
2819+
"class": "File",
2820+
"size": 59
2821+
},
2822+
{
2823+
"basename": "sfa-2.txt",
2824+
"checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6",
2825+
"class": "File",
2826+
"size": 49
2827+
},
2828+
{
2829+
"basename": "sfa-2.txt.sec",
2830+
"checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a",
2831+
"class": "File",
2832+
"size": 59
2833+
}
2834+
]
2835+
tags: [ required, command_line_tool ]

tests/sfa-1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test file for staging array of files to Directory

tests/sfa-1.txt.sec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Secondary test file for staging array of files to Directory

tests/sfa-2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test file for staging array of files to Directory

tests/sfa-2.txt.sec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Secondary test file for staging array of files to Directory

tests/stage_file_array.cwl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
class: CommandLineTool
4+
cwlVersion: v1.1.0-dev1
5+
id: stage_file_array
6+
label: Stage File Array
7+
arguments: [ls]
8+
inputs:
9+
- id: input_list
10+
type: 'File[]'
11+
secondaryFiles:
12+
- .sec
13+
outputs:
14+
- id: output
15+
type: File[]
16+
outputBinding:
17+
glob: input_dir/*
18+
requirements:
19+
- class: InlineJavascriptRequirement
20+
- class: InitialWorkDirRequirement
21+
listing:
22+
- entryname: input_dir
23+
entry: "${ return {class: 'Directory', listing: inputs.input_list} }"
24+
writable: true

tests/stage_file_array.job.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"input_list": [
3+
{
4+
"class": "File",
5+
"location": "sfa-1.txt"
6+
},
7+
{
8+
"class": "File",
9+
"location": "sfa-2.txt"
10+
}
11+
]
12+
}

tests/stage_file_array_basename.cwl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
class: CommandLineTool
4+
cwlVersion: v1.1.0-dev1
5+
id: stage_file_array_basename
6+
label: Stage File Array (with Directory Basename)
7+
arguments: [ls]
8+
inputs:
9+
- id: input_list
10+
type: 'File[]'
11+
secondaryFiles:
12+
- .sec
13+
outputs:
14+
- id: output
15+
type: File[]
16+
outputBinding:
17+
glob: input_dir/*
18+
requirements:
19+
- class: InlineJavascriptRequirement
20+
- class: InitialWorkDirRequirement
21+
listing:
22+
- entry: "${ return {class: 'Directory', basename: 'input_dir', listing: inputs.input_list} }"
23+
writable: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
class: CommandLineTool
4+
cwlVersion: v1.1.0-dev1
5+
id: stage_file_array_basename_and_entryname
6+
label: Stage File Array (with Directory Basename AND entryname)
7+
arguments: [ls]
8+
inputs:
9+
- id: input_list
10+
type: 'File[]'
11+
secondaryFiles:
12+
- .sec
13+
outputs:
14+
- id: output
15+
type: File[]
16+
outputBinding:
17+
glob: input_dir/*
18+
requirements:
19+
- class: InlineJavascriptRequirement
20+
- class: InitialWorkDirRequirement
21+
listing:
22+
- entryname: input_dir
23+
entry: "${ return {class: 'Directory', basename: 'not_input_dir', listing: inputs.input_list} }"
24+
writable: true

0 commit comments

Comments
 (0)