1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Fix geli device cleanup

Final cleanup routines shouldn't be called from testcases; it should be called
from the testcase cleanup routine.

Furthermore, `geli_test_cleanup` should take care of cleaning up geli providers
and the memory disks used for the geli providers. `geli_test_cleanup` will always
be executed whereas the equivalent logic in `geli_test_body`, may not have been
executed if the test failed prior to the logic being run.

Prior to this change, the test case was trying to clean up `$md` twice: once in
at the end of the test case body function, and the other in the cleanup function.
The cleanup function logic was failing because there wasn't anything to clean up
in the cleanup function and the errors weren't being ignored.

This fixes FreeBSD test suite runs after r345864.

PR:		237128
Reviewed by:	asomers, pjd
Approved by:	emaste (mentor)
MFC with:	r345864
Differential Revision:	https://reviews.freebsd.org/D19854
This commit is contained in:
Enji Cooper 2019-04-09 16:20:36 +00:00
parent 78b78a6d3b
commit 724ec8989b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346057

View File

@ -172,22 +172,18 @@ online_resize_body()
atf_check -s exit:0 -o match:'^Flags: .*AUTORESIZE' geli list ${md}p1.eli atf_check -s exit:0 -o match:'^Flags: .*AUTORESIZE' geli list ${md}p1.eli
atf_check -s exit:0 -o match:resized gpart resize -i 1 -s 30${prefix} ${md} atf_check -s exit:0 -o match:resized gpart resize -i 1 -s 30${prefix} ${md}
atf_check -s exit:0 -o match:"^[[:space:]]${osize30}[[:space:]]+# mediasize in bytes" diskinfo -v ${md}p1.eli atf_check -s exit:0 -o match:"^[[:space:]]${osize30}[[:space:]]+# mediasize in bytes" diskinfo -v ${md}p1.eli
atf_check geli detach ${md}p1.eli
# Cleanup.
atf_check -s exit:0 -o match:deleted gpart delete -i 1 ${md}
atf_check -s exit:0 -o match:destroyed gpart destroy ${md}
atf_check -s exit:0 -o ignore mdconfig -d -u ${md}
done done
} }
online_resize_cleanup() online_resize_cleanup()
{ {
if [ -f "$TEST_MDS_FILE" ]; then if [ -f "$TEST_MDS_FILE" ]; then
while read md; do while read md; do
[ -c /dev/${md}p1.eli ] && geli detach ${md}p1.eli atf_check -s ignore -e ignore -o ignore geli detach ${md}p1.eli
mdconfig -d -u ${md} 2>/dev/null atf_check -s ignore -e ignore -o ignore gpart delete -i 1 ${md}
atf_check -s ignore -e ignore -o ignore gpart destroy ${md}
done < $TEST_MDS_FILE done < $TEST_MDS_FILE
fi fi
geli_test_cleanup
} }
atf_init_test_cases() atf_init_test_cases()