18888: Ensure that default File/Directory references are normalized
authorPeter Amstutz <peter.amstutz@curii.com>
Tue, 19 Apr 2022 17:19:05 +0000 (13:19 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 19 Apr 2022 17:23:57 +0000 (13:23 -0400)
Add test.

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cwl/arvados_cwl/runner.py
sdk/cwl/tests/18888-download_def.cwl [new file with mode: 0644]
sdk/cwl/tests/arvados-tests.sh
sdk/cwl/tests/scripts/download_all_data.sh [new file with mode: 0755]

index e5a81cdc73fe77238b743705c1dd4c8847240d18..7d4310b0e0ce94b9430ded7f60ca04416e2964b9 100644 (file)
@@ -358,6 +358,7 @@ def upload_dependencies(arvrunner, name, document_loader,
             if "location" not in f and "path" in f:
                 f["location"] = f["path"]
                 del f["path"]
+            normalizeFilesDirs(f)
             optional_deps.append(f)
         visit_class(obj["default"], ("File", "Directory"), defaults_are_optional)
 
diff --git a/sdk/cwl/tests/18888-download_def.cwl b/sdk/cwl/tests/18888-download_def.cwl
new file mode 100644 (file)
index 0000000..2237c44
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cwlVersion: v1.2
+class: CommandLineTool
+
+$namespaces:
+  arv: "http://arvados.org/cwl#"
+
+requirements:
+  NetworkAccess:
+    networkAccess: true
+  arv:RuntimeConstraints:
+    outputDirType: keep_output_dir
+
+inputs:
+  scripts:
+    type: Directory
+    default:
+      class: Directory
+      location: scripts/
+outputs:
+  out:
+    type: Directory
+    outputBinding:
+      glob: "."
+
+arguments: [$(inputs.scripts.path)/download_all_data.sh, "."]
index 7727ebfa04005bfdece5c8fcd5af90cbdd7cedb2..9cb5234cf04db6228763ab3155154f7ee29fc5b4 100755 (executable)
@@ -3,6 +3,8 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
+set -e
+
 if ! arv-get d7514270f356df848477718d58308cc4+94 > /dev/null ; then
     arv-put --portable-data-hash testdir/*
 fi
@@ -16,4 +18,6 @@ if ! arv-get 20850f01122e860fb878758ac1320877+71 > /dev/null ; then
     arv-put --portable-data-hash samples/sample1_S01_R1_001.fastq.gz
 fi
 
+arvados-cwl-runner 18888-download_def.cwl --scripts scripts/
+
 exec cwltest --test arvados-tests.yml --tool arvados-cwl-runner $@ -- --disable-reuse --compute-checksum --api=containers
diff --git a/sdk/cwl/tests/scripts/download_all_data.sh b/sdk/cwl/tests/scripts/download_all_data.sh
new file mode 100755 (executable)
index 0000000..d3a9d78
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+#!/bin/bash
+
+echo bubble