summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-03-01 12:07:33 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-03-08 12:22:15 +0100
commitf4ce0e45981df58ebb10806d53b82beb90a596ce (patch)
tree7286276a03f09dc0e91302ab03e25f599a4d9b95 /test
parent7d09e85d3819be17e7bb3a9d43e0b5e8a1545c1a (diff)
downloadjustbuild-f4ce0e45981df58ebb10806d53b82beb90a596ce.tar.gz
test: Add test for just-mr git tree repository type
Diffstat (limited to 'test')
-rw-r--r--test/other_tools/just_mr/just-mr.test.sh24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/other_tools/just_mr/just-mr.test.sh b/test/other_tools/just_mr/just-mr.test.sh
index 2fa00ec3..3c1f669a 100644
--- a/test/other_tools/just_mr/just-mr.test.sh
+++ b/test/other_tools/just_mr/just-mr.test.sh
@@ -65,20 +65,29 @@ echo test > "${FILE_ROOT}/test_dir2/test_dir3/test_file"
echo "Set up local git repo"
# NOTE: Libgit2 has no support for Git bundles yet
mkdir -p "${GIT_ROOT}"
+mkdir -p bin
+cat > bin/git_dir_setup.sh <<EOF
+mkdir -p foo/bar
+echo foo > foo.txt
+echo bar > foo/bar.txt
+echo baz > foo/bar/baz.txt
+EOF
+# set up git repo
(
cd "${GIT_ROOT}" \
- && mkdir -p foo/bar \
- && echo foo > foo.txt \
- && echo bar > foo/bar.txt \
+ && sh "${SERVER_ROOT}/bin/git_dir_setup.sh" \
&& git init -b test \
&& git config user.email "nobody@example.org" \
&& git config user.name "Nobody" \
&& git add . \
&& git commit -m "test" --date="1970-01-01T00:00Z"
)
-# the root commit ID is known -- see git_repo.test.cpp
readonly GIT_REPO_COMMIT="$(cd "${GIT_ROOT}" && git rev-parse HEAD)"
+echo "Set up git tree repo"
+# get tree id; only the content of the directory structure matters
+readonly GIT_TREE_ID="$(cd "${GIT_ROOT}" && git ls-tree "${GIT_REPO_COMMIT}" foo/bar | awk '{print $3}')"
+
echo "Publish remote repos to HTTP server"
# start Python server as remote repos location
port_file="$(mktemp -t port_XXXXXX -p "${TEST_TMPDIR}")"
@@ -136,6 +145,13 @@ cat > test-repos.json <<EOF
, "subdir": "foo"
}
}
+ , "git_tree_repo":
+ { "repository":
+ { "type": "git tree"
+ , "id": "${GIT_TREE_ID}"
+ , "cmd": ["sh", "${SERVER_ROOT}/bin/git_dir_setup.sh"]
+ }
+ }
, "file_repo1":
{ "repository":
{ "type": "file"