Whamcloud - gitweb
LU-14287 tests: Add 'fallocate' to racer 63/41663/23
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Fri, 1 Dec 2023 10:20:22 +0000 (15:50 +0530)
committerOleg Drokin <green@whamcloud.com>
Wed, 20 Dec 2023 01:44:35 +0000 (01:44 +0000)
This patch adds fallocate(file_fallocate.sh)
under racer runs

Test-Parameters: trivial testlist=racer
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I8e807bfc5c2b29dfb610a0b35e7083a9609517b0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/41663
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Deiter <alex.deiter@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/racer.sh
lustre/tests/racer/file_fallocate.sh [new file with mode: 0755]
lustre/tests/racer/racer.sh

index 760a217..d4c39cb 100755 (executable)
@@ -1,4 +1,14 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# lustre/tests/racer.sh
+#
+# Launcher racer script which runs individual racer tests under
+# lustre/tests/racer/
+#
 set -e
 
 ONLY=${ONLY:-"$*"}
@@ -64,6 +74,10 @@ fi
 (( $MDS1_VERSION < $(version_code 2.12.0) )) &&
        RACER_ENABLE_SEL=false
 
+[[ $OST1_VERSION -lt $(version_code 2.15.59) || $ost1_FSTYPE != ldiskfs ]] &&
+       RACER_ENABLE_FALLOCATE=false
+check_set_fallocate || RACER_ENABLE_FALLOCATE=false
+
 RACER_ENABLE_REMOTE_DIRS=${RACER_ENABLE_REMOTE_DIRS:-false}
 RACER_ENABLE_STRIPED_DIRS=${RACER_ENABLE_STRIPED_DIRS:-false}
 RACER_ENABLE_MIGRATION=${RACER_ENABLE_MIGRATION:-false}
@@ -78,6 +92,7 @@ RACER_ENABLE_OVERSTRIPE=${RACER_ENABLE_OVERSTRIPE:-false}
 RACER_LOV_MAX_STRIPECOUNT=${RACER_LOV_MAX_STRIPECOUNT:-$LOV_MAX_STRIPE_COUNT}
 RACER_EXTRA_LAYOUT=${RACER_EXTRA_LAYOUT:-""}
 RACER_MIGRATE_STRIPE_MAX=${RACER_MIGRATE_STRIPE_MAX:-1}
+RACER_ENABLE_FALLOCATE=${RACER_ENABLE_FALLOCATE:-true}
 
 fail_random_facet () {
        local facets=${victims[@]}
diff --git a/lustre/tests/racer/file_fallocate.sh b/lustre/tests/racer/file_fallocate.sh
new file mode 100755 (executable)
index 0000000..8e342ca
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# lustre/tests/racer/file_fallocate.sh
+#
+# Test fallocate calls when running under racer.sh
+#
+
+trap 'kill $(jobs -p)' EXIT
+
+DIR=$1
+MAX=$2
+
+FALLOCATE=$(which fallocate)
+
+while true; do
+       keep_size=""
+       length=$RANDOM
+       offset=$RANDOM
+       punch=""
+       file=$DIR/$((RANDOM % MAX))
+
+       # Select 'punch' switch randomly
+       if (( length % 2 == 0 )); then
+               # Punch implies 'keep_size'
+               punch="-p"
+       elif (( offset % 2 == 0 )) ; then
+               # Select 'keep_size' switch randomly
+               keep_size="-n"
+       fi
+
+       $FALLOCATE $punch $keep_size -o $offset -l $length $file 2> /dev/null
+done
index 45582bb..72db899 100755 (executable)
@@ -25,6 +25,10 @@ if [[ -z "$RACER_PROGS" ]]; then
        if $RACER_ENABLE_MIGRATION; then
                RACER_PROGS+=" dir_migrate"
        fi
+
+       if $RACER_ENABLE_FALLOCATE; then
+               RACER_PROGS+=' file_fallocate'
+       fi
 fi
 RACER_PROGS=${RACER_PROGS//[,+]/ }