From 3f3a88ca7d2acafbbb6d5440243627ebcc7c1e96 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 4 Apr 2023 17:29:57 +0200 Subject: Add basic test that roots are available via install-cas --- test/end-to-end/just-mr/TARGETS | 11 ++++- test/end-to-end/just-mr/install-roots.sh | 72 ++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 test/end-to-end/just-mr/install-roots.sh (limited to 'test') diff --git a/test/end-to-end/just-mr/TARGETS b/test/end-to-end/just-mr/TARGETS index 4a5c36c0..4acce98f 100644 --- a/test/end-to-end/just-mr/TARGETS +++ b/test/end-to-end/just-mr/TARGETS @@ -55,6 +55,15 @@ , "test": ["defaults.sh"] , "deps": [["test/end-to-end", "mr-tool-under-test"]] } +, "install-roots": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["install-roots"] + , "test": ["install-roots.sh"] + , "deps": + [ ["test/end-to-end", "mr-tool-under-test"] + , ["test/end-to-end", "tool-under-test"] + ] + } , "TESTS": { "type": "install" , "tainted": ["test"] @@ -62,7 +71,7 @@ , "deps": { "type": "++" , "$1": - [ ["cas-independent", "fetch", "fetch-gc"] + [ ["cas-independent", "fetch", "fetch-gc", "install-roots"] , { "type": "if" , "cond": {"type": "var", "name": "TEST_BOOTSTRAP_JUST_MR"} , "then": [] diff --git a/test/end-to-end/just-mr/install-roots.sh b/test/end-to-end/just-mr/install-roots.sh new file mode 100644 index 00000000..0350734b --- /dev/null +++ b/test/end-to-end/just-mr/install-roots.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# Copyright 2022 Huawei Cloud Computing Technology Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +set -eu + +readonly JUST="${PWD}/bin/tool-under-test" +readonly JUST_MR="${PWD}/bin/mr-tool-under-test" +readonly DISTDIR="${TEST_TMPDIR}/distfiles" +readonly LBR="${TEST_TMPDIR}/local-build-root" +readonly INSTALL_DIR="${TEST_TMPDIR}/installation-target" + +readonly TEST_DATA="The content of the data file in foo" +readonly TEST_PATH="bar/baz" + +mkdir -p "${DISTDIR}" + +# Set up sample archive +mkdir -p "foo/${TEST_PATH}" +echo {} > foo/TARGETS +echo -n "${TEST_DATA}" > "foo/${TEST_PATH}/data.txt" +tar cf "${DISTDIR}/foo-1.2.3.tar" foo 2>&1 +foocontent=$(git hash-object "${DISTDIR}/foo-1.2.3.tar") +echo "Foo archive has content ${foocontent}" +rm -rf foo + +# Setup sample repository config +touch ROOT +cat > repos.json <&1 +test "$(cat "${INSTALL_DIR}/${TEST_PATH}/data.txt")" = "${TEST_DATA}" + +echo OK -- cgit v1.2.3