Skip to content

Commit 80db696

Browse files
committed
tests: upgrade: Add a test case for dual conflict
This adds a test case where a file from pkg-1 is moved to pkg-2 while at the same time a file from pkg-2 is moved to pkg-1 This currently works (even if both packages are deinstalled before re-installed) so lets keep it that way.
1 parent b4b93c8 commit 80db696

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

tests/frontend/upgrade.sh

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
tests_init \
66
issue1881 \
77
issue1881_newdep \
8-
three_digit_revision
8+
three_digit_revision \
9+
dual_conflict
910

1011
issue1881_body() {
1112
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg1 pkg_a 1
@@ -163,3 +164,66 @@ EOF
163164
-s exit:0 \
164165
pkg info -q
165166
}
167+
168+
dual_conflict_body()
169+
{
170+
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-1" "pkg-1" "1"
171+
echo "${TMPDIR}/file-pkg-1" > plist-1
172+
echo "entry" > file-pkg-1
173+
atf_check -s exit:0 pkg create -M pkg-1.ucl -p plist-1
174+
175+
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-2" "pkg-2" "1"
176+
echo "${TMPDIR}/file-pkg-2" > plist-2
177+
echo "entry" > file-pkg-2
178+
atf_check -s exit:0 pkg create -M pkg-2.ucl -p plist-2
179+
180+
mkdir repoconf
181+
cat << EOF > repoconf/repo.conf
182+
local: {
183+
url: file:///$TMPDIR,
184+
enabled: true
185+
}
186+
EOF
187+
188+
atf_check \
189+
-o inline:"Creating repository in .: done\nPacking files for repository: done\n" \
190+
-e empty \
191+
-s exit:0 \
192+
pkg repo .
193+
194+
mkdir ${TMPDIR}/target
195+
atf_check \
196+
pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" -r ${TMPDIR}/target install -qy pkg-1 pkg-2
197+
pkg -r ${TMPDIR}/target which ${TMPDIR}/file-pkg-1
198+
pkg -r ${TMPDIR}/target which ${TMPDIR}/file-pkg-2
199+
test -f ${TMPDIR}/target/${TMPDIR}/file-pkg-1 || atf_fail "file absent"
200+
test -f ${TMPDIR}/target/${TMPDIR}/file-pkg-2 || atf_fail "file absent"
201+
202+
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-1" "pkg-1" "2"
203+
echo "${TMPDIR}/file-pkg-2" > plist-1
204+
atf_check -s exit:0 pkg create -M pkg-1.ucl -p plist-1
205+
206+
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-2" "pkg-2" "2"
207+
echo "${TMPDIR}/file-pkg-1" > plist-2
208+
atf_check -s exit:0 pkg create -M pkg-2.ucl -p plist-2
209+
210+
sleep 1
211+
atf_check \
212+
-o inline:"Creating repository in .: done\nPacking files for repository: done\n" \
213+
-e empty \
214+
-s exit:0 \
215+
pkg repo -l .
216+
217+
atf_check \
218+
pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" -r ${TMPDIR}/target update -q
219+
220+
atf_check \
221+
pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" -r ${TMPDIR}/target upgrade -qy
222+
223+
atf_check \
224+
-o inline:'pkg-2-2\n' \
225+
pkg -r ${TMPDIR}/target which -q ${TMPDIR}/file-pkg-1
226+
atf_check \
227+
-o inline:'pkg-1-2\n' \
228+
pkg -r ${TMPDIR}/target which -q ${TMPDIR}/file-pkg-2
229+
}

0 commit comments

Comments
 (0)