summaryrefslogtreecommitdiff
path: root/test/end-to-end/remote-execution
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-07-29 16:20:18 +0200
committerSascha Roloff <sascha.roloff@huawei.com>2022-08-05 14:41:31 +0200
commit406ee1b8c0f6c2ca3e3cd1281eee6dd59e473a68 (patch)
tree76bc4ba68fb2964e2667db5d6173362bb0687d91 /test/end-to-end/remote-execution
parentf30bdb53d39d62d42f70762a6ef9afb273e57c71 (diff)
downloadjustbuild-406ee1b8c0f6c2ca3e3cd1281eee6dd59e473a68.tar.gz
InstallCas: Add test for reading large blobs via install-cas
Diffstat (limited to 'test/end-to-end/remote-execution')
-rw-r--r--test/end-to-end/remote-execution/TARGETS11
-rw-r--r--test/end-to-end/remote-execution/large-blobs.sh70
2 files changed, 80 insertions, 1 deletions
diff --git a/test/end-to-end/remote-execution/TARGETS b/test/end-to-end/remote-execution/TARGETS
index d1cd7875..1fa9f8a3 100644
--- a/test/end-to-end/remote-execution/TARGETS
+++ b/test/end-to-end/remote-execution/TARGETS
@@ -4,6 +4,15 @@
, "test": ["native-protocol.sh"]
, "deps": [["test/end-to-end", "tool-under-test"], ["", "bin/just-mr.py"]]
}
+, "large-blobs":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["large-blobs"]
+ , "test": ["large-blobs.sh"]
+ , "deps": [["test/end-to-end", "tool-under-test"]]
+ }
, "TESTS":
- {"type": "install", "tainted": ["test"], "deps": ["native-protocol"]}
+ { "type": "install"
+ , "tainted": ["test"]
+ , "deps": ["native-protocol", "large-blobs"]
+ }
}
diff --git a/test/end-to-end/remote-execution/large-blobs.sh b/test/end-to-end/remote-execution/large-blobs.sh
new file mode 100644
index 00000000..b4f7add5
--- /dev/null
+++ b/test/end-to-end/remote-execution/large-blobs.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+set -eu
+
+readonly JUST="${PWD}/bin/tool-under-test"
+
+# create a sufficiently large (>4MB) file for testing upload/download (16MB)
+dd if=/dev/zero of=large.file bs=1024 count=$((16*1024))
+
+touch ROOT
+cat > TARGETS <<EOF
+{ "test":
+ { "type": "generic"
+ , "cmds": ["cp large.file out.file"]
+ , "deps": [["FILE", null, "large.file"]]
+ , "outs": ["out.file"]
+ }
+}
+EOF
+
+NAME="native"
+COMMON_ARGS="--local-build-root=.root"
+if [ "${COMPATIBLE:-}" = "YES" ]; then
+ NAME="compatible"
+ COMMON_ARGS="$COMMON_ARGS --compatible"
+fi
+
+run_tests() {
+ local TYPE="local"
+ local REMOTE_ARGS=""
+ local REMOTE_BUILD_ARGS=""
+ if [ -n "${1:-}" ] && [ -n "${2:-}" ]; then
+ TYPE="remote"
+ REMOTE_ARGS="-r $1"
+ REMOTE_BUILD_ARGS="--remote-execution-property $2"
+ fi
+ ARGS="$COMMON_ARGS $REMOTE_ARGS"
+ BUILD_ARGS="$ARGS $REMOTE_BUILD_ARGS"
+
+ echo
+ echo Upload and download to $NAME $TYPE CAS.
+ echo
+ "${JUST}" build test $BUILD_ARGS --dump-artifacts result
+ echo SUCCESS
+
+ local ARTIFACT_ID="$(cat result | jq -r '."out.file".id')"
+ local ARTIFACT_SIZE="$(cat result | jq -r '."out.file".size')"
+
+ echo
+ echo Download from $NAME $TYPE CAS with full qualified object-id.
+ echo
+ rm -rf out.file
+ "${JUST}" install-cas $ARGS -o out.file [$ARTIFACT_ID:$ARTIFACT_SIZE:f]
+ cmp large.file out.file
+ echo SUCCESS
+
+ # omitting size is only supported in native mode or for local backend
+ if [ "$NAME" = "native" ] || [ "$TYPE" = "local" ]; then
+ echo
+ echo Download from $NAME $TYPE CAS with missing size and file type.
+ echo
+ rm -rf out.file
+ "${JUST}" install-cas $ARGS -o out.file $ARTIFACT_ID
+ cmp large.file out.file
+ echo SUCCESS
+ fi
+}
+
+run_tests #local
+run_tests "${REMOTE_EXECUTION_ADDRESS:-}" "${REMOTE_EXECUTION_PROPERTIES:-}"