Whamcloud - gitweb
LU-6245 tests: remove libcfs.h from test applications
[fs/lustre-release.git] / lustre / tests / sgpdd-survey.sh
1 #!/bin/bash
2 #set -x
3 set -e
4
5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
7 init_test_env $@
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
9 init_logging
10
11 # QE uses the following parameters:
12 # size=128 crghi=16 thrhi=32
13 crghi=${crghi:-2}
14 thrhi=${thrhi:-16}
15 size=${size:-1024}
16
17 [ "$SLOW" = no ] && { crghi=2; thrhi=2; }
18
19 if ! ([ "$SGPDD_YES" ] && [ "$REFORMAT" ]); then
20     skip_env "$0 reformats all devices, please set SGPDD_YES and REFORMAT to run this test"
21     exit 0
22 fi
23
24 # Skip these tests
25 ALWAYS_EXCEPT="$SGPDD_SURVEY_EXCEPT"
26
27 build_test_filter
28
29 init_facets_vars
30
31 cleanupall
32
33 run_sgpdd_host () {
34     local host=$1
35     local devs=$2
36
37     local params="size=$size crghi=$crghi thrhi=$thrhi"
38     do_rpc_nodes $host run_sgpdd $devs "$params"
39 }
40
41 run_sgpdd_facets () {
42     local facets=$1
43     local facet
44
45     local facetshosts
46     for facet in ${facets//,/ }; do
47         local host=$(facet_host $facet)
48         local dev=${facet}_dev
49         local var=$(node_var_name ${host}_devs)
50         eval ${var}=$(expand_list ${!var} ${!dev})
51         facetshosts=$(expand_list $facetshosts $host)
52     done
53
54     for host in ${facetshosts//,/ }; do
55         var=$(node_var_name ${host}_devs)
56         echo "=== $facets === $host === ${!var} ==="
57         local scsidevs=${!var}
58         run_sgpdd_host $host ${scsidevs}
59     done
60 }
61
62 test_1 () {
63     local mdss=$(get_facets MDS)
64
65     check_progs_installed $(facets_hosts $mdss) $SGPDDSURVEY sg_map || \
66         { skip_env "SGPDDSURVEY=$SGPDDSURVEY or sg_map not found" && return 0; }
67
68     run_sgpdd_facets $mdss
69 }
70 run_test 1 "sgpdd-survey, mds, scsidevs"
71
72 test_2 () {
73     local osts=$(get_facets OST)
74
75     check_progs_installed $(facets_hosts $osts) $SGPDDSURVEY sg_map || \
76         { skip_env "SGPDDSURVEY=$SGPDDSURVEY or sg_map not found" && return 0; }
77
78     run_sgpdd_facets $osts
79 }
80 run_test 2 "sgpdd-survey, osts, scsidevs"
81
82 complete $SECONDS
83 exit_status