From 16628b89b26d26182f66a01a22e91af9307a3e57 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 19 Apr 2022 13:19:05 -0400 Subject: [PATCH] 18888: Ensure that default File/Directory references are normalized Add test. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- sdk/cwl/arvados_cwl/runner.py | 1 + sdk/cwl/tests/18888-download_def.cwl | 29 ++++++++++++++++++++++ sdk/cwl/tests/arvados-tests.sh | 4 +++ sdk/cwl/tests/scripts/download_all_data.sh | 7 ++++++ 4 files changed, 41 insertions(+) create mode 100644 sdk/cwl/tests/18888-download_def.cwl create mode 100755 sdk/cwl/tests/scripts/download_all_data.sh diff --git a/sdk/cwl/arvados_cwl/runner.py b/sdk/cwl/arvados_cwl/runner.py index e5a81cdc73..7d4310b0e0 100644 --- a/sdk/cwl/arvados_cwl/runner.py +++ b/sdk/cwl/arvados_cwl/runner.py @@ -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 index 0000000000..2237c448ed --- /dev/null +++ b/sdk/cwl/tests/18888-download_def.cwl @@ -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, "."] diff --git a/sdk/cwl/tests/arvados-tests.sh b/sdk/cwl/tests/arvados-tests.sh index 7727ebfa04..9cb5234cf0 100755 --- a/sdk/cwl/tests/arvados-tests.sh +++ b/sdk/cwl/tests/arvados-tests.sh @@ -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 index 0000000000..d3a9d78762 --- /dev/null +++ b/sdk/cwl/tests/scripts/download_all_data.sh @@ -0,0 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +#!/bin/bash + +echo bubble -- 2.30.2