Whamcloud - gitweb
LU-1526 tests: add version_code() and lustre_version_code()
[fs/lustre-release.git] / lustre / tests / liblustre.sh
1 #!/bin/bash
2 #
3 #set -vx
4
5 set -e
6
7 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
8 . $LUSTRE/tests/test-framework.sh
9 init_test_env $@
10 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
11 init_logging
12
13 LIBLUSTRETESTS=${LIBLUSTRETESTS:-$LUSTRE/liblustre/tests}
14
15 assert_env MGSNID MOUNT2
16 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
17 export LIBLUSTRE_MOUNT_RETRY=5
18 export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME
19 export LIBLUSTRE_TIMEOUT=`lctl get_param -n timeout`
20 #export LIBLUSTRE_DEBUG_MASK=`lctl get_param -n debug`
21
22 test_1() {
23     if ! check_versions; then
24         skip "liblustre version mismatch: cli $(lustre_version_code client), \
25               mds $(lustre_version_code $SINGLEMDS), \
26               ost $(lustre_version_code ost1)"
27     elif ! [ "$NETTYPE" = "tcp" -o "$NETTYPE" = "ptl" ]; then
28         skip "NETTYPE=$NETTYPE unsupported for liblustre"
29     elif [ ! -x $LIBLUSTRETESTS/sanity ]; then
30         skip "$LIBLUSTRETESTS/sanity: not found"
31     else
32         mkdir -p $MOUNT2
33         echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
34         $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET
35         if [ "$LIBLUSTRE_EXCEPT" ]; then
36             LIBLUSTRE_OPT="$LIBLUSTRE_OPT \
37                         $(echo ' '$LIBLUSTRE_EXCEPT  | sed -re 's/\s+/ -e /g')"
38         fi
39         echo $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET $LIBLUSTRE_OPT
40         $LIBLUSTRETESTS/sanity --target=$LIBLUSTRE_MOUNT_TARGET $LIBLUSTRE_OPT
41     fi
42 }
43 run_test 1 "liblustre sanity"
44
45 complete $(basename $0) $SECONDS
46 check_and_cleanup_lustre
47 exit_status