X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Ffunctions.sh;h=1dd9ac54800cbff745b0ebc51fd06080fb0a6c7b;hp=c5b806e39294ada44e63e5b33eee1875b7540366;hb=d031e92fe730792e3a4dba2f1e8ae90a085c96c5;hpb=abf2237387d0d94ed623c64e1a44962242203aea diff --git a/lustre/tests/functions.sh b/lustre/tests/functions.sh index c5b806e..1dd9ac5 100644 --- a/lustre/tests/functions.sh +++ b/lustre/tests/functions.sh @@ -24,3 +24,77 @@ signaled() { kill -KILL -$PGID } +mpi_run () { + local mpirun="$MPIRUN $MPIRUN_OPTIONS" + local command="$mpirun $@" + local mpilog=$TMP/mpi.log + local rc + + if [ "$MPI_USER" != root -a $mpirun ]; then + echo "+ chmod 0777 $MOUNT" + chmod 0777 $MOUNT + command="su $MPI_USER sh -c \"$command \"" + fi + + ls -ald $MOUNT + echo "+ $command" + eval $command 2>&1 > $mpilog || true + + rc=${PIPESTATUS[0]} + if [ $rc -eq 0 ] && grep -q "p4_error: : [^0]" $mpilog ; then + rc=1 + fi + cat $mpilog + return $rc +} + +nids_list () { + local list + for i in ${1//,/ }; do + list="$list $i@$NETTYPE" + done + echo $list +} + +# FIXME: all setup/cleanup can be done without rpc.sh +lst_end_session () { + local verbose=false + [ x$1 = x--verbose ] && verbose=true + + export LST_SESSION=`$LST show_session 2>/dev/null | awk -F " " '{print $5}'` + [ "$LST_SESSION" == "" ] && return + + if $verbose; then + $LST show_error c s + fi + $LST stop b + $LST end_session +} + +lst_session_cleanup_all () { + local list=$(comma_list $(nodes_list)) + do_rpc_nodes $list lst_end_session +} + +lst_cleanup () { + lsmod | grep -q lnet_selftest && rmmod lnet_selftest > /dev/null 2>&1 || true +} + +lst_cleanup_all () { + local list=$(comma_list $(nodes_list)) + + # lst end_session needs to be executed only locally + # i.e. on node where lst new_session was called + lst_end_session --verbose + do_rpc_nodes $list lst_cleanup +} + +lst_setup () { + load_module lnet_selftest +} + +lst_setup_all () { + local list=$(comma_list $(nodes_list)) + do_rpc_nodes $list lst_setup +} +