Whamcloud - gitweb
LU-7931 tests: Allow per-subtest setup/cleanup 71/19171/1
authorOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Mar 2016 18:54:12 +0000 (14:54 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Mar 2016 18:54:12 +0000 (14:54 -0400)
This brings back ability to have per-subtest setup/cleanup
logic.
Most frequently used in the past as:
SETUP=setup CLEANUP=cleanup sh sanity.sh
to do unmount/remount of the whole stack after every test
to better pinpoint memory/lock leacks and other
accumulated behavior only visible at unmount.

Change-Id: I13bf42ce56a6c1873c034a357ad3bdfbee5c6c1f
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/test-framework.sh

index eaa4878..8270f99 100755 (executable)
@@ -4959,6 +4959,10 @@ run_one() {
        local SAVE_UMASK=`umask`
        umask 0022
 
        local SAVE_UMASK=`umask`
        umask 0022
 
+       if ! grep -q $DIR /proc/mounts; then
+               $SETUP
+       fi
+
        banner "test $testnum: $message"
        test_${testnum} || error "test_$testnum failed with $?"
        cd $SAVE_PWD
        banner "test $testnum: $message"
        test_${testnum} || error "test_$testnum failed with $?"
        cd $SAVE_PWD
@@ -4974,6 +4978,7 @@ run_one() {
        unset tdir
        unset tfile
        umask $SAVE_UMASK
        unset tdir
        unset tfile
        umask $SAVE_UMASK
+       $CLEANUP
        return 0
 }
 
        return 0
 }