Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests Prevent failures from cleanup routines. Do so by only...



details:   https://anonhg.NetBSD.org/src/rev/778084c3e167
branches:  trunk
changeset: 763555:778084c3e167
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Thu Mar 24 21:52:51 2011 +0000

description:
Prevent failures from cleanup routines.  Do so by only attempting to do the
cleanup if the test case did not succeed (as, when it succeeds, the cleanup
has already happened).

diffstat:

 tests/fs/tmpfs/t_vnd.sh    |   9 ++++++---
 tests/modules/t_modload.sh |  13 ++++++++-----
 2 files changed, 14 insertions(+), 8 deletions(-)

diffs (79 lines):

diff -r b04e2b3d5401 -r 778084c3e167 tests/fs/tmpfs/t_vnd.sh
--- a/tests/fs/tmpfs/t_vnd.sh   Thu Mar 24 19:50:30 2011 +0000
+++ b/tests/fs/tmpfs/t_vnd.sh   Thu Mar 24 21:52:51 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_vnd.sh,v 1.6 2010/11/07 17:51:18 jmmv Exp $
+# $NetBSD: t_vnd.sh,v 1.7 2011/03/24 21:52:51 jmmv Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -61,10 +61,13 @@
        atf_check -s eq:0 -o empty -e empty vnconfig -u /dev/vnd3
 
        test_unmount
+       touch done
 }
 basic_cleanup() {
-       umount mnt 2>/dev/null 1>&2
-       vnconfig -u /dev/vnd3 2>/dev/null 1>&2
+       if [ ! -f done ]; then
+               umount mnt 2>/dev/null 1>&2
+               vnconfig -u /dev/vnd3 2>/dev/null 1>&2
+       fi
 }
 
 atf_init_test_cases() {
diff -r b04e2b3d5401 -r 778084c3e167 tests/modules/t_modload.sh
--- a/tests/modules/t_modload.sh        Thu Mar 24 19:50:30 2011 +0000
+++ b/tests/modules/t_modload.sh        Thu Mar 24 21:52:51 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_modload.sh,v 1.8 2010/11/07 17:51:20 jmmv Exp $
+# $NetBSD: t_modload.sh,v 1.9 2011/03/24 21:52:51 jmmv Exp $
 #
 # Copyright (c) 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -47,9 +47,10 @@
        check_sysctl vendor.k_helper.prop_int_ok 0
        check_sysctl vendor.k_helper.prop_str_ok 0
        atf_check -s eq:0 -o empty -e empty modunload k_helper
+       touch done
 }
 plain_cleanup() {
-       modunload k_helper >/dev/null 2>&1
+       test -f done || modunload k_helper >/dev/null 2>&1
 }
 
 atf_test_case bflag cleanup
@@ -89,7 +90,7 @@
        #echo "Checking valid values"
 }
 bflag_cleanup() {
-       modunload k_helper >/dev/null 2>&1
+       modunload k_helper >/dev/null 2>&1 || true
 }
 
 atf_test_case iflag cleanup
@@ -130,9 +131,10 @@
                check_sysctl vendor.k_helper.prop_int_val "${v}"
                atf_check -s eq:0 -o empty -e empty modunload k_helper
        done
+       touch done
 }
 iflag_cleanup() {
-       modunload k_helper >/dev/null 2>&1
+       test -f done || modunload k_helper >/dev/null 2>&1
 }
 
 atf_test_case sflag cleanup
@@ -158,9 +160,10 @@
                check_sysctl vendor.k_helper.prop_str_val "${v}"
                atf_check -s eq:0 -o empty -e empty modunload k_helper
        done
+       touch done
 }
 sflag_cleanup() {
-       modunload k_helper >/dev/null 2>&1
+       test -f done || modunload k_helper >/dev/null 2>&1
 }
 
 atf_init_test_cases()



Home | Main Index | Thread Index | Old Index