Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add basic tests about adding packages
Baptiste Daroussin committed 10 years ago
commit bbc6d115548fe777fc3429205c6898519dfb769e
parent ef58f12
4 files changed +105 -0
modified tests/Makefile.am
@@ -87,6 +87,7 @@ tests_scripts= \
		frontend/conflicts-multirepo.sh \
		frontend/create.sh \
		frontend/delete.sh \
+
		frontend/extract.sh \
		frontend/install.sh \
		frontend/jpeg.sh \
		frontend/lock.sh \
modified tests/frontend/Kyuafile.in
@@ -13,6 +13,7 @@ atf_test_program{name='conflicts'}
atf_test_program{name='conflicts-multirepo'}
atf_test_program{name='create'}
atf_test_program{name='delete'}
+
atf_test_program{name='extract'}
atf_test_program{name='install'}
atf_test_program{name='jpeg'}
atf_test_program{name='lock'}
added tests/frontend/extract.sh
@@ -0,0 +1,86 @@
+
#!/usr/bin/env atf-sh
+

+
. $(atf_get_srcdir)/test_environment.sh
+
tests_init \
+
	basic \
+
	basic_dirs
+

+
basic_body()
+
{
+
	echo "test" > a
+
	new_pkg "test" "test" "1" || atf_fail "plop"
+
cat << EOF >> test.ucl
+
files = {
+
	${TMPDIR}/a: ""
+
}
+
EOF
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg create -M test.ucl
+

+
	mkdir ${TMPDIR}/target
+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg -r ${TMPDIR}/target install -qy ${TMPDIR}/test-1.txz
+

+
OUTPUT="${TMPDIR}/target/local.sqlite
+
${TMPDIR}/target${TMPDIR}/a
+
"
+
	atf_check \
+
		-o inline:"${OUTPUT}" \
+
		-e empty \
+
		-s exit:0 \
+
		find -s ${TMPDIR}/target -type f -print
+

+
	echo "test2" > a
+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg create -M test.ucl
+

+
# check no leftovers during upgrades/reinstallation
+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.txz
+

+
	atf_check \
+
		-o inline:"${OUTPUT}" \
+
		-e empty \
+
		-s exit:0 \
+
		find -s ${TMPDIR}/target -type f -print
+

+
}
+

+
basic_dirs_body()
+
{
+
	mkdir ${TMPDIR}/plop
+
	new_pkg "test" "test" "1" || atf_fail "plop"
+
cat << EOF >> test.ucl
+
directories = {
+
	${TMPDIR}/plop: y
+
}
+
EOF
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg create -M test.ucl
+

+
	mkdir ${TMPDIR}/target
+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.txz
+

+
	test -d ${TMPDIR}/target${TMPDIR}/plop || atf_fail "directory not extracted"
+
}
modified tests/frontend/test_environment.sh.in
@@ -32,3 +32,20 @@ atf_skip_on() {
		atf_skip "$@"
	fi
}
+

+
new_pkg() {
+
	cat << EOF > $1.ucl
+
name = $2
+
origin = $2
+
version = "$3"
+
maintainer = test
+
categories = [test]
+
comment = a test
+
www = http://test
+
prefix = ${4}
+
abi = "*"
+
desc = <<EOD
+
This is a test
+
EOD
+
EOF
+
}