Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
tests: upgrade: Add a test case for dual conflict
Emmanuel Vadot committed 4 years ago
commit 80db696a4586117e7f5aa365fd863e87c8357f98
parent b4b93c8
1 file changed +65 -1
modified tests/frontend/upgrade.sh
@@ -5,7 +5,8 @@
tests_init \
	issue1881 \
	issue1881_newdep \
-
	three_digit_revision
+
	three_digit_revision \
+
	dual_conflict

issue1881_body() {
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg1 pkg_a 1
@@ -163,3 +164,66 @@ EOF
		-s exit:0 \
		pkg info -q
}
+

+
dual_conflict_body()
+
{
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-1" "pkg-1" "1"
+
	echo "${TMPDIR}/file-pkg-1" > plist-1
+
	echo "entry" > file-pkg-1
+
	atf_check -s exit:0 pkg create -M pkg-1.ucl -p plist-1
+

+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-2" "pkg-2" "1"
+
	echo "${TMPDIR}/file-pkg-2" > plist-2
+
	echo "entry" > file-pkg-2
+
	atf_check -s exit:0 pkg create -M pkg-2.ucl -p plist-2
+

+
	mkdir repoconf
+
	cat << EOF > repoconf/repo.conf
+
local: {
+
	url: file:///$TMPDIR,
+
	enabled: true
+
}
+
EOF
+

+
	atf_check \
+
		-o inline:"Creating repository in .:  done\nPacking files for repository:  done\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg repo .
+

+
	mkdir ${TMPDIR}/target
+
	atf_check \
+
		pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" -r ${TMPDIR}/target install -qy pkg-1 pkg-2
+
	pkg -r ${TMPDIR}/target which ${TMPDIR}/file-pkg-1
+
	pkg -r ${TMPDIR}/target which ${TMPDIR}/file-pkg-2
+
	test -f ${TMPDIR}/target/${TMPDIR}/file-pkg-1 || atf_fail "file absent"
+
	test -f ${TMPDIR}/target/${TMPDIR}/file-pkg-2 || atf_fail "file absent"
+

+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-1" "pkg-1" "2"
+
	echo "${TMPDIR}/file-pkg-2" > plist-1
+
	atf_check -s exit:0 pkg create -M pkg-1.ucl -p plist-1
+

+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "pkg-2" "pkg-2" "2"
+
	echo "${TMPDIR}/file-pkg-1" > plist-2
+
	atf_check -s exit:0 pkg create -M pkg-2.ucl -p plist-2
+

+
	sleep 1
+
	atf_check \
+
		-o inline:"Creating repository in .:  done\nPacking files for repository:  done\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg repo -l .
+

+
	atf_check \
+
		pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" -r ${TMPDIR}/target update -q
+

+
	atf_check \
+
		pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" -r ${TMPDIR}/target upgrade -qy
+

+
	atf_check \
+
		-o inline:'pkg-2-2\n' \
+
		pkg -r ${TMPDIR}/target which -q ${TMPDIR}/file-pkg-1
+
	atf_check \
+
		-o inline:'pkg-1-2\n' \
+
		pkg -r ${TMPDIR}/target which -q ${TMPDIR}/file-pkg-2
+
}