Whamcloud - gitweb
LU-6210 tests: Change positional struct initializers to C99
[fs/lustre-release.git] / lustre / tests / run-llog.sh
1 #!/bin/bash
2
3 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
4 . $LUSTRE/tests/test-framework.sh
5 init_test_env $@
6 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
7
8 load_llog_test() {
9     grep -q llog_test /proc/modules && return
10     # Module should have been placed with other lustre modules...
11     modprobe llog_test 2>&1 | grep -v "llog_test not found"
12     grep -q llog_test /proc/modules && return
13     # But maybe we're running from a developer tree...
14     insmod $LUSTRE/obdclass/llog_test.ko
15     grep -q llog_test /proc/modules && return
16     echo "Unable to load llog_test module!"
17     false
18     return
19 }
20
21 PATH=$(dirname $0):$LUSTRE/utils:$PATH
22 TMP=${TMP:-/tmp}
23
24 set -x
25 MGS=$($LCTL dl | awk '/mgs/ { print $4 }')
26 [ -z "$MGS" ] && echo "$0: SKIP: no MGS available, skipping llog test" && exit 0
27
28 load_llog_test || exit 0
29 $LCTL modules > $TMP/ogdb-$(hostname)
30 echo "NOW reload debugging syms.."
31
32 RC=0
33 # Using ignore_errors will allow lctl to cleanup even if the test fails.
34 eval "$LCTL <<-EOF || RC=2
35         attach llog_test llt_name llt_uuid
36         setup $MGS
37         device llt_name
38         ignore_errors
39         cleanup
40         detach
41 EOF"
42 rmmod -v llog_test || RC2=3
43 [ $RC -eq 0 -a "$RC2" ] && RC=$RC2
44
45 exit $RC