2 # SPDX-License-Identifier: GPL-2.0
5 # This file is part of Lustre, http://www.lustre.org/
14 # 1. --time-limt <seconds> add per test time limit, kill test if it runs to long
15 # 2. Read list of tests to run from a file. same syntax as cli, but one test per line
16 # 3. Run test on remote node
21 export TF_FAIL=/tmp/tf.fail
22 export TF_SKIP=/tmp/tf.skip
26 Usage ${0##*/} [options] suite [suite options] [suite [suite options]]
27 Run Lustre regression tests suites.
28 -c, --config CONFIG Test environment config file
29 -C, --client-only Run client-side sanity tests against an already setup
30 filesystem. Users must define FSNAME and mgs_HOST manually.
31 -d, --log-dir LOGDIR Top level directory for logs
32 -D, --full-log-dir FULLLOGDIR Full directory for logs
33 -f, --cfg-name STR Config name (cfg/<name>.sh)
34 -g, --group GROUP Test group file (Overrides tests listed on command line)
35 -S, --suite TESTSUITE First test suite to run allows for restarts
36 -H, --honor Honor the EXCEPT and ALWAYS_EXCEPT list when --only is used
37 -i, --repeat N Repeat tests N times (default 1). A new directory
38 will be created under LOGDIR for each iteration.
39 -k --no-stop Don't stop when subtests fail
40 -R, --remount Remount lustre between tests
41 -r, --reformat Reformat (during initial configuration if needed)
43 -v, --verbose Verbose mode
44 -l, --send-logs Send logs to the Maloo database after run
45 (can be done later by running maloo_upload.sh)
46 -L, --lang Script language of test suite. Default: bash
47 -N, --no-setup No setup. Do not setup Lustre prior to executing test suite.
51 These are suite specific options that can be specified after each suite on
54 --only LIST Run only specific list of subtests
55 --except LIST Skip list of subtests
56 --start-at SUBTEST Start testing from subtest
57 --stop-at SUBTEST Stop testing at subtest
58 --time-limit LIMIT Don't allow this suite to run longer
59 than LIMT seconds. [UNIMPLEMENTED]
62 Run all of sanity and all of replay-single except for 70b with SLOW=y using
63 the default "local" configuration.
65 auster -s sanity replay-single --except 70b
67 Run all tests in the regression group 5 times using large config.
69 auster -f large -g test-groups/regression -i 5
71 Run the client-only tests from sanity.
73 FSNAME=myfilesystem mgs_HOST=1.2.3.4 auster -C sanity
86 test_logs_dir=/tmp/test_logs/$(date +%Y-%m-%d)/$(date +%H%M%S)
89 export client_tests_only=false
91 export "${NAME:=local}"
93 # Replace long option with corresponding short option
97 --config) set -- "$@" '-c';;
98 --client-only) set -- "$@" '-C';;
99 --log-dir) set -- "$@" '-d';;
100 --full-log-dir) set -- "$@" '-D';;
101 --group) set -- "$@" '-g';;
102 --suite) set -- "$@" '-S';;
103 --no-stop) set -- "$@" '-k';;
104 --verbose) set -- "$@" '-v';;
105 --honor) set -- "$@" '-H';;
106 --repeat) set -- "$@" '-i';;
107 --cfg-name) set -- "$@" '-f';;
108 --remount) set -- "$@" '-R';;
109 --reformat) set -- "$@" '-r';;
110 --slow) set -- "$@" '-s';;
111 --send-logs) set -- "$@" '-l';;
112 --lang) set -- "$@" '-L';;
113 --no-setup) set -- "$@" '-N';;
114 --help) set -- "$@" '-h';;
115 *) set -- "$@" "$arg";;
119 while getopts "c:Cd:D:nkf:S:g:Hi:rRslL:Nhv" opt
122 c) export CONFIG=$OPTARG;;
123 C) client_tests_only=true;;
124 d) test_logs_dir=$OPTARG/$(date +%Y-%m-%d)/$(date +%H%M%S);;
125 D) test_logs_dir=$OPTARG;;
126 g) test_group_file=$OPTARG;;
127 S) FIRST_SUITE=$OPTARG;;
128 k) export FAIL_ON_ERROR=false;;
131 H) export HONOR_EXCEPT="y";;
132 i) repeat_count=$OPTARG;;
137 l) upload_logs=true;;
138 L) script_lang=$OPTARG;;
144 # If a test_group_file is specified, then ignore rest of command line
145 if [[ $test_group_file ]]; then
146 export TEST_GROUP=$(basename $test_group_file)
147 set $(sed 's/#.*$//' $test_group_file)
161 : ${LUSTRE:=$(cd $(dirname $0)/..; echo $PWD)}
162 . $LUSTRE/tests/test-framework.sh
165 # Set CLIENTONLY, while trying to discover some common
166 # variables so the test runner doesn't need do this
168 if $client_tests_only; then
169 export CLIENTONLY=true;
170 export FSTYPE=${FSTYPE:-ldiskfs};
171 export MDSCOUNT="$(( $($LFS mdts | wc -l) - 1 ))"
172 export OSTCOUNT="$(( $($LFS osts | wc -l) - 1 ))"
177 local form="%-13s %-17s %s\n"
178 printf "$form" "status" "script" "skipped tests E(xcluded) S(low)"
179 echo "------------------------------------------------------------------------------------"
185 ! ${do_setup} && return
186 nfs_client_mode && return
189 local MOUNTED=$(mounted_lustre_filesystems)
190 if $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
191 check_config_clients $MOUNT
197 echo "Lustre is not mounted, trying to do setup ... "
198 $reformat && CLEANUP_DM_DEV=true formatall
201 MOUNTED=$(mounted_lustre_filesystems)
202 if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
203 echo "Lustre is not mounted after setup! "
209 cleanup_if_needed() {
210 if $AUSTER_CLEANUP; then
215 find_script_in_path() {
218 for dir in $(tr : " " <<< $path); do
219 if [ -f $dir/$target ]; then
223 if [ -f $dir/$target.sh ]; then
232 log "-----============= acceptance-small: "$*" ============----- `date`"
237 printf "Would have run: %s\n" "$*"
241 printf "Running: %s\n" "$*"
249 local suite_script=$2
255 local start_ts=$(date +%s)
256 doit $script_lang $suite_script
258 local duration=$(($(date +%s) - $start_ts))
261 if [[ $rc -ne 0 || -f $TF_FAIL ]]; then
263 elif [[ -f $TF_SKIP ]]; then
266 log_test_status $duration $status
267 [[ ! -f $TF_SKIP ]] || rm -f $TF_SKIP
275 local suite_name=${1%.sh}
276 local suite=$(echo ${suite_name} | tr "[:lower:]-" "[:upper:]_")
278 suite_script=$(find_script_in_path $suite_name $LUSTRE/tests)
280 if [[ -z $suite_script ]]; then
281 echo "Can't find test script for $suite_name"
285 echo "run_suite $suite_name $suite_script"
286 local log_name=${suite_name}.suite_log.$(hostname -s).log
288 run_suite $suite_name $suite_script 2>&1 |tee $LOGDIR/$log_name
290 run_suite $suite_name $suite_script > $LOGDIR/$log_name 2>&1
293 return ${PIPESTATUS[0]}
297 # Add this to test-framework somewhere.
311 while ((n < repeat_count)); do
313 local logdir=${test_logs_dir}
314 local first_suite=$FIRST_SUITE
315 ((repeat_count > 1)) && logdir="$logdir/$n"
316 reset_logging $logdir
318 while [[ -n $1 ]]; do
319 unset ONLY EXCEPT START_AT STOP_AT
325 while [[ -n $1 ]]; do
329 export ONLY=$(split_commas $1)
330 opts+="ONLY=$ONLY ";;
333 export SUITE=$(split_commas $1)
334 opts+="SUITE=$SUITE ";;
337 export PATTERN=$(split_commas $1)
338 opts+="PATTERN=$PATTERN ";;
341 export EXCEPT=$(split_commas $1)
342 opts+="EXCEPT=$EXCEPT ";;
346 opts+="START_AT=$START_AT ";;
350 opts+="STOP_AT=$STOP_AT ";;
359 if [ "x"$first_suite == "x" ] || [ $first_suite == $suite ]; then # If first_suite not set or this is the first suite
360 echo "running: $suite $opts"
361 run_suite_logged $suite || RC=$?
363 echo $suite returned $RC
366 if $upload_logs; then
367 $upload_script $LOGDIR
373 if [ $upload_logs = true ] ; then
374 upload_script=$(find_script_in_path maloo_upload.sh $PATH:$LUSTRE/tests)
375 if [[ -z $upload_script ]]; then
376 echo "Can't find maloo_upload.sh script"
380 if [ ! -r ~/.maloorc ] ; then
381 echo "A ~/.maloorc file is required in order to upload results."
382 echo "Visit your maloo web interface to download your .maloorc file"
387 export NAME MOUNT START CLEAN
388 . ${CONFIG:-$LUSTRE/tests/cfg/$NAME.sh}
390 # Only need to know where (MOUNT) and how (mgs_HOST) to
391 # mount Lustre for client-side only tests
392 if $client_tests_only; then
396 assert_env ost_HOST OSTCOUNT
400 assert_env FSNAME MOUNT
402 echo "Started at `date`"
408 if [[ $RC -eq 0 ]]; then
412 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
413 echo "$0: completed with rc $RC" && exit $RC