Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
tests: add configmerge test for redundant .pkgnew creation
Kyle Evans committed 6 years ago
commit 0155c608b9f9863e0e6059f980a6ff65d79bbe99
parent e47d3d3
1 file changed +39 -0
modified tests/frontend/configmerge.sh
@@ -4,6 +4,7 @@
tests_init \
	config \
	config_fileexist \
+
	config_filenotexist \
	config_fileexist_notinpkg \
	config_hardlink \
	config_morecomplicated
@@ -85,6 +86,44 @@ config_fileexist_body()
	test -f ${TMPDIR}/target/${TMPDIR}/a.pkgnew || atf_fail "file overwritten when it should not have"
}

+
config_filenotexist_body()
+
{
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
+
	echo "${TMPDIR}/a" > plist
+

+
	echo "entry" > a
+

+
	atf_check \
+
		pkg create -M test.ucl -p plist
+

+
	mkdir ${TMPDIR}/target
+
	unset PKG_DBDIR
+
	atf_check \
+
		pkg -o REPOS_DIR=/dev/null -r ${TMPDIR}/target install -qy ${TMPDIR}/test-1.txz
+
	test -f ${TMPDIR}/target/${TMPDIR}/a || atf_fail "file absent"
+
	echo "addition" >> ${TMPDIR}/target/${TMPDIR}/a
+
	atf_check \
+
		-o inline:"entry\naddition\n" \
+
		cat ${TMPDIR}/target/${TMPDIR}/a
+

+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "2"
+
	echo "entry 2" > a
+
	echo "@config ${TMPDIR}/a" > plist
+

+
	atf_check \
+
		pkg create -M test.ucl -p plist
+

+
	pkg repo .
+
	mkdir reposconf
+
	echo "local: { url: file://${TMPDIR} }" > reposconf/local.conf
+
	rm ${TMPDIR}/target/${TMPDIR}/a
+
	atf_check \
+
		pkg -o REPOS_DIR=${TMPDIR}/reposconf -r ${TMPDIR}/target upgrade -qy test
+

+
	test ! -f ${TMPDIR}/target/${TMPDIR}/a.pkgnew || atf_fail "redundant pkgnew left hanging"
+
	test -f ${TMPDIR}/target/${TMPDIR}/a || atf_fail "config file not installed"
+
}
+

config_hardlink_body()
{
	# Create a pkg