Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add test for pkg scripts that hold PKG_MSGFD open.
John Hood committed 5 years ago
commit 1d83582230e1986e54685be13ce321567c84c020
parent a4de42d
1 file changed +30 -0
modified tests/frontend/shellscript.sh
@@ -5,6 +5,7 @@
tests_init \
	basic \
	message \
+
	daemon \
	upgrade

basic_body() {
@@ -61,6 +62,35 @@ EOF

}

+
daemon_body() {
+
	# We should not see the daemon's message
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
+
	cat << EOF >> test.ucl
+
scripts: {
+
  post-install: <<EOS
+
	echo this is post install1
+
	echo this is a message >&\${PKG_MSGFD}
+
	(sleep 2; echo this is a daemon >&\${PKG_MSGFD}) < /dev/null > /dev/null 2>&1 &
+
	echo this is post install2
+
EOS
+
}
+
EOF
+

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

+
	mkdir ${TMPDIR}/target
+
	atf_check \
+
		-o inline:"this is post install1\nthis is post install2\nthis is a message\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg -o REPOS_DIR=/dev/null -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.txz
+

+
}
+

upgrade_body() {
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
	cat << EOF >> test.ucl