Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add install test for missing dependency.
John Hood committed 4 years ago
commit d116cd625b31f07376abfc8c8b6818ec18c797c6
parent 2ded806
1 file changed +65 -1
modified tests/frontend/install.sh
@@ -6,7 +6,30 @@ tests_init \
	metalog \
	reinstall \
	pre_script_fail \
-
	post_script_ignored
+
	post_script_ignored \
+
	install_missing_dep
+

+
test_setup()
+
{
+
	# Do a local config to avoid permissions-on-system-db errors.
+
        cat > ${TMPDIR}/pkg.conf << EOF
+
PKG_CACHEDIR=${TMPDIR}/cache
+
PKG_DBDIR=${TMPDIR}
+
REPOS_DIR=[
+
	${TMPDIR}/reposconf
+
]
+
repositories: {
+
        local: { url : file://${TMPDIR} }
+
}
+
EOF
+
	mkdir -p ${TMPDIR}/reposconf
+
	cat << EOF > ${TMPDIR}/reposconf/repo.conf
+
local: {
+
	url: file:///$TMPDIR,
+
	enabled: true
+
}
+
EOF
+
}

metalog_body()
{
@@ -147,3 +170,44 @@ EOF
		-s exit:0 \
		pkg -o REPOS_DIR="/dev/null" install -y ${TMPDIR}/test-1.pkg
}
+

+
install_missing_dep_body()
+
{
+
	test_setup
+

+
	# Create one package so we at least have a repo.
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg ${TMPDIR}/test test 1 /usr/local
+
	cat << EOF >> ${TMPDIR}/test.ucl
+
deps: {
+
	b: {
+
		origin: "wedontcare",
+
		version: "1"
+
	}
+
}
+
EOF
+
	atf_check \
+
		-o ignore \
+
		-e empty \
+
		-s exit:0 \
+
		pkg -C "${TMPDIR}/pkg.conf" create -o ${TMPDIR} -M ${TMPDIR}/test.ucl
+

+
	atf_check \
+
		-o ignore \
+
		-e empty \
+
		-s exit:0 \
+
		pkg  -C "${TMPDIR}/pkg.conf" repo ${TMPDIR}
+

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

+
	atf_check \
+
		-o ignore \
+
		-e not-empty \
+
		-s not-exit:0 \
+
		pkg -C "${TMPDIR}/pkg.conf" install -y test
+
}