Whamcloud - gitweb
LU-3072 test: add more operations to racer 36/5936/7
authorJohn L. Hammond <john.hammond@intel.com>
Wed, 3 Apr 2013 22:39:56 +0000 (17:39 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 6 Aug 2014 20:02:42 +0000 (20:02 +0000)
Add chown, chmod, truncate, delxattr, getxattr, setxattr, and mknod to
racer. In lustre/utils/truncate.c print errors to stderr. Add a
default definition for MCREATE to init_test_env() in test-framework.sh
and remove definitions of MCREATE in various tests.

Test-Parameters: testlist=racer
Test-Parameters: testlist=racer
Test-Parameters: testlist=racer
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ic366ac8e397035cd68cee5ebeda8408252a2c388
Reviewed-on: http://review.whamcloud.com/5936
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
15 files changed:
lustre/tests/racer/file_chmod.sh [new file with mode: 0755]
lustre/tests/racer/file_chown.sh [new file with mode: 0755]
lustre/tests/racer/file_delxattr.sh [new file with mode: 0755]
lustre/tests/racer/file_getxattr.sh [new file with mode: 0755]
lustre/tests/racer/file_mknod.sh [new file with mode: 0755]
lustre/tests/racer/file_setxattr.sh [new file with mode: 0755]
lustre/tests/racer/file_truncate.sh [new file with mode: 0755]
lustre/tests/racer/racer.sh
lustre/tests/runtests
lustre/tests/sanity-hsm.sh
lustre/tests/sanity-lfsck.sh
lustre/tests/sanity.sh
lustre/tests/sanityn.sh
lustre/tests/test-framework.sh
lustre/tests/truncate.c

diff --git a/lustre/tests/racer/file_chmod.sh b/lustre/tests/racer/file_chmod.sh
new file mode 100755 (executable)
index 0000000..585c155
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       mode=$(printf '%o' $((RANDOM % 010000)))
+       chmod $mode $file 2> /dev/null
+done
diff --git a/lustre/tests/racer/file_chown.sh b/lustre/tests/racer/file_chown.sh
new file mode 100755 (executable)
index 0000000..d5de24b
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       chown $RANDOM:$RANDOM $file 2> /dev/null
+done
diff --git a/lustre/tests/racer/file_delxattr.sh b/lustre/tests/racer/file_delxattr.sh
new file mode 100755 (executable)
index 0000000..b38e515
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       attr=user.$((RANDOM % MAX))
+       setfattr -x $attr $file 2>/dev/null
+done
diff --git a/lustre/tests/racer/file_getxattr.sh b/lustre/tests/racer/file_getxattr.sh
new file mode 100755 (executable)
index 0000000..0171ae4
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       getfattr -d -m- $file &> /dev/null
+done
diff --git a/lustre/tests/racer/file_mknod.sh b/lustre/tests/racer/file_mknod.sh
new file mode 100755 (executable)
index 0000000..25992d9
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       $MCREATE $file 2> /dev/null
+done
diff --git a/lustre/tests/racer/file_setxattr.sh b/lustre/tests/racer/file_setxattr.sh
new file mode 100755 (executable)
index 0000000..eb17ead
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       attr=user.$((RANDOM % MAX))
+       value=$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM
+       setfattr -n $attr -v $value $file 2> /dev/null
+done
diff --git a/lustre/tests/racer/file_truncate.sh b/lustre/tests/racer/file_truncate.sh
new file mode 100755 (executable)
index 0000000..1c85e6f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+DIR=$1
+MAX=$2
+
+while true; do
+       file=$DIR/$((RANDOM % MAX))
+       $TRUNCATE $file $RANDOM 2> /dev/null
+done
index 1da6465..deef18e 100755 (executable)
@@ -13,7 +13,8 @@ NUM_THREADS=${NUM_THREADS:-3}
 mkdir -p $DIR
 
 RACER_PROGS="file_create dir_create file_rm file_rename file_link file_symlink \
-file_list file_concat file_exec"
+file_list file_concat file_exec file_chown file_chmod file_mknod file_truncate \
+file_delxattr file_getxattr file_setxattr"
 
 if [ $MDSCOUNT -gt 1 ]; then
        RACER_PROGS="${RACER_PROGS} dir_remote dir_migrate"
index b722aca..758d7de 100755 (executable)
@@ -19,8 +19,6 @@ RUNTESTS_SRC=${RUNTESTS_SRC:-"/etc /bin"}
 [ "$COUNT" ] || COUNT=10000
 [ "$SLOW" = "no" ] && COUNT=1000
 
-[ "$MCREATE" ] || MCREATE=mcreate
-
 [ "$MKDIRMANY" ] || MKDIRMANY="createmany -d"
 [ "$RMDIRMANY" ] || RMDIRMANY="unlinkmany -d"
 
index aa7ac3b..1b34cc5 100755 (executable)
@@ -28,7 +28,6 @@ init_logging
 
 MULTIOP=${MULTIOP:-multiop}
 OPENFILE=${OPENFILE:-openfile}
-MCREATE=${MCREATE:-mcreate}
 MOUNT_2=${MOUNT_2:-"yes"}
 FAIL_ON_ERROR=false
 
index 29c768f..64cf16b 100644 (file)
@@ -19,7 +19,6 @@ init_logging
 
 require_dsh_mds || exit 0
 
-MCREATE=${MCREATE:-mcreate}
 SAVED_MDSSIZE=${MDSSIZE}
 SAVED_OSTSIZE=${OSTSIZE}
 SAVED_OSTCOUNT=${OSTCOUNT}
index 057be2a..8a91ebd 100644 (file)
@@ -45,7 +45,6 @@ LFS=${LFS:-lfs}
 LFIND=${LFIND:-"$LFS find"}
 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
 LCTL=${LCTL:-lctl}
-MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 export MULTIOP=${MULTIOP:-multiop}
index 2bab077..6edb104 100644 (file)
@@ -19,7 +19,6 @@ PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
 
 SIZE=${SIZE:-40960}
 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
-MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 export MULTIOP=${MULTIOP:-multiop}
index 421a4e4..3df2e4c 100755 (executable)
@@ -226,6 +226,7 @@ init_test_env() {
     [ ! -f "$LST" ] && export LST=$(which lst)
     export SGPDDSURVEY=${SGPDDSURVEY:-"$LUSTRE/../lustre-iokit/sgpdd-survey/sgpdd-survey")}
     [ ! -f "$SGPDDSURVEY" ] && export SGPDDSURVEY=$(which sgpdd-survey)
+       export MCREATE=${MCREATE:-mcreate}
     # Ubuntu, at least, has a truncate command in /usr/bin
     # so fully path our truncate command.
     export TRUNCATE=${TRUNCATE:-$LUSTRE/tests/truncate}
index 91e309d..d62d174 100644 (file)
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#include <unistd.h>
-#include <stdio.h>
 #include <errno.h>
-#include <string.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
 
 int main(int argc, char **argv)
 {
-        unsigned long long off;
-        int err;
+       const char *path;
+       off_t length;
+       int rc;
+
+       if (argc != 3) {
+               fprintf(stderr, "Usage: %s PATH LENGTH\n",
+                       program_invocation_short_name);
+               exit(EXIT_FAILURE);
+       }
 
-        if (argc != 3) {
-                printf("usage %s file bytes\n", argv[0]);
-                return 1;
-        }
+       path = argv[1];
+       length = strtoull(argv[2], NULL, 0);
 
-        off = strtoull(argv[2], NULL, 0);
-        err = truncate64(argv[1], off);
-        if (err)
-                printf("Error truncating %s to %lld: %s\n", argv[1], off,
-                       strerror(errno));
+       rc = truncate(path, length);
+       if (rc < 0) {
+               fprintf(stderr, "%s: cannot truncate '%s' to length %lld: %s\n",
+                       program_invocation_short_name, path, (long long)length,
+                       strerror(errno));
+               exit(EXIT_FAILURE);
+       }
 
-        return err;
+       exit(EXIT_SUCCESS);
 }