summaryrefslogtreecommitdiff
path: root/test/end-to-end/remote-execution
diff options
context:
space:
mode:
authorSascha Roloff <sascha.roloff@huawei.com>2022-10-11 16:45:39 +0200
committerSascha Roloff <sascha.roloff@huawei.com>2022-10-11 16:45:39 +0200
commit298c15ee98548929a5af255891cd5a5865690c3d (patch)
tree4633c37e0d3d6b54a5525c6721ebb11a77dd2846 /test/end-to-end/remote-execution
parent2680d58bab825e0584d710156d86a887a88f0a4f (diff)
downloadjustbuild-298c15ee98548929a5af255891cd5a5865690c3d.tar.gz
Add tree upload end-to-end test
Diffstat (limited to 'test/end-to-end/remote-execution')
-rw-r--r--test/end-to-end/remote-execution/TARGETS8
-rw-r--r--test/end-to-end/remote-execution/upload-test.sh52
2 files changed, 59 insertions, 1 deletions
diff --git a/test/end-to-end/remote-execution/TARGETS b/test/end-to-end/remote-execution/TARGETS
index 1fa9f8a3..6d420dd0 100644
--- a/test/end-to-end/remote-execution/TARGETS
+++ b/test/end-to-end/remote-execution/TARGETS
@@ -10,9 +10,15 @@
, "test": ["large-blobs.sh"]
, "deps": [["test/end-to-end", "tool-under-test"]]
}
+, "upload-test":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["upload-test"]
+ , "test": ["upload-test.sh"]
+ , "deps": [["test/end-to-end", "tool-under-test"]]
+ }
, "TESTS":
{ "type": "install"
, "tainted": ["test"]
- , "deps": ["native-protocol", "large-blobs"]
+ , "deps": ["native-protocol", "large-blobs", "upload-test"]
}
}
diff --git a/test/end-to-end/remote-execution/upload-test.sh b/test/end-to-end/remote-execution/upload-test.sh
new file mode 100644
index 00000000..70a54ad8
--- /dev/null
+++ b/test/end-to-end/remote-execution/upload-test.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -eu
+
+readonly JUST="${PWD}/bin/tool-under-test"
+readonly GITDIR="${TEST_TMPDIR}/src"
+readonly LBRDIR="${TEST_TMPDIR}/local-build-root"
+
+mkdir -p ${GITDIR}
+cd ${GITDIR}
+git init
+git config user.name "Nobody"
+git config user.email "nobody@example.org"
+mkdir -p foo/bar/baz
+echo `hostname`.`date +%s`.$$ > foo/bar/baz/data.txt
+cat > TARGETS <<'EOF'
+{ "":
+ { "type": "generic"
+ , "outs": ["out.txt"]
+ , "cmds": ["find . > out.txt"]
+ , "deps": [["TREE", null, "."]]
+ }
+}
+EOF
+git add .
+git commit -m 'Generated new data'
+readonly TREE=$(git log --pretty=%T)
+
+cd ${TEST_TMPDIR}
+cat > repos.json <<EOF
+{ "repositories":
+ {"": {"workspace_root": ["git tree", "${TREE}", "${GITDIR}"]}}
+}
+EOF
+
+ARGS=""
+if [ "${COMPATIBLE:-}" = "YES" ]; then
+ ARGS="--compatible"
+fi
+
+# Build locally
+export CONF="$(realpath repos.json)"
+"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} 2>&1
+
+# Build remotely
+if [ "${REMOTE_EXECUTION_ADDRESS:-}" != "" ]; then
+ REMOTE_EXECUTION_ARGS="-r ${REMOTE_EXECUTION_ADDRESS}"
+ if [ "${REMOTE_EXECUTION_PROPERTIES:-}" != "" ]; then
+ REMOTE_EXECUTION_ARGS="${REMOTE_EXECUTION_ARGS} --remote-execution-property ${REMOTE_EXECUTION_PROPERTIES}"
+ fi
+ "${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} ${REMOTE_EXECUTION_ARGS} 2>&1
+fi