From cd3476529ebbacb064d4858156b82dcfad61a85d Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 18 Jul 2024 13:49:26 -0400 Subject: [PATCH] `networkAcess`, `envDef`, and `initialWorkDir` tests --- conformance_tests.yaml | 510 +++++++++++++++++- tests/dir5_noiwdr.cwl | 18 + tests/env-tool1_noreq.cwl | 16 + tests/env-tool4_noreq.cwl | 16 + tests/env-wf1_noreq.cwl | 23 + tests/initialwork-path_noiwdr.cwl | 14 + tests/initialworkdir-glob-fullpath_noiwdr.cwl | 26 + ...alworkdirrequirement-docker-out_noiwdr.cwl | 30 ++ tests/inp_update_wf_noiwdr.cwl | 33 ++ tests/inpdir_update_wf_noiwdr.cwl | 42 ++ tests/iwd/iwd-container-entryname1_noiwdr.cwl | 27 + tests/iwd/iwd-container-entryname2_noiwdr.cwl | 21 + tests/iwd/iwd-container-entryname3_noiwdr.cwl | 24 + tests/iwd/iwd-container-entryname4_noiwdr.cwl | 21 + tests/iwd/iwd-fileobjs1_noiwdr.cwl | 20 + tests/iwd/iwd-fileobjs2_noiwdr.cwl | 18 + tests/iwd/iwd-jsondump1-nl_noiwdr.cwl | 22 + tests/iwd/iwd-jsondump1_noiwdr.cwl | 23 + tests/iwd/iwd-jsondump2-nl_noiwdr.cwl | 23 + tests/iwd/iwd-jsondump2_noiwdr.cwl | 23 + tests/iwd/iwd-jsondump3-nl_noiwdr.cwl | 19 + tests/iwd/iwd-jsondump3_noiwdr.cwl | 19 + tests/iwd/iwd-nolimit_noiwdr.cwl | 24 + tests/iwd/iwd-passthrough1_noreq.cwl | 22 + tests/iwd/iwd-passthrough2_noiwdr.cwl | 29 + tests/iwd/iwd-passthrough3_noreq.cwl | 15 + tests/iwd/iwd-passthrough4_noreq.cwl | 14 + tests/iwd/iwd-passthrough5_noreq.cwl | 15 + tests/iwd/iwd-subdir-tool_noreq.cwl | 15 + tests/iwd/iwd-subdir-wf_noreq.cwl | 19 + tests/iwd/iwd_dir_literal_real_file.cwl | 25 + tests/iwd/test-index.yaml | 357 +++++++++++- tests/iwdr-entry_noreq.cwl | 18 + tests/iwdr_with_nested_dirs_noreq.cwl | 39 ++ tests/linkfile_noreq.cwl | 20 + tests/networkaccess_noreq.cwl | 14 + tests/recursive-input-directory_noiwdr.cwl | 33 ++ tests/rename_noreq.cwl | 14 + tests/search_noiwdr.cwl | 109 ++++ .../secondaryfiles/rename-outputs_noiwdr.cwl | 49 ++ tests/secondaryfiles/test-index.yaml | 20 +- tests/stage-array-dirs_noreq.cwl | 20 + tests/stage-array_noiwdr.cwl | 32 ++ ...le_array_basename_and_entryname_noiwdr.cwl | 23 + tests/stage_file_array_noiwdr.cwl | 23 + tests/stagefile_noreq.cwl | 25 + .../bash-dollar-quote_noiwdr.cwl | 56 ++ ...ine-continuation-with-expression_noreq.cwl | 20 + .../bash-line-continuation_noreq.cwl | 17 + .../string-interpolation/js-quote_noiwdr.cwl | 36 ++ tests/string-interpolation/test-index.yaml | 62 ++- tests/template-tool_noiwdr.cwl | 25 + tests/updatedir_inplace_noiwdr.cwl | 20 + tests/updateval_inplace_noiwdr.cwl | 27 + tests/writable-dir-docker_noiwdr.cwl | 23 + tests/writable-dir_noiwdr.cwl | 17 + 56 files changed, 2220 insertions(+), 45 deletions(-) create mode 100644 tests/dir5_noiwdr.cwl create mode 100644 tests/env-tool1_noreq.cwl create mode 100644 tests/env-tool4_noreq.cwl create mode 100644 tests/env-wf1_noreq.cwl create mode 100644 tests/initialwork-path_noiwdr.cwl create mode 100644 tests/initialworkdir-glob-fullpath_noiwdr.cwl create mode 100644 tests/initialworkdirrequirement-docker-out_noiwdr.cwl create mode 100644 tests/inp_update_wf_noiwdr.cwl create mode 100644 tests/inpdir_update_wf_noiwdr.cwl create mode 100644 tests/iwd/iwd-container-entryname1_noiwdr.cwl create mode 100644 tests/iwd/iwd-container-entryname2_noiwdr.cwl create mode 100644 tests/iwd/iwd-container-entryname3_noiwdr.cwl create mode 100644 tests/iwd/iwd-container-entryname4_noiwdr.cwl create mode 100644 tests/iwd/iwd-fileobjs1_noiwdr.cwl create mode 100644 tests/iwd/iwd-fileobjs2_noiwdr.cwl create mode 100644 tests/iwd/iwd-jsondump1-nl_noiwdr.cwl create mode 100644 tests/iwd/iwd-jsondump1_noiwdr.cwl create mode 100644 tests/iwd/iwd-jsondump2-nl_noiwdr.cwl create mode 100644 tests/iwd/iwd-jsondump2_noiwdr.cwl create mode 100644 tests/iwd/iwd-jsondump3-nl_noiwdr.cwl create mode 100644 tests/iwd/iwd-jsondump3_noiwdr.cwl create mode 100644 tests/iwd/iwd-nolimit_noiwdr.cwl create mode 100644 tests/iwd/iwd-passthrough1_noreq.cwl create mode 100644 tests/iwd/iwd-passthrough2_noiwdr.cwl create mode 100644 tests/iwd/iwd-passthrough3_noreq.cwl create mode 100644 tests/iwd/iwd-passthrough4_noreq.cwl create mode 100644 tests/iwd/iwd-passthrough5_noreq.cwl create mode 100644 tests/iwd/iwd-subdir-tool_noreq.cwl create mode 100644 tests/iwd/iwd-subdir-wf_noreq.cwl create mode 100644 tests/iwd/iwd_dir_literal_real_file.cwl create mode 100644 tests/iwdr-entry_noreq.cwl create mode 100644 tests/iwdr_with_nested_dirs_noreq.cwl create mode 100644 tests/linkfile_noreq.cwl create mode 100644 tests/networkaccess_noreq.cwl create mode 100644 tests/recursive-input-directory_noiwdr.cwl create mode 100644 tests/rename_noreq.cwl create mode 100644 tests/search_noiwdr.cwl create mode 100644 tests/secondaryfiles/rename-outputs_noiwdr.cwl create mode 100644 tests/stage-array-dirs_noreq.cwl create mode 100644 tests/stage-array_noiwdr.cwl create mode 100644 tests/stage_file_array_basename_and_entryname_noiwdr.cwl create mode 100644 tests/stage_file_array_noiwdr.cwl create mode 100644 tests/stagefile_noreq.cwl create mode 100644 tests/string-interpolation/bash-dollar-quote_noiwdr.cwl create mode 100644 tests/string-interpolation/bash-line-continuation-with-expression_noreq.cwl create mode 100644 tests/string-interpolation/bash-line-continuation_noreq.cwl create mode 100644 tests/string-interpolation/js-quote_noiwdr.cwl create mode 100755 tests/template-tool_noiwdr.cwl create mode 100755 tests/updatedir_inplace_noiwdr.cwl create mode 100755 tests/updateval_inplace_noiwdr.cwl create mode 100644 tests/writable-dir-docker_noiwdr.cwl create mode 100644 tests/writable-dir_noiwdr.cwl diff --git a/conformance_tests.yaml b/conformance_tests.yaml index ee8c0a6..09f9b0e 100644 --- a/conformance_tests.yaml +++ b/conformance_tests.yaml @@ -431,7 +431,7 @@ size: 15 tool: tests/env-wf1.cwl id: requirement_priority - doc: Test requirement priority + doc: Test requirement priority using nested EnvVarRequirements tags: [ env_var, workflow ] - job: tests/env-job.json @@ -614,7 +614,7 @@ size: 16 tool: tests/iwdr-entry.cwl id: initial_workdir_trailingnl - doc: Test if trailing newline is present in file entry in InitialWorkDir + doc: Test if trailing newline is present in file entry in InitialWorkDirRequirement tags: [ initial_work_dir, command_line_tool ] - job: tests/wc-job.json @@ -1167,7 +1167,7 @@ } tool: tests/dir5.cwl id: dynamic_initial_workdir - doc: Test dynamic initial work dir + doc: Test dynamic InitialWorkDirRequirement tags: [ shell_command, initial_work_dir, command_line_tool ] - job: tests/stagefile-job.yml @@ -1181,7 +1181,7 @@ } tool: tests/stagefile.cwl id: writable_stagedfiles - doc: Test writable staged files. + doc: Test writable staged files using InitialWorkDirRequirement. tags: [ initial_work_dir, command_line_tool ] - job: tests/file-literal.yml @@ -1205,7 +1205,7 @@ size: 0 tool: tests/linkfile.cwl id: initial_workdir_expr - doc: Test expression in InitialWorkDir listing + doc: Test expression in InitialWorkDirRequirement listing tags: [ initial_work_dir, command_line_tool ] - job: tests/wc-job.json @@ -1448,7 +1448,7 @@ } tool: tests/recursive-input-directory.cwl id: input_dir_recurs_copy_writable - doc: Test if a writable input directory is recursively copied and writable + doc: Test if a writable IWDR input directory is recursively copied and writable tags: [ initial_work_dir, shell_command, command_line_tool ] - output: @@ -1502,7 +1502,7 @@ output: {} tool: tests/initialwork-path.cwl id: initialworkpath_output - doc: Test that file path in $(inputs) for initialworkdir is in $(outdir). + doc: Test that file path in $(inputs) for initialWorkDirRequirement is in $(outdir). tags: [ initial_work_dir, command_line_tool ] - job: tests/count-lines6-job.json @@ -2690,7 +2690,7 @@ - job: tests/empty.json output: {} tool: tests/networkaccess.cwl - doc: Test networkaccess enabled + doc: Test networkaccess enabled using the NetworkAccess requirement id: networkaccess tags: [ command_line_tool, networkaccess ] @@ -2747,7 +2747,7 @@ tool: tests/env-tool3.cwl id: cwl_requirements_addition doc: Test requirements in input document via EnvVarRequirement - tags: [ command_line_tool, input_object_requirements ] + tags: [ command_line_tool, input_object_requirements, env_var ] - job: tests/env-job3.yaml output: @@ -2759,7 +2759,7 @@ tool: tests/env-tool4.cwl id: cwl_requirements_override_expression doc: Test conflicting requirements in input document via EnvVarRequirement and expression - tags: [ command_line_tool, input_object_requirements ] + tags: [ command_line_tool, input_object_requirements, env_var ] - job: tests/env-job4.yaml output: @@ -2771,7 +2771,7 @@ id: cwl_requirements_override_static tool: tests/env-tool3.cwl doc: Test conflicting requirements in input document via EnvVarRequirement - tags: [ command_line_tool, input_object_requirements ] + tags: [ command_line_tool, input_object_requirements, env_var ] - job: tests/initialworkdirrequirement-docker-out-job.json output: @@ -2788,7 +2788,7 @@ "size": 12010 tool: tests/initialworkdir-glob-fullpath.cwl id: initial_workdir_output_glob - doc: Test full path glob output of InitialWorkDir + doc: Test full path glob output of InitialWorkDirRequirement tags: [ initial_work_dir, command_line_tool ] - job: tests/empty.json @@ -2825,8 +2825,8 @@ - job: tests/empty.json tool: tests/inp_update_wf.cwl - doc: inplace update has side effect on file content - tags: [ inplace_update, workflow ] + doc: inplace update has side effect on file content (using InitialWorkDirRequirement) + tags: [ inplace_update, workflow, initial_work_dir ] output: a: 4 b: 4 @@ -2834,8 +2834,8 @@ - job: tests/empty.json tool: tests/inpdir_update_wf.cwl - doc: inplace update has side effect on directory content - tags: [ inplace_update, workflow ] + doc: inplace update has side effect on directory content (using InitialWorkDirRequirement) + tags: [ inplace_update, workflow, initial_work_dir ] output: { a: [ { @@ -2871,7 +2871,7 @@ listing: [] tags: [ required, command_line_tool ] -- doc: Test that array of input files can be staged to directory with entryname +- doc: Test that array of input files can be staged to directory with InitialWorkDirRequirement entryname id: stage_file_array tool: tests/stage_file_array.cwl job: tests/stage_file_array.job.json @@ -2939,7 +2939,7 @@ ] tags: [ command_line_tool, initial_work_dir, inline_javascript ] -- doc: Test that if array of input files are staged to directory with basename and entryname, entryname overrides +- doc: Test that if array of input files are staged using InitialWorkDirRequirement to directory with basename and entryname, entryname overrides id: stage_file_array_entryname_overrides tool: tests/stage_file_array_basename_and_entryname.cwl job: tests/stage_file_array.job.json @@ -3527,3 +3527,477 @@ an_int: 42 - $import: tests/loop/test-index.yaml + +- job: tests/empty.json + output: {} + tool: tests/networkaccess_noreq.cwl + doc: Test networkAcccess enabled using the networkAccess field + id: networkaccess_noreq + tags: [ command_line_tool, networkaccess ] + +- job: tests/env-job.json + output: + out: + class: File + checksum: sha1$b3ec4ed1749c207e52b3a6d08c59f31d83bff519 + location: out + size: 15 + tool: tests/env-tool1_noreq.cwl + id: envvar_noreq + doc: Test CommandLineTool.envDef + tags: [ env_var, command_line_tool ] + +- job: tests/env-job.json + output: + out: + class: File + checksum: sha1$b3ec4ed1749c207e52b3a6d08c59f31d83bff519 + location: out + size: 15 + tool: tests/env-wf1_noreq.cwl + id: requirement_priority_noreq + doc: | + Test requirement priority: EnvVarRequirement + CommandLineTool.envDef + tags: [ env_var, workflow ] + +- job: tests/env-job3.yaml + output: + out: + class: File + checksum: sha1$b3ec4ed1749c207e52b3a6d08c59f31d83bff519 + location: out + size: 15 + tool: tests/env-tool4_noreq.cwl + id: cwl_envdef_override_expression + doc: Test conflicting requirements in input document via envDef and expression + tags: [ command_line_tool, input_object_requirements, env_var ] + +- job: tests/dir-job.yml + output: { + "outlist": { + "checksum": "sha1$13cda8661796ae241da3a18668fb552161a72592", + "size": 20, + "location": "output.txt", + "class": "File" + } + } + tool: tests/dir5_noiwdr.cwl + id: dynamic_initial_workdir_noreq + doc: Test dynamic initialWorkDir + tags: [ shell_command, initial_work_dir, command_line_tool ] + +- job: tests/initialworkdirrequirement-docker-out-job.json + output: + OUTPUT: + "checksum": "sha1$aeb3d11bdf536511649129f4077d5cda6a324118" + "location": "ref.fasta" + "secondaryFiles": [{ + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "location": "ref.fasta.fai", + "class": "File", + "size": 0 + }] + "class": "File" + "size": 12010 + tool: tests/initialworkdir-glob-fullpath_noiwdr.cwl + id: initial_workdir_output_glob_noreq + doc: Test full path glob output of initialWorkDir + tags: [ initial_work_dir, command_line_tool ] + +- job: tests/wc-job.json + output: {} + tool: tests/initialwork-path_noiwdr.cwl + id: initialworkpath_output_noreq + doc: Test that file path in $(inputs) for initialWorkDir is in $(outdir). + tags: [ initial_work_dir, command_line_tool ] + +- job: tests/string-job.json + output: + out: + class: File + checksum: sha1$6a47aa22b2a9d13a66a24b3ee5eaed95ce4753cf + location: example.conf + size: 16 + tool: tests/iwdr-entry_noreq.cwl + id: initial_workdir_trailingnl_noreq + doc: Test if trailing newline is present in file entry in initialWorkDir + tags: [ initial_work_dir, command_line_tool ] + +- doc: Test initialWorkDir with a nested directory structure from another step + job: tests/empty.json + output: + ya_empty: + class: File + checksum: sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709 + location: ya + size: 0 + tool: tests/iwdr_with_nested_dirs_noreq.cwl + id: initialworkdir_nesteddir_noreq + tags: [ initial_work_dir, workflow ] + +- job: tests/arguments-job.yml + output: + classfile: + checksum: sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709 + location: Hello.class + class: File + size: 0 + tool: tests/linkfile_noreq.cwl + id: initial_workdir_expr_noreq + doc: Test expression in initialWorkDir + tags: [ initial_work_dir, command_line_tool ] + +- job: tests/recursive-input-directory.yml + output: + output_dir: { + "basename": "work_dir", + "class": "Directory", + "listing": [ + { + "basename": "a", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "work_dir/a", + "size": 0 + }, + { + "basename": "b", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "work_dir/b", + "size": 0 + }, + { + "basename": "c", + "class": "Directory", + "listing": [ + { + "basename": "d", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "work_dir/c/d", + "size": 0 + } + ], + "location": "work_dir/c", + }, + { + "basename": "e", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "work_dir/e", + "size": 0 + }, + ], + "location": "work_dir", + } + test_result: { + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "output.txt", + "size": 0 + } + tool: tests/recursive-input-directory_noiwdr.cwl + id: input_dir_recurs_copy_writable_noiwdr + doc: Test if a writable initialWorkDir input directory is recursively copied and writable + tags: [ initial_work_dir, shell_command, command_line_tool ] + +- job: tests/rename-job.json + output: + outfile: + class: File + checksum: sha1$327fc7aedf4f6b69a42a7c8b808dc5a7aff61376 + location: fish.txt + size: 1111 + tool: tests/rename_noreq.cwl + id: rename_noreq + doc: >- + Test initialWorkDir with expression in filename. + tags: [ initial_work_dir, command_line_tool ] + +- job: tests/search-job.json + output: + outfile: + class: File + checksum: sha1$e2dc9daaef945ac15f01c238ed2f1660f60909a0 + location: result.txt + size: 142 + indexedfile: { + "location": "input.txt", + "class": "File", + "checksum": "sha1$327fc7aedf4f6b69a42a7c8b808dc5a7aff61376", + "secondaryFiles": [ + { + "location": "input.txt.idx1", + "class": "File", + "checksum": "sha1$1f6fe811644355974cdd06d9eb695d6e859f3b44", + "size": 1500 + }, + { + "location": "input.idx2", + "class": "File", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0 + }, + { + "location": "input.txt.idx3", + "class": "File", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0 + }, + { + "location": "input.txt.idx4", + "class": "File", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0 + }, + { + "location": "input.txt.idx5", + "class": "File", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0 + }, + { + "location": "input.idx6.txt", + "class": "File", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0 + }, + { + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "input.txt.idx7", + "size": 0 + }, + { + "checksum": "sha1$47a013e660d408619d894b20806b1d5086aab03b", + "class": "File", + "location": "hello.txt", + "size": 13 + }, + { + "class": "Directory", + "listing": [{ + "basename": "index", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "index", + "size": 0 + }], + "location": "input.txt_idx8", + } + ], + "size": 1111 + } + tool: "tests/search_noiwdr.cwl#main" + id: initial_workdir_secondary_files_expr_noiwdr + doc: >- + Test initialWorkDir linking input files and capturing secondaryFiles + on input and output. Also tests the use of a variety of parameter references + and expressions in the secondaryFiles field. + tags: [ initial_work_dir, inline_javascript, workflow ] + +- job: tests/stage-array-job.json + tool: tests/stage-array_noiwdr.cwl + doc: Test null and array input in initialWorkDir + output: + "output": { + "basename": "lsout", + "checksum": "sha1$e453d26efd859a9abc80ae1a1d9d63db72376053", + "class": "File", + "location": "lsout", + "size": 32 + } + tags: [ resource, command_line_tool, initial_work_dir ] + id: initial_work_dir_for_null_and_arrays_noreq + +- job: tests/stage-array-dirs-job.yml + tool: tests/stage-array-dirs_noreq.cwl + doc: Test array of directories initialWorkDir + output: { + "output": [ + { + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "a", + "size": 0 + }, + { + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "class": "File", + "location": "B", + "size": 0 + } + ] + } + tags: [ resource, command_line_tool, initial_work_dir ] + id: initial_work_dir_for_array_dirs_noreq + +- doc: Test that array of input files can be staged to directory with initialWorkDir.entryname + id: stage_file_array_noiwdr + tool: tests/stage_file_array_noiwdr.cwl + job: tests/stage_file_array.job.json + output: + output: + [ + { + "basename": "sfa-1.txt", + "checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6", + "class": "File", + "size": 49 + }, + { + "basename": "sfa-1.txt.sec", + "checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a", + "class": "File", + "size": 59 + }, + { + "basename": "sfa-2.txt", + "checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6", + "class": "File", + "size": 49 + }, + { + "basename": "sfa-2.txt.sec", + "checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a", + "class": "File", + "size": 59 + } + ] + tags: [ command_line_tool, initial_work_dir, inline_javascript ] + +- doc: Test that if array of input files are staged using initialWorkDir to a directory with basename and entryname, entryname overrides + id: stage_file_array_entryname_overrides_noiwdr + tool: tests/stage_file_array_basename_and_entryname_noiwdr.cwl + job: tests/stage_file_array.job.json + output: + output: + [ + { + "basename": "sfa-1.txt", + "checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6", + "class": "File", + "size": 49 + }, + { + "basename": "sfa-1.txt.sec", + "checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a", + "class": "File", + "size": 59 + }, + { + "basename": "sfa-2.txt", + "checksum": "sha1$4c1cd0638ab3580310823fd1556d27ecb4816df6", + "class": "File", + "size": 49 + }, + { + "basename": "sfa-2.txt.sec", + "checksum": "sha1$40f4ee1bcd1a9466fcd2e48cf7fc3798025d2f9a", + "class": "File", + "size": 59 + } + ] + tags: [ command_line_tool, initial_work_dir, inline_javascript ] + +- job: tests/stagefile-job.yml + output: { + "outfile": { + "checksum": "sha1$b769c7b2e316edd4b5eb2d24799b2c1f9d8c86e6", + "size": 1111, + "location": "bob.txt", + "class": "File" + } + } + tool: tests/stagefile_noreq.cwl + id: writable_stagedfiles_noreq + doc: Test writable staged files using initialWorkDir. + tags: [ initial_work_dir, command_line_tool ] + +- output: + "foo": { + "checksum": "sha1$63da67422622fbf9251a046d7a34b7ea0fd4fead", + "class": "File", + "location": "foo.txt", + "size": 22 + } + job: tests/cat-job.json + tool: tests/template-tool_noiwdr.cwl + id: initworkdir_expreng_requirements_noiwdr + doc: Test initialWorkDir ExpressionEngineRequirement.engineConfig feature + tags: [ initial_work_dir, inline_javascript, command_line_tool ] + +- job: tests/empty.json + tool: tests/inpdir_update_wf_noiwdr.cwl + doc: inplace update has side effect on directory content (using initialWorkDir) + tags: [ inplace_update, workflow, initial_work_dir ] + output: { + a: [ + { + "basename": "blurb", + "class": "File", + "location": "blurb" + } + ], + b: [ + { + "basename": "blurb", + "class": "File", + "location": "blurb" + } + ] + } + id: modify_directory_content_noiwdr + +- job: tests/empty.json + tool: tests/inp_update_wf_noiwdr.cwl + doc: inplace update has side effect on file content (using initialWorkDir) + tags: [ inplace_update, workflow, initial_work_dir ] + output: + a: 4 + b: 4 + id: modify_file_content + +- job: tests/empty.json + output: + out: { + "basename": "emptyWritableDir", + "listing": [ + { + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "basename": "blurg", + "location": "blurg", + "class": "File", + "size": 0 + } + ], + "location": "emptyWritableDir", + "class": "Directory" + } + tool: tests/writable-dir_noiwdr.cwl + id: initial_workdir_empty_writable_noiwdr + doc: Test empty writable dir with initialWorkDir + tags: [ inline_javascript, initial_work_dir, command_line_tool ] + + +- job: tests/empty.json + output: + out: { + "basename": "emptyWritableDir", + "listing": [ + { + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "basename": "blurg", + "location": "blurg", + "class": "File", + "size": 0 + } + ], + "location": "emptyWritableDir", + "class": "Directory" + } + tool: tests/writable-dir-docker_noiwdr.cwl + id: initial_workdir_empty_writable_docker_noiwdr + doc: Test empty writable dir with initialWorkDir inside Docker + tags: [ inline_javascript, initial_work_dir, command_line_tool ] diff --git a/tests/dir5_noiwdr.cwl b/tests/dir5_noiwdr.cwl new file mode 100644 index 0000000..485b90e --- /dev/null +++ b/tests/dir5_noiwdr.cwl @@ -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 diff --git a/tests/env-tool1_noreq.cwl b/tests/env-tool1_noreq.cwl new file mode 100644 index 0000000..4551536 --- /dev/null +++ b/tests/env-tool1_noreq.cwl @@ -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 diff --git a/tests/env-tool4_noreq.cwl b/tests/env-tool4_noreq.cwl new file mode 100644 index 0000000..8393cb0 --- /dev/null +++ b/tests/env-tool4_noreq.cwl @@ -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 diff --git a/tests/env-wf1_noreq.cwl b/tests/env-wf1_noreq.cwl new file mode 100644 index 0000000..da1c032 --- /dev/null +++ b/tests/env-wf1_noreq.cwl @@ -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] diff --git a/tests/initialwork-path_noiwdr.cwl b/tests/initialwork-path_noiwdr.cwl new file mode 100644 index 0000000..e89d86f --- /dev/null +++ b/tests/initialwork-path_noiwdr.cwl @@ -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" diff --git a/tests/initialworkdir-glob-fullpath_noiwdr.cwl b/tests/initialworkdir-glob-fullpath_noiwdr.cwl new file mode 100644 index 0000000..7b8c0a7 --- /dev/null +++ b/tests/initialworkdir-glob-fullpath_noiwdr.cwl @@ -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] diff --git a/tests/initialworkdirrequirement-docker-out_noiwdr.cwl b/tests/initialworkdirrequirement-docker-out_noiwdr.cwl new file mode 100644 index 0000000..7898665 --- /dev/null +++ b/tests/initialworkdirrequirement-docker-out_noiwdr.cwl @@ -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] diff --git a/tests/inp_update_wf_noiwdr.cwl b/tests/inp_update_wf_noiwdr.cwl new file mode 100644 index 0000000..fe86e5c --- /dev/null +++ b/tests/inp_update_wf_noiwdr.cwl @@ -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 diff --git a/tests/inpdir_update_wf_noiwdr.cwl b/tests/inpdir_update_wf_noiwdr.cwl new file mode 100644 index 0000000..2e539a4 --- /dev/null +++ b/tests/inpdir_update_wf_noiwdr.cwl @@ -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})" diff --git a/tests/iwd/iwd-container-entryname1_noiwdr.cwl b/tests/iwd/iwd-container-entryname1_noiwdr.cwl new file mode 100644 index 0000000..3b861e6 --- /dev/null +++ b/tests/iwd/iwd-container-entryname1_noiwdr.cwl @@ -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"} diff --git a/tests/iwd/iwd-container-entryname2_noiwdr.cwl b/tests/iwd/iwd-container-entryname2_noiwdr.cwl new file mode 100644 index 0000000..b06a72c --- /dev/null +++ b/tests/iwd/iwd-container-entryname2_noiwdr.cwl @@ -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"} diff --git a/tests/iwd/iwd-container-entryname3_noiwdr.cwl b/tests/iwd/iwd-container-entryname3_noiwdr.cwl new file mode 100644 index 0000000..4e63e48 --- /dev/null +++ b/tests/iwd/iwd-container-entryname3_noiwdr.cwl @@ -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"} diff --git a/tests/iwd/iwd-container-entryname4_noiwdr.cwl b/tests/iwd/iwd-container-entryname4_noiwdr.cwl new file mode 100644 index 0000000..1f866d9 --- /dev/null +++ b/tests/iwd/iwd-container-entryname4_noiwdr.cwl @@ -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"} diff --git a/tests/iwd/iwd-fileobjs1_noiwdr.cwl b/tests/iwd/iwd-fileobjs1_noiwdr.cwl new file mode 100644 index 0000000..3f87a30 --- /dev/null +++ b/tests/iwd/iwd-fileobjs1_noiwdr.cwl @@ -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" diff --git a/tests/iwd/iwd-fileobjs2_noiwdr.cwl b/tests/iwd/iwd-fileobjs2_noiwdr.cwl new file mode 100644 index 0000000..6aef62b --- /dev/null +++ b/tests/iwd/iwd-fileobjs2_noiwdr.cwl @@ -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" diff --git a/tests/iwd/iwd-jsondump1-nl_noiwdr.cwl b/tests/iwd/iwd-jsondump1-nl_noiwdr.cwl new file mode 100644 index 0000000..68d1596 --- /dev/null +++ b/tests/iwd/iwd-jsondump1-nl_noiwdr.cwl @@ -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"] diff --git a/tests/iwd/iwd-jsondump1_noiwdr.cwl b/tests/iwd/iwd-jsondump1_noiwdr.cwl new file mode 100644 index 0000000..c0e560b --- /dev/null +++ b/tests/iwd/iwd-jsondump1_noiwdr.cwl @@ -0,0 +1,23 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entryname: "out-filelist.json" + entry: |- + ${ + var ls = []; + for (var i = 1; i < 10000; i++) { + ls.push("example_input_file"+i+".txt"); + } + return ls; + } +inputs: [] +outputs: + filelist: + type: File + outputBinding: + glob: out-filelist.json +arguments: ["true"] diff --git a/tests/iwd/iwd-jsondump2-nl_noiwdr.cwl b/tests/iwd/iwd-jsondump2-nl_noiwdr.cwl new file mode 100644 index 0000000..b69800c --- /dev/null +++ b/tests/iwd/iwd-jsondump2-nl_noiwdr.cwl @@ -0,0 +1,23 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entryname: "out-filelist.json" + entry: | + ${ + var ls = []; + for (var i = 1; i < 10000; i++) { + ls.push("example_input_file"+i+".txt"); + } + return {"filelist": ls}; + } +inputs: [] +outputs: + filelist: + type: File + outputBinding: + glob: out-filelist.json +arguments: ["true"] diff --git a/tests/iwd/iwd-jsondump2_noiwdr.cwl b/tests/iwd/iwd-jsondump2_noiwdr.cwl new file mode 100644 index 0000000..84d7220 --- /dev/null +++ b/tests/iwd/iwd-jsondump2_noiwdr.cwl @@ -0,0 +1,23 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entryname: "out-filelist.json" + entry: |- + ${ + var ls = []; + for (var i = 1; i < 10000; i++) { + ls.push("example_input_file"+i+".txt"); + } + return {"filelist": ls}; + } +inputs: [] +outputs: + filelist: + type: File + outputBinding: + glob: out-filelist.json +arguments: ["true"] diff --git a/tests/iwd/iwd-jsondump3-nl_noiwdr.cwl b/tests/iwd/iwd-jsondump3-nl_noiwdr.cwl new file mode 100644 index 0000000..4d92a00 --- /dev/null +++ b/tests/iwd/iwd-jsondump3-nl_noiwdr.cwl @@ -0,0 +1,19 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entryname: "out-number.json" + entry: | + ${ + return 44.4; + } +inputs: [] +outputs: + filelist: + type: File + outputBinding: + glob: out-number.json +arguments: ["true"] diff --git a/tests/iwd/iwd-jsondump3_noiwdr.cwl b/tests/iwd/iwd-jsondump3_noiwdr.cwl new file mode 100644 index 0000000..24a679b --- /dev/null +++ b/tests/iwd/iwd-jsondump3_noiwdr.cwl @@ -0,0 +1,19 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entryname: "out-number.json" + entry: |- + ${ + return 44.4; + } +inputs: [] +outputs: + filelist: + type: File + outputBinding: + glob: out-number.json +arguments: ["true"] diff --git a/tests/iwd/iwd-nolimit_noiwdr.cwl b/tests/iwd/iwd-nolimit_noiwdr.cwl new file mode 100644 index 0000000..0394af1 --- /dev/null +++ b/tests/iwd/iwd-nolimit_noiwdr.cwl @@ -0,0 +1,24 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + + +initialWorkDir: + - entryname: "out-filelist.txt" + entry: |- + ${ + var ls = ""; + for (var i = 1; i < 10000; i++) { + ls += "example_input_file"+i+".txt\n"; + } + return ls; + } +inputs: [] +outputs: + filelist: + type: File + outputBinding: + glob: out-filelist.txt +baseCommand: "true" diff --git a/tests/iwd/iwd-passthrough1_noreq.cwl b/tests/iwd/iwd-passthrough1_noreq.cwl new file mode 100644 index 0000000..1a9c0b1 --- /dev/null +++ b/tests/iwd/iwd-passthrough1_noreq.cwl @@ -0,0 +1,22 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +doc: | + YAML |- syntax does not add trailing newline so in the listing entry + below there is no whitespace surrounding the value + $(inputs.filelist), so it is evaluated as a File object. Compare to + iwd-passthrough2.cwl + +initialWorkDir: + - entryname: "renamed-filelist.txt" + entry: |- + $(inputs.filelist) +inputs: + filelist: + type: File +outputs: + filelist: + type: File + outputBinding: + glob: renamed-filelist.txt +baseCommand: "true" diff --git a/tests/iwd/iwd-passthrough2_noiwdr.cwl b/tests/iwd/iwd-passthrough2_noiwdr.cwl new file mode 100644 index 0000000..4b9653c --- /dev/null +++ b/tests/iwd/iwd-passthrough2_noiwdr.cwl @@ -0,0 +1,29 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +doc: | + YAML | syntax adds a trailing newline, so in the listing entry + below, it becomes a string interpolation -- it evaluates to a string + consisting of $(inputs.filelist) serialized to JSON and then adding + a newline. Compare to iwd-passthrough1.cwl + +requirements: + DockerRequirement: + dockerPull: docker.io/python:3-slim + +initialWorkDir: + - entryname: "renamed-filelist.txt" + entry: | + $(inputs.filelist) + +inputs: + filelist: File + script: + type: File + default: + class: File + location: loadit.py +stdout: out.txt +outputs: + out: stdout +arguments: [python3, $(inputs.script), "renamed-filelist.txt"] diff --git a/tests/iwd/iwd-passthrough3_noreq.cwl b/tests/iwd/iwd-passthrough3_noreq.cwl new file mode 100644 index 0000000..9997859 --- /dev/null +++ b/tests/iwd/iwd-passthrough3_noreq.cwl @@ -0,0 +1,15 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +initialWorkDir: + - entryname: "renamed-filelist.txt" + entry: $(inputs.filelist) +inputs: + filelist: + type: File +outputs: + filelist: + type: File + outputBinding: + glob: renamed-filelist.txt +baseCommand: "true" diff --git a/tests/iwd/iwd-passthrough4_noreq.cwl b/tests/iwd/iwd-passthrough4_noreq.cwl new file mode 100644 index 0000000..7fff53f --- /dev/null +++ b/tests/iwd/iwd-passthrough4_noreq.cwl @@ -0,0 +1,14 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +initialWorkDir: + - $(inputs.filelist) +inputs: + filelist: + type: File +outputs: + filelist: + type: File + outputBinding: + glob: $(inputs.filelist.basename) +baseCommand: "true" diff --git a/tests/iwd/iwd-passthrough5_noreq.cwl b/tests/iwd/iwd-passthrough5_noreq.cwl new file mode 100644 index 0000000..2ac858f --- /dev/null +++ b/tests/iwd/iwd-passthrough5_noreq.cwl @@ -0,0 +1,15 @@ +class: CommandLineTool +cwlVersion: v1.2 +doc: Given a directory, emit it unchanged +initialWorkDir: + - entry: $(inputs.testdir) + writable: false +inputs: + testdir: + type: Directory +outputs: + testdir: + type: Directory + outputBinding: + glob: $(inputs.testdir.basename) +baseCommand: "true" diff --git a/tests/iwd/iwd-subdir-tool_noreq.cwl b/tests/iwd/iwd-subdir-tool_noreq.cwl new file mode 100644 index 0000000..819ce5f --- /dev/null +++ b/tests/iwd/iwd-subdir-tool_noreq.cwl @@ -0,0 +1,15 @@ +class: CommandLineTool +cwlVersion: v1.2 +doc: Given an input directory, emit a subdirectory as output +initialWorkDir: + - entry: $(inputs.testdir) + writable: false +inputs: + testdir: + type: Directory +outputs: + testdir: + type: Directory + outputBinding: + glob: testdir/c +baseCommand: "true" diff --git a/tests/iwd/iwd-subdir-wf_noreq.cwl b/tests/iwd/iwd-subdir-wf_noreq.cwl new file mode 100644 index 0000000..a169e51 --- /dev/null +++ b/tests/iwd/iwd-subdir-wf_noreq.cwl @@ -0,0 +1,19 @@ +class: Workflow +cwlVersion: v1.2 +inputs: + testdir: Directory +outputs: + out: + type: Directory + outputSource: step2/testdir +steps: + step1: + run: iwd-subdir-tool_noreq.cwl + in: + testdir: testdir + out: [testdir] + step2: + run: iwd-passthrough5_noreq.cwl + in: + testdir: step1/testdir + out: [testdir] diff --git a/tests/iwd/iwd_dir_literal_real_file.cwl b/tests/iwd/iwd_dir_literal_real_file.cwl new file mode 100644 index 0000000..27458e7 --- /dev/null +++ b/tests/iwd/iwd_dir_literal_real_file.cwl @@ -0,0 +1,25 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 + +requirements: + DockerRequirement: + dockerPull: docker.io/debian:stable-slim + InlineJavascriptRequirement: {} + +initialWorkDir: | + ${ + return [{"class": "Directory", + "basename": "subdir", + "listing": [ inputs.filelist ] + }]} + +inputs: + filelist: File + +outputs: + same: + type: File + outputBinding: + glob: subdir/$(inputs.filelist.basename) + +baseCommand: echo diff --git a/tests/iwd/test-index.yaml b/tests/iwd/test-index.yaml index d39f474..34ee8df 100644 --- a/tests/iwd/test-index.yaml +++ b/tests/iwd/test-index.yaml @@ -9,7 +9,7 @@ "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", "size": 268866, } - doc: "Test that InitialWorkDir contents can be bigger than 64k" + doc: "Test that InitialWorkDirRequirement contents can be bigger than 64k" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -23,7 +23,7 @@ "checksum": "sha1$5bbeb2a75327927cb97d7e9716c8299682001b36", "size": 298863 } - doc: "Test dump object to JSON in InitialWorkDir file contents, no trailing newline" + doc: "Test dump object to JSON in InitialWorkDirRequirement file contents, no trailing newline" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -37,7 +37,7 @@ "checksum": "sha1$7307f027449371b3642c1f7c32124218af0e41b5", "size": 298864 } - doc: "Test dump object to JSON in InitialWorkDir file contents, with trailing newline" + doc: "Test dump object to JSON in InitialWorkDirRequirement file contents, with trailing newline" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -51,7 +51,7 @@ "checksum": "sha1$a0e2225d47c9ed2f07e7633d00dd19d1cbf65c9f", "size": 298877, } - doc: "Test array to JSON in InitialWorkDir file contents, no trailing newline" + doc: "Test array to JSON in InitialWorkDirRequirement file contents, no trailing newline" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -65,7 +65,7 @@ "checksum": "sha1$750c95cb45561cd1d863506f82a1a75fffd53a54", "size": 298878, } - doc: "Test array to JSON in InitialWorkDir file contents, with trailing newline" + doc: "Test array to JSON in InitialWorkDirRequirement file contents, with trailing newline" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -79,7 +79,7 @@ "checksum": "sha1$356b190d3274c960b34c2c9538023dda438d67d4", "size": 4, } - doc: "Test number to JSON in InitialWorkDir file contents, no trailing newline" + doc: "Test number to JSON in InitialWorkDirRequirement file contents, no trailing newline" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -93,7 +93,7 @@ "checksum": "sha1$0b02e6b07d199025bfdcfc6b9830d550a0a6bde9", "size": 5, } - doc: "Test number to JSON in InitialWorkDir file contents, with trailing newline" + doc: "Test number to JSON in InitialWorkDirRequirement file contents, with trailing newline" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml @@ -107,7 +107,7 @@ "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", "size": 268866, } - doc: "Test InitialWorkDir file passthrough" + doc: "Test InitialWorkDirRequirement file passthrough" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml @@ -121,7 +121,7 @@ "checksum": "sha1$406e83b1cd694780f1b3ea4fe8fbb754511fe3f7", "size": 49, } - doc: "Test InitialWorkDir file object is serialized to json" + doc: "Test InitialWorkDirRequirement file object is serialized to json" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml @@ -135,7 +135,7 @@ "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", "size": 268866, } - doc: "Test InitialWorkDir file object is passed through" + doc: "Test InitialWorkDirRequirement file object is passed through" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml @@ -149,7 +149,7 @@ "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", "size": 268866, } - doc: "Test InitialWorkDir file object is passed through" + doc: "Test InitialWorkDirRequirement file object is passed through" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -198,7 +198,7 @@ } ], } - doc: "Test File and Directory object in listing" + doc: "Test File and Directory object in InitialWorkDirRequirement.listing" tags: [ initial_work_dir, command_line_tool ] - job: null @@ -247,7 +247,7 @@ } ], } - doc: "Test File and Directory object in listing" + doc: "Test File and Directory object in InitialWorkDirRequirement.listing" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml @@ -268,27 +268,27 @@ id: iwd-container-entryname2 tool: iwd-container-entryname2.cwl should_fail: true - doc: "Test input mount locations when no container (should fail)" + doc: "Test InitialWorkDirRequirement input mount locations when no container (should fail)" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml id: iwd-container-entryname3 tool: iwd-container-entryname3.cwl should_fail: true - doc: "Test input mount locations when container is a hint (should fail)" + doc: "Test InitialWorkDirRequirement input mount locations when container is a hint (should fail)" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml id: iwd-container-entryname4 tool: iwd-container-entryname4.cwl should_fail: true - doc: "Must fail if entryname starts with ../" + doc: "Must fail if InitialWorkDirRequirement.entryname starts with ../" tags: [ initial_work_dir, command_line_tool ] - job: ../loadContents/input.yml id: iwdr_dir_literal_real_file tool: iwdr_dir_literal_real_file.cwl - doc: "Test directory literal containing a real file" + doc: "Test InitialWorkDirRequirement directory literal containing a real file" output: same: "location": "inp-filelist.txt" @@ -301,7 +301,7 @@ - job: iwd-subdir-job.yml id: iwd-subdir tool: iwd-subdir-wf.cwl - doc: "Test emitting a subdirectory from initial workdir" + doc: "Test emitting a subdirectory from InitialWorkDirRequirement" output: "out": { "location": "c", @@ -318,3 +318,324 @@ ] } tags: [ initial_work_dir, command_line_tool, workflow ] + +- job: ../loadContents/input.yml + id: iwd-container-entryname1_noreq + tool: iwd-container-entryname1_noiwdr.cwl + output: + "head": { + "location": "head.txt", + "basename": "head.txt", + "class": "File", + "checksum": "sha1$8b5071fa49953fcdb8729b16345b7c894b493f83", + "size": 241 + } + doc: "Test input mount locations when container required" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-container-entryname2_noreq + tool: iwd-container-entryname2_noiwdr.cwl + should_fail: true + doc: "Test initialWorkDir input mount locations when no container (should fail)" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-container-entryname3_noreq + tool: iwd-container-entryname3_noiwdr.cwl + should_fail: true + doc: "Test initialWorkDir input mount locations when container is a hint (should fail)" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-container-entryname4_noreq + tool: iwd-container-entryname4_noiwdr.cwl + should_fail: true + doc: "Must fail if initialWorkDir.entryname starts with ../" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-fileobjs1_noreq + tool: iwd-fileobjs1_noiwdr.cwl + output: + "filelist": { + "location": "inp-filelist.txt", + "basename": "inp-filelist.txt", + "class": "File", + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", + "size": 268866, + } + "testdir": { + "location": "testdir", + "basename": "testdir", + "class": "Directory", + "listing": [ + { + "class": "File", + "location": "b", + "basename": "b", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0, + }, + { + "class": "Directory", + "location": "c", + "basename": "c", + "listing": [ + { + "class": "File", + "location": "d", + "basename": "d", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0, + } + ], + }, + { + "class": "File", + "location": "a", + "basename": "a", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0, + } + ], + } + doc: "Test File and Directory object in initialWorkDir" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-fileobjs2_noreq + tool: iwd-fileobjs2_noiwdr.cwl + output: + "filelist": { + "location": "inp-filelist.txt", + "basename": "inp-filelist.txt", + "class": "File", + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", + "size": 268866, + } + "testdir": { + "location": "testdir", + "basename": "testdir", + "class": "Directory", + "listing": [ + { + "class": "File", + "location": "b", + "basename": "b", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0, + }, + { + "class": "Directory", + "location": "c", + "basename": "c", + "listing": [ + { + "class": "File", + "location": "d", + "basename": "d", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0, + } + ], + }, + { + "class": "File", + "location": "a", + "basename": "a", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0, + } + ], + } + doc: "Test File and Directory object in initialWorkDir" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-jsondump1_noreq + tool: iwd-jsondump1_noiwdr.cwl + output: + "filelist": { + "location": "out-filelist.json", + "basename": "out-filelist.json", + "class": "File", + "checksum": "sha1$5bbeb2a75327927cb97d7e9716c8299682001b36", + "size": 298863 + } + doc: "Test dump object to JSON in initialWorkDir file contents, no trailing newline" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-jsondump1-nl_noreq + tool: iwd-jsondump1-nl_noiwdr.cwl + output: + "filelist": { + "location": "out-filelist.json", + "basename": "out-filelist.json", + "class": "File", + "checksum": "sha1$7307f027449371b3642c1f7c32124218af0e41b5", + "size": 298864 + } + doc: "Test dump object to JSON in initialWorkDir file contents, with trailing newline" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-jsondump2-noreq + tool: iwd-jsondump2_noiwdr.cwl + output: + "filelist": { + "location": "out-filelist.json", + "basename": "out-filelist.json", + "class": "File", + "checksum": "sha1$a0e2225d47c9ed2f07e7633d00dd19d1cbf65c9f", + "size": 298877, + } + doc: "Test array to JSON in initialWorkDir file contents, no trailing newline" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-jsondump2-nl-noreq + tool: iwd-jsondump2-nl_noiwdr.cwl + output: + "filelist": { + "location": "out-filelist.json", + "basename": "out-filelist.json", + "class": "File", + "checksum": "sha1$750c95cb45561cd1d863506f82a1a75fffd53a54", + "size": 298878, + } + doc: "Test array to JSON in initialWorkDir file contents, with trailing newline" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-jsondump3-noreq + tool: iwd-jsondump3_noiwdr.cwl + output: + "filelist": { + "location": "out-number.json", + "basename": "out-number.json", + "class": "File", + "checksum": "sha1$356b190d3274c960b34c2c9538023dda438d67d4", + "size": 4, + } + doc: "Test number to JSON in initialWorkDir file contents, no trailing newline" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-jsondump3-nl-noreq + tool: iwd-jsondump3-nl_noiwdr.cwl + output: + "filelist": { + "location": "out-number.json", + "basename": "out-number.json", + "class": "File", + "checksum": "sha1$0b02e6b07d199025bfdcfc6b9830d550a0a6bde9", + "size": 5, + } + doc: "Test number to JSON in initialWorkDir file contents, with trailing newline" + tags: [ initial_work_dir, command_line_tool ] + +- job: null + id: iwd-nolimit-noreq + tool: iwd-nolimit_noiwdr.cwl + output: + "filelist": { + "location": "out-filelist.txt", + "basename": "out-filelist.txt", + "class": "File", + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", + "size": 268866, + } + doc: "Test that initialWorkDir contents can be bigger than 64k" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-passthrough1-noreq + tool: iwd-passthrough1_noreq.cwl + output: + "filelist": { + "location": "renamed-filelist.txt", + "basename": "renamed-filelist.txt", + "class": "File", + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", + "size": 268866, + } + doc: "Test initialWorkDir file passthrough" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-passthrough2-noreq + tool: iwd-passthrough2_noiwdr.cwl + output: + "out": { + "location": "out.txt", + "basename": "out.txt", + "class": "File", + "checksum": "sha1$406e83b1cd694780f1b3ea4fe8fbb754511fe3f7", + "size": 49, + } + doc: "Test initialWorkDir file object is serialized to json" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-passthrough3-noreq + tool: iwd-passthrough3_noreq.cwl + output: + "filelist": { + "location": "renamed-filelist.txt", + "basename": "renamed-filelist.txt", + "class": "File", + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", + "size": 268866, + } + doc: "Test initialWorkDir file object is passed through" + tags: [ initial_work_dir, command_line_tool ] + +- job: ../loadContents/input.yml + id: iwd-passthrough4-noreq + tool: iwd-passthrough4_noreq.cwl + output: + "filelist": { + "location": "inp-filelist.txt", + "basename": "inp-filelist.txt", + "class": "File", + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c", + "size": 268866, + } + doc: "Test initialWorkDir file object is passed through" + tags: [ initial_work_dir, command_line_tool ] + +- job: iwd-subdir-job.yml + id: iwd-subdir-noreq + tool: iwd-subdir-wf_noreq.cwl + doc: "Test emitting a subdirectory from initialWorkDir" + output: + "out": { + "location": "c", + "basename": "c", + "class": "Directory", + "listing": [ + { + "location": "d", + "basename": "d", + "class": "File", + "checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709", + "size": 0 + } + ] + } + tags: [ initial_work_dir, command_line_tool, workflow ] + +- job: ../loadContents/input.yml + id: iwd_dir_literal_real_file + tool: iwd_dir_literal_real_file.cwl + doc: "Test initialWorkDir directory literal containing a real file" + output: + same: + "location": "inp-filelist.txt" + "basename": "inp-filelist.txt" + "class": "File" + "checksum": "sha1$57f77b36009332d236b52b4beca77301b503b27c" + "size": 268866 + tags: [ initial_work_dir, command_line_tool ] diff --git a/tests/iwdr-entry_noreq.cwl b/tests/iwdr-entry_noreq.cwl new file mode 100644 index 0000000..6895789 --- /dev/null +++ b/tests/iwdr-entry_noreq.cwl @@ -0,0 +1,18 @@ +#!/usr/bin/env cwl-runner + +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +baseCommand: ["cat", "example.conf"] + +initialWorkDir: + - entryname: example.conf + entry: | + CONFIGVAR=$(inputs.message) + +inputs: + message: string +outputs: + out: + type: File + outputBinding: + glob: example.conf diff --git a/tests/iwdr_with_nested_dirs_noreq.cwl b/tests/iwdr_with_nested_dirs_noreq.cwl new file mode 100644 index 0000000..24cd769 --- /dev/null +++ b/tests/iwdr_with_nested_dirs_noreq.cwl @@ -0,0 +1,39 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.3.0-dev1 +class: Workflow + +inputs: [] +outputs: + ya_empty: + type: File + outputSource: second/ya + +steps: + first: + run: + class: CommandLineTool + baseCommand: [ mkdir, -p, deeply/nested/dir/structure ] + inputs: [] + outputs: + deep_dir: + type: Directory + outputBinding: { glob: deeply } + in: {} + out: [ deep_dir ] + + second: + run: + class: CommandLineTool + baseCommand: [ touch, deeply/nested/dir/structure/ya ] + initialWorkDir: + - entry: $(inputs.dir) + writable: true + inputs: + dir: Directory + outputs: + ya: + type: File + outputBinding: { glob: deeply/nested/dir/structure/ya } + + in: { dir: first/deep_dir } + out: [ ya ] diff --git a/tests/linkfile_noreq.cwl b/tests/linkfile_noreq.cwl new file mode 100644 index 0000000..78e868b --- /dev/null +++ b/tests/linkfile_noreq.cwl @@ -0,0 +1,20 @@ +cwlVersion: v1.3.0-dev1 +class: CommandLineTool + +initialWorkDir: + - $(inputs.src) + +inputs: + src: + type: File + inputBinding: + position: 1 + valueFrom: $(self.nameroot).class + +baseCommand: touch + +outputs: + classfile: + type: File + outputBinding: + glob: "*.class" diff --git a/tests/networkaccess_noreq.cwl b/tests/networkaccess_noreq.cwl new file mode 100644 index 0000000..0cc14b5 --- /dev/null +++ b/tests/networkaccess_noreq.cwl @@ -0,0 +1,14 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + DockerRequirement: + dockerPull: docker.io/python:3-slim +networkAccess: true +inputs: [] +outputs: [] +baseCommand: python +arguments: + - "-c" + - valueFrom: | + import urllib.request + assert(urllib.request.urlopen("http://commonwl.org").code == 200) diff --git a/tests/recursive-input-directory_noiwdr.cwl b/tests/recursive-input-directory_noiwdr.cwl new file mode 100644 index 0000000..db74ddb --- /dev/null +++ b/tests/recursive-input-directory_noiwdr.cwl @@ -0,0 +1,33 @@ +cwlVersion: v1.3.0-dev1 +class: CommandLineTool +requirements: + ShellCommandRequirement: {} + +initialWorkDir: + - entry: $(inputs.input_dir) + entryname: work_dir + writable: true +stdout: output.txt +arguments: + - shellQuote: false + valueFrom: | + touch work_dir/e; + if [ ! -w work_dir ]; then echo work_dir not writable; fi; + if [ -L work_dir ]; then echo work_dir is a symlink; fi; + if [ ! -w work_dir/a ]; then echo work_dir/a not writable; fi; + if [ -L work_dir/a ]; then echo work_dir/a is a symlink; fi; + if [ ! -w work_dir/c ]; then echo work_dir/c not writable; fi; + if [ -L work_dir/c ]; then echo work_dir/c is a symlink; fi; + if [ ! -w work_dir/c/d ]; then echo work_dir/c/d not writable; fi; + if [ -L work_dir/c/d ]; then echo work_dir/c/d is a symlink; fi; + if [ ! -w work_dir/e ]; then echo work_dir/e not writable; fi; + if [ -L work_dir/e ]; then echo work_dir/e is a symlink ; fi; +inputs: + input_dir: Directory +outputs: + output_dir: + type: Directory + outputBinding: + glob: work_dir + test_result: + type: stdout diff --git a/tests/rename_noreq.cwl b/tests/rename_noreq.cwl new file mode 100644 index 0000000..99deb2d --- /dev/null +++ b/tests/rename_noreq.cwl @@ -0,0 +1,14 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +baseCommand: "true" +initialWorkDir: + - entryname: $(inputs.newname) + entry: $(inputs.srcfile) +inputs: + srcfile: File + newname: string +outputs: + outfile: + type: File + outputBinding: + glob: $(inputs.newname) diff --git a/tests/search_noiwdr.cwl b/tests/search_noiwdr.cwl new file mode 100644 index 0000000..910081f --- /dev/null +++ b/tests/search_noiwdr.cwl @@ -0,0 +1,109 @@ +cwlVersion: v1.3.0-dev1 +$graph: +- id: index + class: CommandLineTool + baseCommand: python + arguments: + - valueFrom: input.txt + position: 1 + initialWorkDir: + - entryname: input.txt + entry: $(inputs.file) + requirements: + - class: InlineJavascriptRequirement + hints: + - class: DockerRequirement + dockerPull: docker.io/python:3-slim + + inputs: + file: File + secondfile: File + index.py: + type: File + default: + class: File + location: index.py + inputBinding: + position: 0 + outputs: + result: + type: File + outputBinding: + glob: input.txt + secondaryFiles: + - ".idx1" + - "^.idx2" + - '$(self.basename).idx3' + - '${ return self.basename+".idx4"; }' + - '$({"path": self.path+".idx5", "class": "File"})' + - '$(self.nameroot).idx6$(self.nameext)' + - '${ return [self.basename+".idx7", inputs.secondfile]; }' + - "_idx8" + +- id: search + class: CommandLineTool + baseCommand: python + requirements: + - class: InlineJavascriptRequirement + hints: + - class: DockerRequirement + dockerPull: docker.io/python:3-slim + inputs: + file: + type: File + inputBinding: + position: 1 + secondaryFiles: + - ".idx1" + - "^.idx2" + - '$(self.basename).idx3' + - '${ return self.basename+".idx4"; }' + - '$(self.nameroot).idx6$(self.nameext)' + - '${ return [self.basename+".idx7"]; }' + - "_idx8" + search.py: + type: File + default: + class: File + location: search.py + inputBinding: + position: 0 + term: + type: string + inputBinding: + position: 2 + outputs: + result: + type: File + outputBinding: + glob: result.txt + stdout: result.txt + +- id: main + class: Workflow + inputs: + infile: File + secondfile: File + term: string + outputs: + outfile: + type: File + outputSource: search/result + indexedfile: + type: File + outputSource: index/result + + steps: + index: + run: "#index" + in: + file: infile + secondfile: secondfile + out: [result] + + search: + run: "#search" + in: + file: index/result + term: term + out: [result] diff --git a/tests/secondaryfiles/rename-outputs_noiwdr.cwl b/tests/secondaryfiles/rename-outputs_noiwdr.cwl new file mode 100644 index 0000000..c11191e --- /dev/null +++ b/tests/secondaryfiles/rename-outputs_noiwdr.cwl @@ -0,0 +1,49 @@ +#!/usr/bin/env cwl-runner +id: OutputSecondaryFileConformanceTest +baseCommand: +- ls +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +doc: | + Simple test to confirm the implementation of expressions returning a File within a CommandOutputParameter.secondaryFile field. + + Related links: + - Issue: https://github.com/common-workflow-language/cwltool/issues/1232 + - PR: https://github.com/common-workflow-language/cwltool/pull/1233 + - Discourse: https://cwl.discourse.group/t/ask-cwl-to-rename-a-secondary-file/72 + +inputs: [] +outputs: +- id: output_file + label: out + outputBinding: + glob: "*.txt" + secondaryFiles: | + ${ + function resolveSecondary(base, secPattern) { + if (secPattern[0] == "^") { + var spl = base.split("."); + var endIndex = spl.length > 1 ? spl.length - 1 : 1; + return resolveSecondary(spl.slice(undefined, endIndex).join("."), secPattern.slice(1)); + } + return base + secPattern; + } + return [ + { + "class": "File", + "path": resolveSecondary(self.path, "^.accessory"), + "basename": resolveSecondary(self.basename, ".accessory") + } + ]; + } + type: File +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entry: "" + entryname: secondary_file_test.txt + writable: true + - entry: "" + entryname: secondary_file_test.accessory + writable: true diff --git a/tests/secondaryfiles/test-index.yaml b/tests/secondaryfiles/test-index.yaml index 54fb40e..f540dfe 100644 --- a/tests/secondaryfiles/test-index.yaml +++ b/tests/secondaryfiles/test-index.yaml @@ -11,7 +11,7 @@ tags: [ inline_javascript, secondary_files, command_line_tool, shell_command ] - tool: rename-outputs.cwl - doc: Confirm CommandOutputParameter expression can receive a File object + doc: Confirm CommandOutputParameter expression can receive a File object (using InitialWorkDirRequirement) id: command_output_file_expression output: output_file: @@ -24,4 +24,20 @@ checksum: sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709 location: secondary_file_test.txt.accessory size: 0 - tags: [ inline_javascript, secondary_files, command_line_tool ] + tags: [ inline_javascript, secondary_files, command_line_tool, initial_work_dir] + +- tool: rename-outputs_noiwdr.cwl + doc: Confirm CommandOutputParameter expression can receive a File object (using initialWorkDir) + id: command_output_file_expression_noiwdr + output: + output_file: + class: File + checksum: sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709 + size: 0 + location: secondary_file_test.txt + secondaryFiles: + - class: File + checksum: sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709 + location: secondary_file_test.txt.accessory + size: 0 + tags: [ inline_javascript, secondary_files, command_line_tool, initial_work_dir ] diff --git a/tests/stage-array-dirs_noreq.cwl b/tests/stage-array-dirs_noreq.cwl new file mode 100644 index 0000000..9c59459 --- /dev/null +++ b/tests/stage-array-dirs_noreq.cwl @@ -0,0 +1,20 @@ +#!/usr/bin/env cwl-runner + +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +id: stage_array_dirs +baseCommand: + - ls +inputs: + - id: input_list + type: Directory[] +outputs: + - id: output + type: File[] + outputBinding: + glob: + - testdir/a + - rec/B +label: stage-array-dirs.cwl +initialWorkDir: + - $(inputs.input_list) diff --git a/tests/stage-array_noiwdr.cwl b/tests/stage-array_noiwdr.cwl new file mode 100644 index 0000000..544d147 --- /dev/null +++ b/tests/stage-array_noiwdr.cwl @@ -0,0 +1,32 @@ +#!/usr/bin/env cwl-runner + +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +id: stage_array +arguments: + - {shellQuote: false, valueFrom: "ls | grep -v lsout"} +inputs: + - id: input_file + type: File + - id: optional_file + type: File? + - id: input_list + type: 'File[]' + secondaryFiles: + - ^.tar +stdout: lsout +outputs: + - id: output + type: File? + outputBinding: + glob: lsout +label: stage-array.cwl +initialWorkDir: + - $(inputs.input_file) + - $(inputs.optional_file) + - entry: $(inputs.input_list) + - entry: $(null) + - entryname: a + entry: b +requirements: + - class: ShellCommandRequirement diff --git a/tests/stage_file_array_basename_and_entryname_noiwdr.cwl b/tests/stage_file_array_basename_and_entryname_noiwdr.cwl new file mode 100644 index 0000000..8882b3b --- /dev/null +++ b/tests/stage_file_array_basename_and_entryname_noiwdr.cwl @@ -0,0 +1,23 @@ +#!/usr/bin/env cwl-runner + +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +id: stage_file_array_basename_and_entryname +label: Stage File Array (with Directory Basename AND entryname) +arguments: [ls] +inputs: + - id: input_list + type: 'File[]' + secondaryFiles: + - .sec +outputs: + - id: output + type: File[] + outputBinding: + glob: input_dir/* +requirements: + - class: InlineJavascriptRequirement + +initialWorkDir: + - entryname: input_dir + entry: "${ return {class: 'Directory', basename: 'not_input_dir', listing: inputs.input_list} }" diff --git a/tests/stage_file_array_noiwdr.cwl b/tests/stage_file_array_noiwdr.cwl new file mode 100644 index 0000000..6aaadfa --- /dev/null +++ b/tests/stage_file_array_noiwdr.cwl @@ -0,0 +1,23 @@ +#!/usr/bin/env cwl-runner + +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +id: stage_file_array +label: Stage File Array +arguments: [ls] +inputs: + - id: input_list + type: 'File[]' + secondaryFiles: + - .sec +outputs: + - id: output + type: File[] + outputBinding: + glob: input_dir/* +requirements: + - class: InlineJavascriptRequirement + +initialWorkDir: + - entryname: input_dir + entry: "${ return {class: 'Directory', listing: inputs.input_list} }" diff --git a/tests/stagefile_noreq.cwl b/tests/stagefile_noreq.cwl new file mode 100644 index 0000000..0256d29 --- /dev/null +++ b/tests/stagefile_noreq.cwl @@ -0,0 +1,25 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +hints: + - class: DockerRequirement + dockerPull: docker.io/python:3-slim + +initialWorkDir: + - entry: $(inputs.infile) + entryname: bob.txt + writable: true +inputs: + infile: File +outputs: + outfile: + type: File + outputBinding: + glob: bob.txt +baseCommand: "python" +arguments: + - "-c" + - | + f = open("bob.txt", "r+") + f.seek(8) + f.write("Bob. ") + f.close() diff --git a/tests/string-interpolation/bash-dollar-quote_noiwdr.cwl b/tests/string-interpolation/bash-dollar-quote_noiwdr.cwl new file mode 100644 index 0000000..aaeedf9 --- /dev/null +++ b/tests/string-interpolation/bash-dollar-quote_noiwdr.cwl @@ -0,0 +1,56 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InlineJavascriptRequirement: {} + + +initialWorkDir: + - entryname: script.sh + entry: | + echo \$(echo \ + "My country, 'tis of thee," \ + "Sweet land of liberty" | rev) + echo '$(inputs.val)' # produce val + echo '\$(inputs.val)' # produce $(inputs.val) + echo + echo '\\$(inputs.val)' # produce \val + echo '\\\$(inputs.val)' # produce \$(inputs.val) + echo + echo '\\\\$(inputs.val)' # produce \\val + echo '\\\\\$(inputs.val)' # produce \\$(inputs.val) + echo + echo '\\\\\\$(inputs.val)' # produce \\\val + echo '\\\\\\\$(inputs.val)' # produce \\\$(inputs.val) + echo + echo '\\\\\\\\$(inputs.val)' # produce \\\\val + echo '\\\\\\\\\$(inputs.val)' # produce \\\\$(inputs.val) + echo + echo '\\\\\\\\\\$(inputs.val)' # produce \\\\\val + echo '\\\\\\\\\\\$(inputs.val)' # produce \\\\\$(inputs.val) + echo '\' # produce \ + echo '\\' # produce \ + echo '\\\' # produce \\ + echo '\\\\' # produce \\ + echo '\\\\\' # produce \\\ + echo '\\\\\\' # produce \\\ + echo '\\\\\\\' # produce \\\\ + echo '\\\\\\\\' # produce \\\\ + echo '\\\\\\\\\' # produce \\\\\ + echo '\\\\\\\\\\' # produce \\\\\ + echo '$' # produce $ + echo '\$' # produce \$ + echo '\\$' # produce \$ + echo '$$' # produce $$ + echo '$$$' # produce $$$ + +baseCommand: ["bash", "script.sh"] + +inputs: + val: + type: string + default: "val" + +outputs: + out: stdout + +stdout: out.txt diff --git a/tests/string-interpolation/bash-line-continuation-with-expression_noreq.cwl b/tests/string-interpolation/bash-line-continuation-with-expression_noreq.cwl new file mode 100644 index 0000000..a9aac1f --- /dev/null +++ b/tests/string-interpolation/bash-line-continuation-with-expression_noreq.cwl @@ -0,0 +1,20 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +initialWorkDirReq: + - entryname: script.sh + entry: | + echo \ + "My country, 'tis of thee," \ + "Sweet land of $(inputs.liberty)" + +baseCommand: ["bash", "script.sh"] + +inputs: + liberty: + type: string? + default: liberty + +outputs: + out: stdout + +stdout: out.txt diff --git a/tests/string-interpolation/bash-line-continuation_noreq.cwl b/tests/string-interpolation/bash-line-continuation_noreq.cwl new file mode 100644 index 0000000..13a3bbb --- /dev/null +++ b/tests/string-interpolation/bash-line-continuation_noreq.cwl @@ -0,0 +1,17 @@ +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +initialWorkDir: + - entryname: script.sh + entry: | + echo \ + "My country, 'tis of thee," \ + "Sweet land of liberty" + +baseCommand: ["bash", "script.sh"] + +inputs: [] + +outputs: + out: stdout + +stdout: out.txt diff --git a/tests/string-interpolation/js-quote_noiwdr.cwl b/tests/string-interpolation/js-quote_noiwdr.cwl new file mode 100644 index 0000000..40f75d9 --- /dev/null +++ b/tests/string-interpolation/js-quote_noiwdr.cwl @@ -0,0 +1,36 @@ +#!/usr/bin/env cwl-runner + +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +label: Check for a JS quoting bug + +requirements: + InlineJavascriptRequirement: {} + ResourceRequirement: + coresMin: 2 + ramMin: 1000 + + +initialWorkDir: + - entryname: file.txt + entry: | + ${return 'quote "' + inputs.quote + '"'} + - entryname: script.sh + entry: | + set -xe + cat file.txt + +inputs: + quote: + type: string + default: Hello + +outputs: + out: + type: File + outputBinding: + glob: file.txt + +baseCommand: +- echo +arguments: [] diff --git a/tests/string-interpolation/test-index.yaml b/tests/string-interpolation/test-index.yaml index cc6e2b3..8607888 100644 --- a/tests/string-interpolation/test-index.yaml +++ b/tests/string-interpolation/test-index.yaml @@ -1,7 +1,7 @@ # Run with cwltest --test test-index.yaml --tool toil-cwl-runner -- --enable-dev - id: continuation - doc: Line continuations in bash scripts should behave correctly + doc: Line continuations in bash scripts should behave correctly (using InitialWorkDirRequirement) tool: bash-line-continuation.cwl output: out: { @@ -10,10 +10,10 @@ "location": "out.txt", "size": 48 } - tags: [ inline_javascript, command_line_tool ] + tags: [ inline_javascript, command_line_tool, initial_work_dir ] - id: continuation_expression - doc: Line continuations in bash scripts should always behave correctly + doc: Line continuations in bash scripts should always behave correctly (using InitialWorkDirRequirement) tool: bash-line-continuation-with-expression.cwl output: out: { @@ -22,10 +22,10 @@ "location": "out.txt", "size": 48 } - tags: [ inline_javascript, command_line_tool ] + tags: [ inline_javascript, command_line_tool, initial_work_dir ] - id: quoting_multiple_backslashes - doc: Test quoting multiple backslashes + doc: Test quoting multiple backslashes using InitialWorkDirRequirement tool: bash-dollar-quote.cwl output: out: { @@ -34,7 +34,7 @@ "location": "out.txt", "size": 246 } - tags: [ inline_javascript, command_line_tool ] + tags: [ inline_javascript, command_line_tool, initial_work_dir ] - id: escaping_expression_no_extra_quotes doc: Strings returned from JS expressions should not have extra quotes around them @@ -46,4 +46,52 @@ "location": "file.txt", "size": 14 } - tags: [ inline_javascript, command_line_tool ] + tags: [ inline_javascript, command_line_tool, initial_work_dir ] + +- id: continuation_noiwdr + doc: Line continuations in bash scripts should behave correctly (using initialWorkDir) + tool: bash-line-continuation_noreq.cwl + output: + out: { + "checksum": "sha1$47d8510dce768c907f4dea6bcaf90f8d59cb265c", + "class": "File", + "location": "out.txt", + "size": 48 + } + tags: [ inline_javascript, command_line_tool, initial_work_dir ] + +- id: continuation_expression_noiwdr + doc: Line continuations in bash scripts should always behave correctly (using initialWorkDir) + tool: bash-line-continuation-with-expression_noreq.cwl + output: + out: { + "checksum": "sha1$47d8510dce768c907f4dea6bcaf90f8d59cb265c", + "class": "File", + "location": "out.txt", + "size": 48 + } + tags: [ inline_javascript, command_line_tool, initial_work_dir ] + +- id: quoting_multiple_backslashes_noiwdr + doc: Test quoting multiple backslashes using initialWorkDir + tool: bash-dollar-quote_noiwdr.cwl + output: + out: { + "checksum": "sha1$acfdc38aef5354c03b976cbb6d9f7d08a179951d", + "class": "File", + "location": "out.txt", + "size": 246 + } + tags: [ inline_javascript, command_line_tool, initial_work_dir ] + +- id: escaping_expression_no_extra_quotes_noiwdr + doc: Strings returned from JS expressions should not have extra quotes around them (using initialWorkDir) + tool: js-quote_noiwdr.cwl + output: + out: { + "checksum": "sha1$726e9e616f278d9028b4a870653b01c125c2fc89", + "class": "File", + "location": "file.txt", + "size": 14 + } + tags: [ inline_javascript, command_line_tool, initial_work_dir ] diff --git a/tests/template-tool_noiwdr.cwl b/tests/template-tool_noiwdr.cwl new file mode 100755 index 0000000..9fb94a7 --- /dev/null +++ b/tests/template-tool_noiwdr.cwl @@ -0,0 +1,25 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.3.0-dev1 +class: CommandLineTool +requirements: + - class: InlineJavascriptRequirement + expressionLib: + - { $include: underscore.js } + - "var t = function(s) { return _.template(s, {variable: 'data'})({'inputs': inputs}); };" + +initialWorkDir: + - entryname: foo.txt + entry: $(t("The file is <%= data.inputs.file1.path.split('/').slice(-1)[0] %>\n")) + +hints: + DockerRequirement: + dockerPull: docker.io/debian:stable-slim +inputs: + - id: file1 + type: File +outputs: + - id: foo + type: File + outputBinding: + glob: foo.txt +baseCommand: [cat, foo.txt] diff --git a/tests/updatedir_inplace_noiwdr.cwl b/tests/updatedir_inplace_noiwdr.cwl new file mode 100755 index 0000000..7270c15 --- /dev/null +++ b/tests/updatedir_inplace_noiwdr.cwl @@ -0,0 +1,20 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InplaceUpdateRequirement: + inplaceUpdate: true + +initialWorkDir: + - entry: $(inputs.r) + entryname: inp + writable: true + +inputs: + r: Directory +outputs: + out: + type: Directory + outputBinding: + glob: inp +arguments: [touch, inp/blurb] diff --git a/tests/updateval_inplace_noiwdr.cwl b/tests/updateval_inplace_noiwdr.cwl new file mode 100755 index 0000000..d0c5cfc --- /dev/null +++ b/tests/updateval_inplace_noiwdr.cwl @@ -0,0 +1,27 @@ +#!/usr/bin/env cwl-runner +class: CommandLineTool +cwlVersion: v1.3.0-dev1 +requirements: + InplaceUpdateRequirement: + inplaceUpdate: true + +initialWorkDir: + - entry: $(inputs.r) + writable: true + +hints: + DockerRequirement: + dockerPull: docker.io/python:3-slim +inputs: + r: File + script: + type: File + default: + class: File + location: updateval.py +outputs: + out: + type: File + outputBinding: + glob: $(inputs.r.basename) +arguments: [python, $(inputs.script), $(inputs.r.basename)] diff --git a/tests/writable-dir-docker_noiwdr.cwl b/tests/writable-dir-docker_noiwdr.cwl new file mode 100644 index 0000000..4af55cf --- /dev/null +++ b/tests/writable-dir-docker_noiwdr.cwl @@ -0,0 +1,23 @@ +cwlVersion: v1.3.0-dev1 + +class: CommandLineTool + +requirements: + - class: InlineJavascriptRequirement + +initialWorkDir: + - entryname: emptyWritableDir + entry: "$({class: 'Directory', listing: []})" + writable: true + +hints: + - class: DockerRequirement + dockerPull: docker.io/alpine:latest + +inputs: [] +outputs: + out: + type: Directory + outputBinding: + glob: emptyWritableDir +arguments: [touch, emptyWritableDir/blurg] diff --git a/tests/writable-dir_noiwdr.cwl b/tests/writable-dir_noiwdr.cwl new file mode 100644 index 0000000..ae6ce7f --- /dev/null +++ b/tests/writable-dir_noiwdr.cwl @@ -0,0 +1,17 @@ +cwlVersion: v1.3.0-dev1 +class: CommandLineTool +requirements: + InlineJavascriptRequirement: {} + +initialWorkDir: + - entryname: emptyWritableDir + writable: true + entry: "$({class: 'Directory', listing: []})" + +inputs: [] +outputs: + out: + type: Directory + outputBinding: + glob: emptyWritableDir +arguments: [touch, emptyWritableDir/blurg]