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 -d, --log-dir LOGDIR Top level directory for logs
30 -D, --full-log-dir FULLLOGDIR Full directory for logs
31 -f, --cfg-name STR Config name (cfg/<name>.sh)
32 -g, --group GROUP Test group file (Overrides tests listed on command line)
33 -S, --suite TESTSUITE First test suite to run allows for restarts
34 -H, --honor Honor the EXCEPT and ALWAYS_EXCEPT list when --only is used
35 -i, --repeat N Repeat tests N times (default 1). A new directory
36 will be created under LOGDIR for each iteration.
37 -k --no-stop Don't stop when subtests fail
38 -R, --remount Remount lustre between tests
39 -r, --reformat Reformat (during initial configuration if needed)
41 -v, --verbose Verbose mode
42 -l, --send-logs Send logs to the Maloo database after run
43 (can be done later by running maloo_upload.sh)
44 -L, --lang Script language of test suite. Default: bash
45 -N, --no-setup No setup. Do not setup Lustre prior to executing test suite.
49 These are suite specific options that can be specified after each suite on
52 --only LIST Run only specific list of subtests
53 --except LIST Skip list of subtests
54 --start-at SUBTEST Start testing from subtest
55 --stop-at SUBTEST Stop testing at subtest
56 --time-limit LIMIT Don't allow this suite to run longer
57 than LIMT seconds. [UNIMPLEMENTED]
60 Run all of sanity and all of replay-single except for 70b with SLOW=y using
61 the default "local" configuration.
63 auster -s sanity replay-single --except 70b
65 Run all tests in the regression group 5 times using large config.
67 auster -f large -g test-groups/regression -i 5
80 test_logs_dir=/tmp/test_logs/$(date +%Y-%m-%d)/$(date +%H%M%S)
84 export "${NAME:=local}"
86 # Replace long option with corresponding short option
90 --config) set -- "$@" '-c';;
91 --log-dir) set -- "$@" '-d';;
92 --full-log-dir) set -- "$@" '-D';;
93 --group) set -- "$@" '-g';;
94 --suite) set -- "$@" '-S';;
95 --no-stop) set -- "$@" '-k';;
96 --verbose) set -- "$@" '-v';;
97 --honor) set -- "$@" '-H';;
98 --repeat) set -- "$@" '-i';;
99 --cfg-name) set -- "$@" '-f';;
100 --remount) set -- "$@" '-R';;
101 --reformat) set -- "$@" '-r';;
102 --slow) set -- "$@" '-s';;
103 --send-logs) set -- "$@" '-l';;
104 --lang) set -- "$@" '-L';;
105 --no-setup) set -- "$@" '-N';;
106 --help) set -- "$@" '-h';;
107 *) set -- "$@" "$arg";;
111 while getopts "c:d:D:nkf:S:g:Hi:rRslL:Nhv" opt
114 c) export CONFIG=$OPTARG;;
115 d) test_logs_dir=$OPTARG/$(date +%Y-%m-%d)/$(date +%H%M%S);;
116 D) test_logs_dir=$OPTARG;;
117 g) test_group_file=$OPTARG;;
118 S) FIRST_SUITE=$OPTARG;;
119 k) export FAIL_ON_ERROR=false;;
122 H) export HONOR_EXCEPT="y";;
123 i) repeat_count=$OPTARG;;
128 l) upload_logs=true;;
129 L) script_lang=$OPTARG;;
135 # If a test_group_file is specified, then ignore rest of command line
136 if [[ $test_group_file ]]; then
137 export TEST_GROUP=$(basename $test_group_file)
138 set $(sed 's/#.*$//' $test_group_file)
152 : ${LUSTRE:=$(cd $(dirname $0)/..; echo $PWD)}
153 . $LUSTRE/tests/test-framework.sh
158 local form="%-13s %-17s %s\n"
159 printf "$form" "status" "script" "skipped tests E(xcluded) S(low)"
160 echo "------------------------------------------------------------------------------------"
166 ! ${do_setup} && return
167 nfs_client_mode && return
170 local MOUNTED=$(mounted_lustre_filesystems)
171 if $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
172 check_config_clients $MOUNT
178 echo "Lustre is not mounted, trying to do setup ... "
179 $reformat && CLEANUP_DM_DEV=true formatall
182 MOUNTED=$(mounted_lustre_filesystems)
183 if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
184 echo "Lustre is not mounted after setup! "
190 cleanup_if_needed() {
191 if $AUSTER_CLEANUP; then
196 find_script_in_path() {
199 for dir in $(tr : " " <<< $path); do
200 if [ -f $dir/$target ]; then
204 if [ -f $dir/$target.sh ]; then
213 log "-----============= acceptance-small: "$*" ============----- `date`"
218 printf "Would have run: %s\n" "$*"
222 printf "Running: %s\n" "$*"
230 local suite_script=$2
236 local start_ts=$(date +%s)
237 doit $script_lang $suite_script
239 local duration=$(($(date +%s) - $start_ts))
242 if [[ $rc -ne 0 || -f $TF_FAIL ]]; then
244 elif [[ -f $TF_SKIP ]]; then
247 log_test_status $duration $status
248 [[ ! -f $TF_SKIP ]] || rm -f $TF_SKIP
256 local suite_name=${1%.sh}
257 local suite=$(echo ${suite_name} | tr "[:lower:]-" "[:upper:]_")
259 suite_script=$(find_script_in_path $suite_name $LUSTRE/tests)
261 if [[ -z $suite_script ]]; then
262 echo "Can't find test script for $suite_name"
266 echo "run_suite $suite_name $suite_script"
267 local log_name=${suite_name}.suite_log.$(hostname -s).log
269 run_suite $suite_name $suite_script 2>&1 |tee $LOGDIR/$log_name
271 run_suite $suite_name $suite_script > $LOGDIR/$log_name 2>&1
274 return ${PIPESTATUS[0]}
278 # Add this to test-framework somewhere.
292 while ((n < repeat_count)); do
294 local logdir=${test_logs_dir}
295 local first_suite=$FIRST_SUITE
296 ((repeat_count > 1)) && logdir="$logdir/$n"
297 reset_logging $logdir
299 while [[ -n $1 ]]; do
300 unset ONLY EXCEPT START_AT STOP_AT
306 while [[ -n $1 ]]; do
310 export ONLY=$(split_commas $1)
311 opts+="ONLY=$ONLY ";;
314 export SUITE=$(split_commas $1)
315 opts+="SUITE=$SUITE ";;
318 export PATTERN=$(split_commas $1)
319 opts+="PATTERN=$PATTERN ";;
322 export EXCEPT=$(split_commas $1)
323 opts+="EXCEPT=$EXCEPT ";;
327 opts+="START_AT=$START_AT ";;
331 opts+="STOP_AT=$STOP_AT ";;
340 if [ "x"$first_suite == "x" ] || [ $first_suite == $suite ]; then # If first_suite not set or this is the first suite
341 echo "running: $suite $opts"
342 run_suite_logged $suite || RC=$?
344 echo $suite returned $RC
347 if $upload_logs; then
348 $upload_script $LOGDIR
354 if [ $upload_logs = true ] ; then
355 upload_script=$(find_script_in_path maloo_upload.sh $PATH:$LUSTRE/tests)
356 if [[ -z $upload_script ]]; then
357 echo "Can't find maloo_upload.sh script"
361 if [ ! -r ~/.maloorc ] ; then
362 echo "A ~/.maloorc file is required in order to upload results."
363 echo "Visit your maloo web interface to download your .maloorc file"
368 export NAME MOUNT START CLEAN
369 . ${CONFIG:-$LUSTRE/tests/cfg/$NAME.sh}
372 assert_env ost_HOST OSTCOUNT
373 assert_env FSNAME MOUNT MOUNT2
375 echo "Started at `date`"
381 if [[ $RC -eq 0 ]]; then
385 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
386 echo "$0: completed with rc $RC" && exit $RC