From bdd5df3bcf10ac5fc8ba4d2082562fab792a0d37 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 23 Jul 2024 10:18:41 +0200 Subject: Extend gc-repo test to also verify that git-tree repositories are taken from older generations --- test/end-to-end/just-mr/gc-repo.sh | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/end-to-end/just-mr/gc-repo.sh b/test/end-to-end/just-mr/gc-repo.sh index e9611700..96f7ce14 100644 --- a/test/end-to-end/just-mr/gc-repo.sh +++ b/test/end-to-end/just-mr/gc-repo.sh @@ -27,6 +27,7 @@ mkdir -p "${DISTDIR}" readonly ARCHIVE_CONTENT="${TEST_TMPDIR}/archive" readonly SCRATCH_LBR="${TEST_TMPDIR}/throw-away-build-root" readonly SCRATCH_FF="${TEST_TMPDIR}/scratch-space-for-foreign-file" +readonly SCRATCH_TREE="${TEST_TMPDIR}/scratch-space-for-git-tree" readonly LBR="${TEST_TMPDIR}/local-build-root" readonly OUT="${TEST_TMPDIR}/out" mkdir -p "${OUT}" @@ -89,6 +90,24 @@ echo echo "Foreign file ${FOREIGN} creating tree ${FOREIGN_TREE}" echo +# Set up a "git tree" +cat > "${BIN}/mock-foreign-vcs" <<'EOF' +#!/bin/sh + +mkdir -p foo/bar/baz +echo foo data > foo/data.txt +echo bar data > foo/bar/data.txt +echo baz data > foo/bar/baz/data.txt +EOF +chmod 755 "${BIN}/mock-foreign-vcs" +rm -rf "${SCRATCH_TREE}" +mkdir -p "${SCRATCH_TREE}" +(cd "${SCRATCH_TREE}" && "${BIN}/mock-foreign-vcs") +FOREIGN_GIT_TREE=$("${JUST}" add-to-cas --local-build-root "${SCRATCH_LBR}" "${SCRATCH_TREE}") +echo +echo "Git tree ${FOREIGN_GIT_TREE}" +echo + # Create workspace with just-mr repository configuration mkdir -p "${WORK}" cd "${WORK}" @@ -98,7 +117,11 @@ cat > repos.json < repos.json <&1 @@ -169,6 +205,7 @@ rm -rf "${DISTDIR}" [ -e "${GIT_LOCATION}" ] && exit 1 || : [ -e "${ARCHIVE_LOCATION}" ] && exit 1 || : [ -e "${FOREIGN_LOCATION}" ] && exit 1 || : +[ -e "${GIT_TREE_LOCATION}" ] && exit 1 || : # Setup repos again "${JUST_MR}" --local-build-root "${LBR}" \ @@ -191,4 +228,8 @@ TREE_FOUND="$(jq -r '.repositories.archive.workspace_root[1]' "${CONFIG}")" TREE_FOUND="$(jq -r '.repositories.foreign_file.workspace_root[1]' "${CONFIG}")" [ "${TREE_FOUND}" = "${FOREIGN_TREE}" ] +## Sanity check for git tree +TREE_FOUND="$(jq -r '.repositories.git_tree.workspace_root[1]' "${CONFIG}")" +[ "${TREE_FOUND}" = "${FOREIGN_GIT_TREE}" ] + echo OK -- cgit v1.2.3