summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-02-17 15:03:13 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-02-20 13:12:38 +0100
commit8b4dbd31cc55e15a364f568ec2aec3d856b1bebe (patch)
treedf0deb0a9fd3f8ab5285fa3b73239f94595d034f /test
parent8432937e6b1d26abb2be1fdc5e141c0105ff6f1c (diff)
downloadjustbuild-8b4dbd31cc55e15a364f568ec2aec3d856b1bebe.tar.gz
just-lock: Fix missing inherited pragmas
Transitive 'file'-type repositories should inherit any pragmas suported by the new repository type they are rewritten as. Extend import tests to avoid regressing on this issue in the future.
Diffstat (limited to 'test')
-rw-r--r--test/end-to-end/just-lock/archive-imports.sh17
-rw-r--r--test/end-to-end/just-lock/file-imports.sh17
-rw-r--r--test/end-to-end/just-lock/git-imports.sh13
-rw-r--r--test/end-to-end/just-lock/git-tree-imports.sh4
4 files changed, 42 insertions, 9 deletions
diff --git a/test/end-to-end/just-lock/archive-imports.sh b/test/end-to-end/just-lock/archive-imports.sh
index 9f6fb7c9..e8da5bea 100644
--- a/test/end-to-end/just-lock/archive-imports.sh
+++ b/test/end-to-end/just-lock/archive-imports.sh
@@ -29,12 +29,23 @@ readonly WRKDIR="${PWD}/work"
mkdir -p "${DISTDIR}"
# Repo foo
-mkdir -p "${REPO_DIRS}/foo/root/src"
+mkdir -p "${REPO_DIRS}/foo/root/src/inner"
cd "${REPO_DIRS}/foo"
cat > root/repos.json <<'EOF'
-{"repositories": {"": {"repository": {"type": "file", "path": "src"}}}}
+{ "repositories":
+ { "":
+ { "repository":
+ { "type": "file"
+ , "path": "src"
+ , "pragma": {"special": "resolve-completely"}
+ }
+ }
+ }
+}
EOF
-cat > root/src/TARGETS <<'EOF'
+# add symlink to check that special pragma is needed and is inherited in import
+ln -s inner/actual_TARGETS root/src/TARGETS
+cat > root/src/inner/actual_TARGETS <<'EOF'
{ "": {"type": "file_gen", "name": "foo.txt", "data": "FOO"}}
EOF
tar cf "${DISTDIR}/foo-1.2.3.tar" . 2>&1
diff --git a/test/end-to-end/just-lock/file-imports.sh b/test/end-to-end/just-lock/file-imports.sh
index b20de5c7..71dc5edc 100644
--- a/test/end-to-end/just-lock/file-imports.sh
+++ b/test/end-to-end/just-lock/file-imports.sh
@@ -24,12 +24,23 @@ readonly OUT="${TEST_TMPDIR}/build-output"
readonly REPO_DIRS="${TEST_TMPDIR}/repos"
readonly WRKDIR="${PWD}/work"
-mkdir -p "${REPO_DIRS}/foo/src"
+mkdir -p "${REPO_DIRS}/foo/src/inner"
cd "${REPO_DIRS}/foo"
cat > repos.json <<'EOF'
-{"repositories": {"": {"repository": {"type": "file", "path": "src"}}}}
+{ "repositories":
+ { "":
+ { "repository":
+ { "type": "file"
+ , "path": "src"
+ , "pragma": {"special": "resolve-completely"}
+ }
+ }
+ }
+}
EOF
-cat > src/TARGETS <<'EOF'
+# add symlink to check that special pragma is needed and is inherited in import
+ln -s inner/actual_TARGETS src/TARGETS
+cat > src/inner/actual_TARGETS <<'EOF'
{ "": {"type": "file_gen", "name": "foo.txt", "data": "FOO"}}
EOF
diff --git a/test/end-to-end/just-lock/git-imports.sh b/test/end-to-end/just-lock/git-imports.sh
index f808bb79..14e390ff 100644
--- a/test/end-to-end/just-lock/git-imports.sh
+++ b/test/end-to-end/just-lock/git-imports.sh
@@ -28,11 +28,22 @@ readonly WRKDIR="${PWD}/work"
mkdir -p "${REPO_DIRS}/foo/src"
cd "${REPO_DIRS}/foo"
cat > repos.json <<'EOF'
-{"repositories": {"": {"repository": {"type": "file", "path": "src"}}}}
+{ "repositories":
+ { "":
+ { "repository":
+ { "type": "file"
+ , "path": "src"
+ , "pragma": {"special": "ignore"}
+ }
+ }
+ }
+}
EOF
cat > src/TARGETS <<'EOF'
{ "": {"type": "file_gen", "name": "foo.txt", "data": "FOO"}}
EOF
+# add symlink to check that special pragma is needed and is inherited in import
+ln -s ../../../nonexistent src/causes_fail
git init
git checkout --orphan foomaster
git config user.name 'N.O.Body'
diff --git a/test/end-to-end/just-lock/git-tree-imports.sh b/test/end-to-end/just-lock/git-tree-imports.sh
index 5136bbe0..23df0ebe 100644
--- a/test/end-to-end/just-lock/git-tree-imports.sh
+++ b/test/end-to-end/just-lock/git-tree-imports.sh
@@ -35,7 +35,9 @@ if [ "$(cat ${CREDENTIAL_PATH:-/dev/null})" = "sEcReT" ]
then
mkdir -p data
echo "$1" > data/sources.txt
+ ln -s ../../../nonexistent data/causes_fail
echo '{"":{"type":"install","dirs":[[["TREE",null,"."],"."]]}}' > data/TARGETS
+ echo '{"repositories":{"":{"repository":{"type":"file","path":".","pragma":{"special":"ignore"}}}}}' > data/repos.json
else
echo 'not enough credentials available'
fi
@@ -94,7 +96,6 @@ cat > repos.in.json <<EOF
, "cmd": ["mock-vcs", "checkout"]
, "inherit env": ["PATH", "CREDENTIAL_PATH"]
, "subdir": "data"
- , "as plain": true
}
]
}
@@ -124,7 +125,6 @@ cat > repos.in.json <<EOF
, "cmd gen": ["mock-vcs-gen"]
, "inherit env": ["PATH", "CREDENTIAL_PATH"]
, "subdir": "data"
- , "as plain": true
}
]
}