+++ /dev/null
-#!/bin/bash
-
-export PATH=`dirname $0`/../utils:$PATH
-
-config=${1:-`basename $0 .sh`.xml}
-
-LMC="${LMC:-lmc} -m $config"
-TMP=${TMP:-/tmp}
-
-HOSTNAME=`hostname`
-
-MDSDEV=${MDSDEV:-$TMP/mds1-`hostname`}
-MDSSIZE=${MDSSIZE:-400000}
-FSTYPE=${FSTYPE:-ext3}
-MOUNT=${MOUNT:-/mnt/lustre}
-MOUNT2=${MOUNT2:-${MOUNT}2}
-NETTYPE=${NETTYPE:-tcp}
-
-OSTDEV=${OSTDEV:-$TMP/ost-`hostname`}
-OSTSIZE=${OSTSIZE:-400000}
-
-# specific journal size for the ost, in MB
-JSIZE=${JSIZE:-0}
-[ "$JSIZE" -gt 0 ] && JARG="--journal_size $JSIZE"
-MDSISIZE=${MDSISIZE:-0}
-[ "$MDSISIZE" -gt 0 ] && IARG="--inode_size $MDSISIZE"
-
-STRIPE_BYTES=${STRIPE_BYTES:-1048576}
-STRIPES_PER_OBJ=0 # 0 means stripe over all OSTs
-
-rm -f $config
-
-# create nodes
-${LMC} --add node --node $HOSTNAME || exit 10
-${LMC} --add net --node $HOSTNAME --nid `hostname` --nettype $NETTYPE || exit 11
-${LMC} --add net --node client --nid '*' --nettype $NETTYPE || exit 12
-
-# configure mds server
-${LMC} --add mds --node $HOSTNAME --mds mds1 --fstype $FSTYPE \
- --dev $MDSDEV --size $MDSSIZE $JARG $IARG $MDSOPT || exit 20
-
-# configure ost
-${LMC} -m $config --add lov --lov lov1 --mds mds1 --stripe_sz $STRIPE_BYTES \
- --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 $LOVOPT || exit 20
-${LMC} --add ost --ost ost1 --node $HOSTNAME --lov lov1 \
- --fstype $FSTYPE --dev $OSTDEV --size $OSTSIZE $JARG $OSTOPT || exit 30
-${LMC} --add ost --ost ost2 --node $HOSTNAME --lov lov1 \
- --fstype $FSTYPE --dev ${OSTDEV}2 --size $OSTSIZE $JARG $OSTOPT || exit 30
-
-# create client config
-${LMC} --add mtpt --node $HOSTNAME --path $MOUNT --mds mds1 --lov lov1 \
- $CLIENTOPT || exit 40
-${LMC} --add mtpt --node client --path $MOUNT2 --mds mds1 --lov lov1 \
- $CLIENTOPT || exit 41
# LDADD := -lreadline -ltermcap # -lefence
noinst_DATA = disk1_4.zip
-noinst_SCRIPTS = leak_finder.pl llecho.sh llmount.sh llmountcleanup.sh
+noinst_SCRIPTS = leak_finder.pl llmount.sh llmountcleanup.sh
noinst_SCRIPTS += test-framework.sh runvmstat runiozone runtests
noinst_SCRIPTS += sanity.sh rundbench acceptance-small.sh compile.sh
noinst_SCRIPTS += conf-sanity.sh insanity.sh lfscktest.sh oos.sh oos2.sh
$(nobase_noinst_SCRIPTS) $(nobase_noinst_DATA)
if TESTS
-noinst_PROGRAMS = openunlink truncate directio openme writeme mlink utime it_test
-noinst_PROGRAMS += tchmod toexcl fsx test_brw openclose createdestroy
+noinst_PROGRAMS = openunlink truncate directio writeme mlink utime it_test
+noinst_PROGRAMS += tchmod fsx test_brw
noinst_PROGRAMS += createmany chownmany statmany multifstat createtest
-noinst_PROGRAMS += opendirunlink opendevunlink unlinkmany fchdir_test checkstat
-noinst_PROGRAMS += statone runas openfile getdents o_directory rmdirmany
-noinst_PROGRAMS += small_write multiop sleeptest ll_sparseness_verify cmknod
+noinst_PROGRAMS += opendirunlink opendevunlink unlinkmany checkstat
+noinst_PROGRAMS += statone runas openfile rmdirmany
+noinst_PROGRAMS += small_write multiop ll_sparseness_verify
noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify mkdirmany
noinst_PROGRAMS += openfilleddirunlink rename_many memhog iopentest1 iopentest2
noinst_PROGRAMS += mmap_sanity flock_test writemany reads flocks_test
if MPITESTS
noinst_PROGRAMS += parallel_grouplock write_append_truncate createmany_mpi mdsrate
endif
-# noinst_PROGRAMS += ldaptest copy_attr mkdirdeep
+# noinst_PROGRAMS += copy_attr mkdirdeep
bin_PROGRAMS = mcreate munlink
testdir = $(libdir)/lustre/tests
test_SCRIPTS = $(noinst_SCRIPTS) $(noinst_PROGRAMS)
+++ /dev/null
-#!/bin/sh
-set -e
-
-#
-# Runs create.pl and rename.pl on two mountpoints with increasing load, varying
-# debug levels. Assumes that the node is already setup with llmount2.sh
-#
-
-SRCDIR="`dirname $0`"
-CREATE=$SRCDIR/create.pl
-RENAME=$SRCDIR/rename.pl
-
-TIME=${TIME:-/usr/bin/time}
-
-display_elapsed_time() {
- PREVIOUS_TS=$CURRENT_TS
- CURRENT_TS=`date +%s`
- BLOCK_ELAPSED=`expr $CURRENT_TS - $PREVIOUS_TS`
- TOTAL_ELAPSED=`expr $CURRENT_TS - $START_TS`
-
- echo " "
- echo "Elapsed time (block): ${BLOCK_ELAPSED} seconds"
- echo "Elapsed time (TOTAL): ${TOTAL_ELAPSED} seconds"
- echo " "
-}
-
-debug_client_on()
-{
- lctl set_param -n debug=-1
-}
-
-debug_client_off()
-{
- lctl set_param -n debug=0x3f0400
-}
-
-MNT=${MNT:-/mnt/lustre}
-
-# Get our initial timestamps.
-START_TS=`date +%s`
-CURRENT_TS=$START_TS
-PREVIOUS_TS=$START_TS
-
-debug_client_on
-echo "create.pl, 2 mounts, 1 thread, 10 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=10
-echo "create.pl, 2 mounts, 1 thread, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=100 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 1 thread, 10 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=10 --use_mcreate=0
-echo "create.pl --use_mcreate=0, 2 mounts, 1 thread, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=100 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 1 thread, 10 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=10
-echo "rename.pl, 2 mounts, 1 thread, 100 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=100 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 2 mounts, 1 thread, 1000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=1000 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 1 thread, 1000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=1000 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 1 thread, 1000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=1000 --silent
-
-display_elapsed_time
-
-debug_client_on
-echo "create.pl, 2 mounts, 2 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=100 --num_threads=2 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 2 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=100 --num_threads=2 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 2 thread, 1000 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=1000 --num_threads=2 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 2 mounts, 2 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=2 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 2 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=2 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 2 threads, 2000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=2 --silent
-
-display_elapsed_time
-
-debug_client_on
-echo "create.pl, 2 mounts, 4 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=100 --num_threads=4 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 4 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=100 --num_threads=4 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 4 threads, 2000 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=4 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 2 mounts, 4 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=4 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 4 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=4 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 4 threads, 2000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=4 --silent
-
-display_elapsed_time
-
-debug_client_on
-echo "create.pl, 2 mounts, 8 threads, 500 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=500 --num_threads=8 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 8 threads, 500 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=500 --num_threads=8 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 8 threads, 2000 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=8 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 2 mounts, 8 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=8 --silent
-echo "create.pl --use_mcreate=0, 2 mounts, 8 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=8 --use_mcreate=0 --silent
-echo "rename.pl, 2 mounts, 8 threads, 2000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=2 --iterations=2000 --num_threads=8 --silent
-
-display_elapsed_time
+++ /dev/null
-#!/bin/sh
-set -e
-
-#########################################################################
-# Runs create.pl on a single mountpoint and directory with increasing
-# load across multiple clients.
-#########################################################################
-
-LUSTRE=${LUSTRE:-`dirname $0`/..}
-LTESTDIR=${LTESTDIR:-$LUSTRE/../ltest}
-PATH=$LUSTRE/utils:$LUSTRE/tests:$PATH
-
-RLUSTRE=${RLUSTRE:-$LUSTRE}
-RPWD=${RPWD:-$PWD}
-
-. $LUSTRE/tests/test-framework.sh
-
-TIME=${TIME:-/usr/bin/time}
-PDSH=${PDSH:-"pdsh -S -w"}
-MOUNTPT=${MOUNTPT:-"/mnt/lustre"}
-
-CREATE=$LUSTRE/tests/create.pl
-RENAME=$LUSTRE/tests/rename.pl
-
-[ -z "$CLIENTS" ] && exit 1
-#CLIENTS=`comma_list $CLIENTS`
-
-display_elapsed_time() {
- PREVIOUS_TS=$CURRENT_TS
- CURRENT_TS=`date +%s`
- BLOCK_ELAPSED=`expr $CURRENT_TS - $PREVIOUS_TS`
- TOTAL_ELAPSED=`expr $CURRENT_TS - $START_TS`
-
- echo " "
- echo "Elapsed time (block): ${BLOCK_ELAPSED} seconds"
- echo "Elapsed time (TOTAL): ${TOTAL_ELAPSED} seconds"
- echo " "
-}
-
-set_debug_level()
-{
- $PDSH $CLIENTS "echo $1 > /proc/sys/lnet/debug"
-}
-
-debug_client_on()
-{
- set_debug_level -1
-}
-
-debug_client_partial()
-{
- set_debug_level 0x3f0400
-}
-
-debug_client_off()
-{
- set_debug_level 0
-}
-
-# Get our initial timestamps.
-START_TS=`date +%s`
-CURRENT_TS=$START_TS
-PREVIOUS_TS=$START_TS
-
-debug_client_off
-
-echo "create.pl, 1 mount, 1 thread, 1000 ops"
-$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=1000 --silent"
-#echo "create.pl --mcreate=0, 1 mount, 1 thread, 1000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=1000 --use_mcreate=0 --silent"
-wait
-#echo "rename.pl, 1 mount, 1 thread, 1000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $RENAME --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=1000 --silent"
-
-display_elapsed_time
-
-echo "create.pl, 1 mount, 2 threads, 2000 ops, debug off"
-$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=2 --silent"
-#echo "create.pl --mcreate=0, 1 mount, 2 threads, 2000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=2 --use_mcreate=0 --silent"
-wait
-#echo "rename.pl, 1 mount, 2 threads, 2000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $RENAME --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=2 --silent#
-
-display_elapsed_time
-
-echo "create.pl, 1 mount, 4 threads, 2000 ops, debug off"
-$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=4 --silent"
-#echo "create.pl --mcreate=0, 1 mount, 4 threads, 2000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=4 --use_mcreate=0 --silent"
-wait
-#echo "rename.pl, 1 mount, 4 threads, 2000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $RENAME --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=4 --silent"
-
-display_elapsed_time
-
-echo "create.pl, 1 mount, 8 threads, 2000 ops, debug off"
-$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=8 --silent"
-#echo "create.pl --mcreate=0, 1 mount, 8 threads, 2000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $CREATE --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=8 --use_mcreate=0 --silent"
-wait
-#echo "rename.pl, 1 mount, 8 threads, 2000 ops, debug off"
-#$TIME $PDSH $CLIENTS "umask 0022 && cd $RLUSTRE/tests && perl $RENAME --mountpt=${MOUNTPT} --num_mounts=-1 --iterations=2000 --num_threads=8 --silent"
-
-display_elapsed_time
+++ /dev/null
-#!/bin/sh
-set -e
-
-#
-# Runs create.pl and rename.pl on a single mountpoint with increasing
-# load, varying debug levels
-#
-
-SRCDIR="`dirname $0`"
-CREATE=$SRCDIR/create.pl
-RENAME=$SRCDIR/rename.pl
-
-TIME=${TIME:-/usr/bin/time}
-
-display_elapsed_time() {
- PREVIOUS_TS=$CURRENT_TS
- CURRENT_TS=`date +%s`
- BLOCK_ELAPSED=`expr $CURRENT_TS - $PREVIOUS_TS`
- TOTAL_ELAPSED=`expr $CURRENT_TS - $START_TS`
-
- echo " "
- echo "Elapsed time (block): ${BLOCK_ELAPSED} seconds"
- echo "Elapsed time (TOTAL): ${TOTAL_ELAPSED} seconds"
- echo " "
-}
-
-debug_client_on()
-{
- lctl set_param -n debug=-1
-}
-
-debug_client_off()
-{
- lctl set_param -n debug=0x3f0400
-}
-
-MNT=${MNT:-/mnt/lustre}
-
-# Get our initial timestamps.
-START_TS=`date +%s`
-CURRENT_TS=$START_TS
-PREVIOUS_TS=$START_TS
-
-debug_client_on
-echo "create.pl, 1 mount, 1 thread, 10 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=10
-echo "create.pl, 1 mount, 1 thread, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=100 --silent
-echo "create.pl --mcreate=0, 1 mount, 1 thread, 10 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=10 --use_mcreate=0
-echo "create.pl --mcreate=0, 1 mount, 1 thread, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=100 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 1 thread, 10 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=10
-echo "rename.pl, 1 mount, 1 thread, 100 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=100 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 1 mount, 1 thread, 1000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=1000 --silent
-echo "create.pl --mcreate=0, 1 mount, 1 thread, 1000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=1000 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 1 thread, 1000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=1000 --silent
-
-display_elapsed_time
-
-debug_client_on
-echo "create.pl, 1 mount, 2 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=100 --num_threads=2 --silent
-echo "create.pl --mcreate=0, 1 mount, 2 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=100 --num_threads=2 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 2 thread, 1000 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=1000 --num_threads=2 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 1 mount, 2 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=2 --silent
-echo "create.pl --mcreate=0, 1 mount, 2 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=2 --use_mcreate=0 --silent
-wait
-echo "rename.pl, 1 mount, 2 threads, 2000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=2 --silent
-
-display_elapsed_time
-
-debug_client_on
-echo "create.pl, 1 mount, 4 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=100 --num_threads=4 --silent
-echo "create.pl --mcreate=0, 1 mount, 4 threads, 100 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=100 --num_threads=4 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 4 threads, 2000 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=4 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 1 mount, 4 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=4 --silent
-echo "create.pl --mcreate=0, 1 mount, 4 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=4 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 4 threads, 2000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=4 --silent
-
-display_elapsed_time
-
-debug_client_on
-echo "create.pl, 1 mount, 8 threads, 500 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=500 --num_threads=8 --silent
-echo "create.pl --mcreate=0, 1 mount, 8 threads, 500 ops, debug on"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=500 --num_threads=8 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 8 threads, 2000 ops, debug on"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=8 --silent
-
-display_elapsed_time
-
-debug_client_off
-echo "create.pl, 1 mount, 8 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=8 --silent
-echo "create.pl --mcreate=0, 1 mount, 8 threads, 2000 ops, debug off"
-$TIME perl $CREATE --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=8 --use_mcreate=0 --silent
-echo "rename.pl, 1 mount, 8 threads, 2000 ops, debug off"
-$TIME perl $RENAME --mountpt=${MNT} --num_mounts=-1 --iterations=2000 --num_threads=8 --silent
-
-display_elapsed_time
-
-$TIME sh rundbench 1
-
-display_elapsed_time
-
-$TIME sh rundbench 2
-
-display_elapsed_time
-
-$TIME sh rundbench 4
-
-display_elapsed_time
-
-$TIME sh rundbench 8
-
-display_elapsed_time
-
-$TIME sh rundbench 16
-
-display_elapsed_time
-
-$TIME sh rundbench 32
-
-display_elapsed_time
+++ /dev/null
-#!/bin/bash
-
- mkdir /mnt/lustre/d22
- mkdir /mnt/lustre/d22/etc
- ./mcreate /mnt/lustre/d22/etc/foo
- ls -ld /mnt/lustre/etc
- ls -ld /mnt/lustre/d22/etc
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/tests/cmknod.c
- *
- * Simple test to check that device nodes are correctly created and visible
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#define TEST_MINOR 120
-#define TEST_MAJOR 25
-
-void usage(char *prog)
-{
- fprintf(stderr, "usage: %s <filename>\n", prog);
- exit(1);
-}
-
-/* UMKA: This stuff inlined here instead of using appropriate header
- to avoid linking to symbols which is not present in newer libc.
-
- Currently this is the case, as UML image contains RedHat 9 and
- developers use something newer (Fedora, etc.). */
-inline unsigned int
-__gnu_dev_major (unsigned long long int __dev)
-{
- return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
-}
-
-inline unsigned int
-__gnu_dev_minor (unsigned long long int __dev)
-{
- return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
-}
-
-inline unsigned long long int
-__gnu_dev_makedev (unsigned int __major, unsigned int __minor)
-{
- return ((__minor & 0xff) | ((__major & 0xfff) << 8)
- | (((unsigned long long int) (__minor & ~0xff)) << 12)
- | (((unsigned long long int) (__major & ~0xfff)) << 32));
-}
-
-#define __minor(dev) __gnu_dev_minor(dev)
-#define __major(dev) __gnu_dev_major(dev)
-#define __makedev(maj, min) __gnu_dev_makedev(maj, min)
-
-int main( int argc, char **argv)
-{
- char *prog = argv[0];
- char *filename = argv[1];
- int rc;
- struct stat st;
- dev_t device = __makedev(TEST_MAJOR, TEST_MINOR);
-
- if (argc != 2)
- usage(prog);
-
- unlink(filename);
-
- /* First try block devices */
- rc = mknod(filename, 0700 | S_IFBLK, device);
- if ( rc < 0 ) {
- fprintf(stderr, "%s: mknod(%s) failed: rc %d: %s\n",
- prog, filename, errno, strerror(errno));
- return 2;
- }
-
- rc = stat(filename, &st);
- if ( rc < 0 ) {
- fprintf(stderr, "%s: stat(%s) failed: rc %d: %s\n",
- prog, filename, errno, strerror(errno));
- return 3;
- }
-
- if ( st.st_rdev != device) {
- fprintf(stderr, "%s: created device other than requested: (%u,%u) instead of (%u,%u)\n",
- prog, __major(st.st_rdev),__minor(st.st_rdev),__major(device),__minor(device));
- return 4;
- }
- if (!S_ISBLK(st.st_mode)) {
- fprintf(stderr, "%s: created device of different type. Requested block device, got mode %o\n", prog, st.st_mode);
- return 5;
- }
-
- rc = unlink(filename);
- if ( rc < 0 ) {
- fprintf(stderr, "%s: Cannot unlink created device %s, rc %d: %s\n",
- prog, filename, errno, strerror(errno));
- return 6;
- }
-
- /* Second try char devices */
- rc = mknod(filename, 0700 | S_IFCHR, device);
- if ( rc < 0 ) {
- fprintf(stderr, "%s: mknod(%s) failed: rc %d: %s\n",
- prog, filename, errno, strerror(errno));
- return 7;
- }
-
- rc = stat(filename, &st);
- if ( rc < 0 ) {
- fprintf(stderr, "%s: stat(%s) failed: rc %d: %s\n",
- prog, filename, errno, strerror(errno));
- return 8;
- }
- if ( st.st_rdev != device) {
- fprintf(stderr, "%s: created device other than requested: (%u,%u) instead of (%u,%u)\n",
- prog, __major(st.st_rdev),__minor(st.st_rdev),__major(device),__minor(device));
- return 9;
- }
- if (!S_ISCHR(st.st_mode)) {
- fprintf(stderr, "%s: created device of different type. Requested char device, got mode %o\n", prog, st.st_mode);
- return 10;
- }
-
- rc = unlink(filename);
- if ( rc < 0 ) {
- fprintf(stderr, "%s: Cannot unlink created device %s, rc %d: %s\n",
- prog, filename, errno, strerror(errno));
- return 11;
- }
-
- printf("%s: device nodes created correctly\n", prog);
-
- return 0;
-}
+++ /dev/null
-#!/bin/bash
-
-
-config=${1:-$(basename $0 .sh)}.xml
-
-LMC=${LMC:-../utils/lmc -m $config}
-TMP=${TMP:-/tmp}
-
-HOSTNAME=`hostname`
-
-MDSDEV=${MDSDEV:-$TMP/mds1-`hostname`}
-MDSSIZE=50000
-FSTYPE=${FSTYPE:-ext3}
-
-OSTDEV=${OSTDEV:-$TMP/ost1-`hostname`}
-OSTSIZE=200000
-
-rm -f $config
-# create nodes
-${LMC} --add node --node $HOSTNAME || exit 10
-${LMC} --add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp || exit 11
-
-# configure mds server
-${LMC} --add mds --node $HOSTNAME --mds mds1 --fstype $FSTYPE --dev $MDSDEV --size $MDSSIZE || exit 20
-
-# configure ost
-${LMC} --add ost --node $HOSTNAME --obd obd1 --fstype $FSTYPE --obdtype obdecho || exit 30
-# configure ost
-${LMC} --add ost --node $HOSTNAME --obd obd2 --fstype $FSTYPE --obdtype obdecho || exit 30
-
-${LMC} --add cobd --node $HOSTNAME --real_obd obd1 --cache_obd obd2
-
-# create client config
-# ${LMC} -m $config --add mtpt --node $HOSTNAME --path /mnt/lustre --mds mds1 --obd obd1 || exit 40
+++ /dev/null
-#!/bin/sh
-TMP=${TMP:-/tmp}
-BASEDIR=${1:-`dirname $0`/..}
-LCMD=$TMP/crash-mod-`hostname`
-echo "Storing crash module info in $LCMD"
-cat /tmp/ogdb-`hostname` | while read JUNK M JUNK; do
- MOD="$BASEDIR/$M"
- MODNAME=`basename $MOD .o`
-
- echo mod -s $MODNAME $MOD | tee -a $LCMD
-done
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <time.h>
-#include <sys/time.h>
-
-int thread;
-
-#define BAD_VERBOSE (-999999999)
-
-#define difftime(a, b) \
- ((double)(a)->tv_sec - (b)->tv_sec + \
- ((double)((a)->tv_usec - (b)->tv_usec) / 1000000))
-
-static char *cmdname(char *func)
-{
- static char buf[512];
-
- if (thread) {
- sprintf(buf, "%s-%d", func, thread);
- return buf;
- }
-
- return func;
-}
-
-static int be_verbose(int verbose, struct timeval *next_time,
- unsigned long num, unsigned long *next_num, int num_total)
-{
- struct timeval now;
-
- if (!verbose)
- return 0;
-
- if (next_time != NULL)
- gettimeofday(&now, NULL);
-
- /* A positive verbosity means to print every X iterations */
- if (verbose > 0 && (num >= *next_num || num >= num_total)) {
- *next_num += verbose;
- if (next_time) {
- next_time->tv_sec = now.tv_sec - verbose;
- next_time->tv_usec = now.tv_usec;
- }
- return 1;
- }
-
- /* A negative verbosity means to print at most each X seconds */
- if (verbose < 0 && next_time != NULL && difftime(&now, next_time) >= 0){
- next_time->tv_sec = now.tv_sec - verbose;
- next_time->tv_usec = now.tv_usec;
- *next_num = num;
- return 1;
- }
-
- return 0;
-}
-
-static int get_verbose(char *func, const char *arg)
-{
- int verbose;
- char *end;
-
- if (!arg || arg[0] == 'v')
- verbose = 1;
- else if (arg[0] == 's' || arg[0] == 'q')
- verbose = 0;
- else {
- verbose = (int)strtoul(arg, &end, 0);
- if (*end) {
- fprintf(stderr, "%s: error: bad verbose option '%s'\n",
- func, arg);
- return BAD_VERBOSE;
- }
- }
-
- if (verbose < 0)
- printf("Print status every %d seconds\n", -verbose);
- else if (verbose == 1)
- printf("Print status every operation\n");
- else if (verbose > 1)
- printf("Print status every %d operations\n", verbose);
-
- return verbose;
-}
-
-int main(int argc, char *argv[])
-{
- char filename[1024];
- int verbose = 0;
- unsigned long count, i;
- int threads = 0;
- char *end;
- int rc = 0;
-
- if (argc < 3 || argc > 5) {
- fprintf(stderr,
- "usage: %s <filename> <count> [verbose [threads]]\n",
- argv[0]);
- exit(1);
- }
-
- count = strtoul(argv[2], &end, 0);
- if (*end) {
- fprintf(stderr, "%s: error: bad iteration count '%s'\n",
- argv[0], argv[1]);
- exit(2);
- }
- if (argc == 4) {
- verbose = get_verbose(argv[0], argv[3]);
- if (verbose == BAD_VERBOSE)
- exit(2);
- }
- if (argc == 5) {
- threads = strtoul(argv[4], &end, 0);
- if (*end) {
- fprintf(stderr, "%s: error: bad thread count '%s'\n",
- argv[0], argv[1]);
- exit(2);
- }
- }
-
- for (i = 1; i <= threads; i++) {
- rc = fork();
- if (rc < 0) {
- fprintf(stderr, "%s: error: #%ld - %s\n",
- cmdname(argv[0]), i, strerror(rc = errno));
- break;
- } else if (rc == 0) {
- thread = i;
- break;
- } else
- printf("%s: thread #%ld (PID %d) started\n",
- cmdname(argv[0]), i, rc);
- rc = 0;
- }
-
- if (threads && thread == 0) { /* parent process */
- int live_threads = threads;
-
- while (live_threads > 0) {
- int status;
- pid_t ret;
-
- ret = waitpid(0, &status, 0);
- if (ret == 0) {
- continue;
- }
-
- if (ret < 0) {
- fprintf(stderr, "%s: error: wait - %s\n",
- argv[0], strerror(errno));
- if (!rc)
- rc = errno;
- } else {
- /*
- * This is a hack. We _should_ be able to use
- * WIFEXITED(status) to see if there was an
- * error, but it appears to be broken and it
- * always returns 1 (OK). See wait(2).
- */
- int err = WEXITSTATUS(status);
- if (err || WIFSIGNALED(status))
- fprintf(stderr,
- "%s: error: PID %d had rc=%d\n",
- argv[0], ret, err);
- if (!rc)
- rc = err;
-
- live_threads--;
- }
- }
- } else {
- struct timeval start, end, next_time;
- unsigned long next_count;
- double diff;
-
- gettimeofday(&start, NULL);
- next_time.tv_sec = start.tv_sec - verbose;
- next_time.tv_usec = start.tv_usec;
-
- for (i = 0, next_count = verbose; i < count; i++) {
- if (threads)
- sprintf(filename, "%s-%d-%ld",
- argv[1], thread, i);
- else
- sprintf(filename, "%s-%ld", argv[1], i);
-
- rc = mknod(filename, S_IFREG, 0);
- if (rc < 0) {
- fprintf(stderr, "%s: error: mknod(%s): %s\n",
- cmdname(argv[0]), filename,
- strerror(errno));
- rc = errno;
- break;
- }
- if (unlink(filename) < 0) {
- fprintf(stderr, "%s: error: unlink(%s): %s\n",
- cmdname(argv[0]), filename,
- strerror(errno));
- rc = errno;
- break;
- }
- if (be_verbose(verbose, &next_time,i,&next_count,count))
- printf("%s: number %ld\n", cmdname(argv[0]), i);
- }
-
- gettimeofday(&end, NULL);
- diff = difftime(&end, &start);
-
- printf("%s: %ldx2 files in %.4gs (%.4g ops/s): rc = %d: %s",
- cmdname(argv[0]), i, diff, (double)i * 2 / diff,
- rc, ctime(&end.tv_sec));
- }
- return rc;
-}
argv[0], name, st.st_mode, mode);
exit(12);
}
+ if (i == S_IFCHR || i == S_IFBLK) {
+ if (st.st_rdev != 0x1234) {
+ fprintf(stderr, "%s: ERROR rdev %s: "
+ "%lu != 0x1234",
+ argv[0], name, st.st_rdev);
+ exit(13);
+ }
+ }
rc = unlink(name);
if (rc < 0) {
fprintf(stderr, "%s: ERROR unlink %s: %s",
argv[0], name, strerror(errno));
- exit(13);
+ exit(14);
}
break;
default:
if (rc == 0) {
fprintf(stderr, "%s: ERROR: %s created\n",
argv[0], name);
- exit(14);
+ exit(15);
}
}
}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-
-int main(int argc, char **argv)
-{
- int fd;
- int rc;
-
- fd = open(".", O_RDONLY);
- if (fd < 0) {
- perror("opening '.' :");
- exit(2);
- }
-
- rc = chdir("/mnt/lustre/subdir/subdir");
- if (rc) {
- perror("cannot chdir subdir:");
- exit(3);
- }
-
- rc = fchdir(fd);
- if (rc) {
- perror("cannot fchdir back\n");
- exit(4);
- }
-
- rc = close(fd);
- if (rc) {
- perror("cannot close '.'\n");
- exit(5);
- }
-
- return(0);
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <errno.h>
-
-int main(int argc, char **argv)
-{
- DIR *dir;
- struct dirent64 *entry;
-
- if (argc < 2) {
- fprintf(stderr, "Usage: %s dirname\n", argv[0]);
- return 1;
- }
-
- dir = opendir(argv[1]);
- if (!dir) {
- int rc = errno;
- perror("opendir");
- return rc;
- }
-
- while ((entry = readdir64(dir))) {
- puts(entry->d_name);
- }
-
- closedir(dir);
-
- return 0;
-}
-
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <ldap.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-
-int main(int argc, char **argv)
-{
- LDAP *ld;
- int err;
-
- ld = ldap_init("localhost", 389);
- if (!ld) {
- fprintf(stderr, "ldap_init: %s\n", strerror(errno));
- exit(1);
- }
-
- err = ldap_bind_s(ld, "cn=Manager,dc=lustre,dc=cfs", "secret",
- LDAP_AUTH_SIMPLE);
- if (err) {
- fprintf(stderr, "ldap_bind: %s\n", ldap_err2string(err));
- exit(1);
- }
-
-
-
-
-}
+++ /dev/null
-#!/bin/bash
-
-# liblustre sanity test. specially written for UML for now
-
-LCONF=${LCONF:-../utils/lconf}
-
-LLIP=127.0.0.1
-
-LTREE_KERNEL=${LTREE_KERNEL:-../../lustre}
-LTREE_USER=${LTREE_USER:-../../lustre-lib}
-HOSTNAME=`hostname`
-
-# checking
-if [ ! -e $LTREE_KERNEL ]; then
- echo "$LTREE_KERNEL dosen't exits"
- exit 1
-fi
-
-if [ ! -e $LTREE_USER ]; then
- echo "$LTREE_USER dosen't exits"
- exit 1
-fi
-
-if [ ! -e $LTREE_USER/liblustre/lltest ]; then
- echo "$LTREE_USER/liblustre/lltest dosen't exits"
- exit 1
-fi
-
-workdir=`pwd`
-
-cleanup()
-{
- curdir=`pwd`
- cd $LTREE_KERNEL/tests
- $LCONF --node $HOSTNAME --cleanup --force $LTREE_USER/tests/$configfile 2>&1 > /dev/null
- cd $curdir
-}
-
-configfile=liblustre_sanity_uml.xml
-
-# generate config file
-rm -f $configfile
-MDSNODE=$HOSTNAME OSTNODES=$HOSTNAME CLIENTS=$LLIP sh uml.sh $configfile
-if [ ! -e $configfile ]; then
- echo "fail to generate config file $configfile"
- exit 1
-fi
-
-# generate dump file
-rm -f /tmp/DUMP_FILE
-$LCONF --lctl_dump /tmp/DUMP_FILE --node $LLIP $configfile
-if [ ! -e /tmp/DUMP_FILE ]; then
- echo "error creating dumpfile"
- exit 1
-fi
-
-#setup lustre server
-cd $LTREE_KERNEL/tests
-$LCONF --node $HOSTNAME --reformat $LTREE_USER/tests/$configfile
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "setup lustre server: error $rc"
- cleanup
- exit 1
-fi
-cd $workdir
-
-#do liblustre testing
-$LTREE_USER/liblustre/lltest
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "liblustre test error $rc"
- cleanup
- exit 1
-fi
-
-echo "===== liblustre sanity test complete sucessfully ====="
-
-echo -n "===== cleanup... "; cleanup; echo "done ====="
-
-cd $workdir
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-PATH=`dirname $0`/../utils:$PATH
-
-LCONF=${LCONF:-lconf}
-NAME=${NAME:-echo}
-
-config=$NAME.xml
-mkconfig=$NAME.sh
-
-if [ "$LUSTRE" ]; then
- lustre_opt="--lustre=$LUSTRE"
-fi
-
-[ -f $config ] || sh -x $mkconfig $config || exit 1
-
-$LCONF $lustre_opt --reformat $@ $OPTS $config || exit 4
-
-cat <<EOF
-
-run getattr tests as:
-`dirname $0`../utils/lctl --device '\$ECHO_$SERVER' test_getattr 1000000
-EOF
+++ /dev/null
-#!/bin/bash
-
-config=${1:-mcr.xml}
-
-LMC="../utils/lmc -m $config"
-
-# TCP/IP servers
-SERVERS="ba-ost-1 ba-ost-2"
-ROUTER=dev5
-
-# Elan clients
-CLIENT_LO=dev2
-CLIENT_HI=dev25
-
-TCPBUF=1048576
-
-
-h2elan () {
- echo $1 | sed 's/[^0-9]*//g'
-}
-
-h2tcp () {
- echo "${1}"
-}
-
-[ -f $config ] && rm $config
-
-# Client node
-${LMC} --add net --node client --nid '*' --nettype elan || exit 1
-# Router node
-${LMC} --add net --router --node $ROUTER --tcpbuf $TCPBUF --nid `h2tcp $ROUTER` --nettype tcp || exit 1
-${LMC} --add net --node $ROUTER --nid `h2elan $ROUTER` --nettype elan|| exit 1
-${LMC} -m $config --add route --node $ROUTER --nettype elan --gw `h2elan $ROUTER` --lo `h2elan $CLIENT_LO` --hi `h2elan $CLIENT_HI` || exit 2
-
-for s in $SERVERS
- do
- # server node
- ${LMC} --add net --node $s --tcpbuf $TCPBUF --nid $s --nettype tcp || exit 1
- # route to server
- ${LMC} --add route --node $ROUTER --nettype tcp --gw `h2tcp $ROUTER` --lo $s || exit 2
- # the device on the server
- ${LMC} --add ost --node $s --obd obd_$s --obdtype=obdecho || exit 3
- # attach to the device on the client (this would normally be a mount)
- ${LMC} --add oscref --node client --osc OSC_obd_$s || exit 4
-done
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-/* for O_DIRECTORY */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-int main(int argc, char **argv)
-{
- int fd, rc;
-
- if (argc != 2) {
- printf("Usage: %s <filename>\n", argv[0]);
- exit(1);
- }
-
- fd = open(argv[1], O_RDONLY | O_CREAT, 0600);
- if (fd == -1) {
- printf("Error opening %s for create: %s\n", argv[1],
- strerror(errno));
- exit(1);
- }
- rc = close(fd);
- if (rc < 0) {
- printf("Error closing %s: %s\n", argv[1], strerror(errno));
- exit(1);
- }
-
- fd = open(argv[1], O_DIRECTORY);
- if (fd >= 0) {
- printf("opening %s as directory should have returned an "
- "error!\n", argv[1]);
- exit(1);
- }
- if (errno != ENOTDIR) {
- printf("opening %s as directory, expected -ENOTDIR and got "
- "%s\n", argv[1], strerror(errno));
- exit(1);
- }
-
- return 0;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-/* for O_DIRECT */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-
-#include <lustre/lustre_user.h>
-#ifndef O_DIRECT
-#define O_DIRECT 0
-#endif
-
-int main(int argc, char *argv[])
-{
- char filename[1024];
- unsigned long count, i;
- int thread = 0;
- int threads = 0;
- int rc = 0;
- int fd, ioctl_flags = 0;
-
- if (argc < 3 || argc > 4) {
- fprintf(stderr, "usage: %s <filename> <iterations> [threads]\n",
- argv[0]);
- exit(1);
- }
-
- count = strtoul(argv[2], NULL, 0);
- if (argc == 4)
- threads = strtoul(argv[3], NULL, 0);
-
- for (i = 1; i <= threads; i++) {
- rc = fork();
- if (rc < 0) {
- fprintf(stderr, "error: %s: #%ld - %s\n", argv[0], i,
- strerror(rc = errno));
- break;
- } else if (rc == 0) {
- thread = i;
- argv[2] = "--device";
- break;
- } else
- printf("%s: thread #%ld (PID %d) started\n",
- argv[0], i, rc);
- rc = 0;
- }
-
- if (threads && thread == 0) { /* parent process */
- int live_threads = threads;
-
- while (live_threads > 0) {
- int status;
- pid_t ret;
-
- ret = waitpid(0, &status, 0);
- if (ret == 0)
- continue;
-
- if (ret < 0) {
- if (!rc)
- rc = errno;
- fprintf(stderr, "error: %s: wait - %s\n",
- argv[0], strerror(rc));
- } else {
- /*
- * This is a hack. We _should_ be able to use
- * WIFEXITED(status) to see if there was an
- * error, but it appears to be broken and it
- * always returns 1 (OK). See wait(2).
- */
- int err = WEXITSTATUS(status);
- if (err || WIFSIGNALED(status))
- fprintf(stderr,
- "%s: PID %d had rc=%d\n",
- argv[0], ret, err);
- if (!rc)
- rc = err;
- }
- live_threads--;
- }
- } else {
- if (threads)
- sprintf(filename, "%s-%d", argv[1], thread);
- else
- strcpy(filename, argv[1]);
-
- fd = open(filename, O_RDWR|O_CREAT, 0644);
- if (fd < 0) {
- rc = errno;
- fprintf(stderr, "open(%s, O_CREAT): %s\n", filename,
- strerror(rc));
- exit(rc);
- }
- if (close(fd) < 0) {
- rc = errno;
- fprintf(stderr, "close(): %s\n", strerror(rc));
- goto unlink;
- }
-
- for (i = 0; i < count; i++) {
- fd = open(filename, O_RDWR|O_LARGEFILE|O_DIRECT);
- if (fd < 0) {
- rc = errno;
- fprintf(stderr, "open(%s, O_RDWR): %s\n",
- filename, strerror(rc));
- break;
- }
- if (ioctl(fd, LL_IOC_SETFLAGS, &ioctl_flags) < 0 &&
- errno != ENOTTY) {
- rc = errno;
- fprintf(stderr, "ioctl(): %s\n", strerror(rc));
- break;
- }
- if (close(fd) < 0) {
- rc = errno;
- fprintf(stderr, "close(): %s\n", strerror(rc));
- break;
- }
- }
- unlink:
- if (unlink(filename) < 0) {
- rc = errno;
- fprintf(stderr, "unlink(%s): %s\n", filename,
- strerror(rc));
- }
- if (threads)
- printf("Thread %d done: rc = %d\n", thread, rc);
- else
- printf("Done: rc = %d\n", rc);
- }
- return rc;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- int fd;
-
- if (argc != 2) {
- printf("Usage openme <filename>\n");
- exit(1);
- }
-
- fd = open(argv[1], O_RDONLY | O_CREAT, 0600);
- if (fd == -1) {
- printf("Error opening %s\n", argv[1]);
- exit(1);
- }
-
- sleep(10000000);
- return 0;
-}
run_test 2b "touch"
test_3a() {
+ local file=$DIR/$tfile
replay_barrier mds
- mcreate $DIR/$tfile
- o_directory $DIR/$tfile
+ mcreate $file
+ openfile -f O_DIRECTORY $file
fail mds
- $CHECKSTAT -t file $DIR/$tfile || return 2
- rm $DIR/$tfile
+ $CHECKSTAT -t file $file || return 2
+ rm $file
}
run_test 3a "replay failed open(O_DIRECTORY)"
OPENFILE=${OPENFILE:-openfile}
OPENUNLINK=${OPENUNLINK:-openunlink}
READS=${READS:-"reads"}
-TOEXCL=${TOEXCL:-toexcl}
TRUNCATE=${TRUNCATE:-truncate}
MUNLINK=${MUNLINK:-munlink}
SOCKETSERVER=${SOCKETSERVER:-socketserver}
run_test 22 "unpack tar archive as non-root user ==============="
test_23() {
- mkdir $DIR/d23
- $TOEXCL $DIR/d23/f23
- $TOEXCL -e $DIR/d23/f23 || error
+ mkdir -p $DIR/$tdir
+ local file=$DIR/$tdir/$tfile
+
+ openfile -f O_CREAT:O_EXCL $file || error "$file create failed"
+ openfile -f O_CREAT:O_EXCL $file &&
+ error "$file recreate succeeded" || true
}
run_test 23 "O_CREAT|O_EXCL in subdir =========================="
}
run_test 27w "check lfs setstripe -c -s -i options ============="
-test_28() {
+# createtest also checks that device nodes are created and
+# then visible correctly (#2091)
+test_28() { # bug 2091
mkdir $DIR/d28
$CREATETEST $DIR/d28/ct || error
}
run_test 37 "ls a mounted file system to check old content ====="
test_38() {
- o_directory $DIR/$tfile
+ local file=$DIR/$tfile
+ touch $file
+ openfile -f O_DIRECTORY $file
+ local RC=$?
+ local ENOTDIR=20
+ [ $RC -eq 0 ] && error "opened file $file with O_DIRECTORY" || true
+ [ $RC -eq $ENOTDIR ] || error "error $RC should be ENOTDIR ($ENOTDIR)"
}
-run_test 38 "open a regular file with O_DIRECTORY =============="
+run_test 38 "open a regular file with O_DIRECTORY should return -ENOTDIR ==="
test_39() {
touch $DIR/$tfile
}
run_test 46 "dirtying a previously written page ================"
-# Check that device nodes are created and then visible correctly (#2091)
-test_47() {
- cmknod $DIR/test_47_node || error
-}
-run_test 47 "Device nodes check ================================"
+# test_47 is removed "Device nodes check" is moved to test_28
test_48a() { # bug 2399
check_kernel_version 34 || return 0
SIZE=${SIZE:-40960}
CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
-CREATETEST=${CREATETEST:-createtest}
GETSTRIPE=${GETSTRIPE:-lfs getstripe}
SETSTRIPE=${SETSTRIPE:-lstripe}
MCREATE=${MCREATE:-mcreate}
OPENFILE=${OPENFILE:-openfile}
OPENUNLINK=${OPENUNLINK:-openunlink}
-TOEXCL=${TOEXCL:-toexcl}
TRUNCATE=${TRUNCATE:-truncate}
export TMP=${TMP:-/tmp}
MOUNT_2=${MOUNT_2:-"yes"}
+++ /dev/null
-#!/bin/sh
-[ `hostname` = "uml1" ] && date --set="Mar 14 20:21:41 MDT 1973" #101010101
-[ `hostname` = "uml2" ] && date --set="May 26 22:43:22 MDT 1976" #202020202
-[ `hostname` = "uml3" ] && date --set="Aug 9 01:05:03 MDT 1979" #303030303
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define BUFSIZE (4096)
-
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
-int main(int argc, char *argv[])
-{
-
- FILE *w_str;
- int read_fd;
- int rc, iter;
- int line, delta, next;
- int sleeptime = 0;
- char *now_time;
- const char ok_chars[] = "MonTueWedThuFriSatSun"
- "JanFebMarAprMayJunJulAugSepOctNovDec"
- "Line 0123456789 of file, written at:\n";
-
- char buf_r[BUFSIZE];
-
- char pathname[256] = "/mnt/lustre/linetest_";
- char *host;
-
- if (argc > 1) {
- strncpy(pathname, argv[1], 255);
- pathname[255] = '\0';
- }
-
- host = getenv("HOSTNAME");
- if (host)
- strcat(pathname, host);
-
- if (argc > 2)
- sleeptime = strtoul(argv[2], NULL, 0);
-
- if (sleeptime == 0)
- sleeptime = 30;
-
- printf("Test file used is: %s at %ds intervals\n", pathname, sleeptime);
-
- w_str = fopen(pathname, "wb");
- if (w_str == NULL) {
- perror("fopen");
- exit(1);
- }
- read_fd = open(pathname, O_RDONLY);
- if (read_fd < 0) {
- perror("open");
- exit(1);
- }
-
- next = 1;
- delta = 17;
- iter = 1;
- while (1) {
- time_t now;
- struct tm *t;
- long offset;
-
- now = time((time_t *)NULL);
- t = localtime(&now);
- now_time = asctime(t);
-
- printf("iter: %d\n", iter);
-
- for (line=next; line<(next+delta); line++) {
- rc = fprintf(w_str, "Line %8d of file, written at: %s",
- line, now_time);
- /* \n comes from ctime() result */
- if (rc <= 0) {
- perror("fprintf");
- exit(4);
- }
- rc = fflush(w_str);
- if (rc != 0) {
- perror("fflush");
- exit(5);
- }
- }
- next += delta;
-
- /* Check for corruption */
- offset = ftell(w_str);
- rc = lseek(read_fd, offset & ~4095, SEEK_SET);
- if (rc != (offset & ~4095)) {
- perror("lseek");
- exit(7);
- }
-
- rc = read(read_fd, buf_r, min(100, offset & 4095));
- if (rc != min(100, offset & 4095)) {
- printf("rc: %d, off %lu buf: '%s'\n", rc,offset,buf_r);
- exit(8);
- }
- buf_r[rc] = 0;
- /* Chars from "C" days/months, and above Line */
- if (strspn(buf_r, ok_chars) != rc) {
- printf("Corruption detected at %lu on %s",
- offset & ~4095, now_time);
- exit(9);
- }
-
- sleep(sleeptime);
- iter++;
- }
-
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Beware when setting FSROOT that I've not made any attempts to avoid buffer
- * overruns below--this is a test program, it's a static buffer. */
-#define FSROOT "/mnt"
-#define OBD_ITERATIONS 10000
-
-int main (int argc, char * argv[])
-{
- int fd, rc, err = -1;
- struct stat stat_buf;
-
- if (argc < 2) {
- printf("syntax: %s command\n", argv[0]);
- printf("Where command is one of \"setup\" or \"create\".\n");
- exit(1);
- }
-
- if (!strcmp(argv[1], "setup")) {
- printf("This is silly.\n");
- } else if (!strcmp(argv[1], "create")) {
- int i, iter;
-
- if (argc < 3) {
- printf("create requires a nonzero argument.\n");
- exit(1);
- }
-
- iter = atoi(argv[2]);
-
- if (iter < 1) {
- printf("create requires a nonzero argument.\n");
- exit(1);
- }
- printf("creating %d files...\n", iter);
-
- for (i = 0; i < iter; i++) {
- fd = creat(FSROOT "/foo123", S_IRWXU);
- close(fd);
- unlink(FSROOT "/foo123");
- }
- } else {
- printf("Invalid command, run with no arguments for help.\n");
- }
-
- return 0;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-void
-usage (char *argv0, int help)
-{
- char *progname = strrchr(argv0, '/');
-
- if (progname == NULL)
- progname = argv0;
-
- fprintf (help ? stdout : stderr,
- "Usage: %s [-e] file\n", progname);
-
- if (!help)
- {
- fprintf (stderr, " or try '-h' for help\n");
- exit (1);
- }
-
- printf ("Create the given file with O_EXCL...\n");
- printf (" -e expect EEXIST\n");
- printf (" -h print help");
- printf (" Exit status is 0 on success, 1 on failure\n");
-}
-
-int main(int argc, char **argv)
-{
- int rc;
- int want_eexist = 0;
-
- while ((rc = getopt (argc, argv, "eh")) != -1)
- switch (rc)
- {
- case 'e':
- want_eexist = 1;
- break;
- case 'h':
- usage (argv[1], 1);
- return (0);
- default:
- usage (argv[0], 0);
- }
-
- if (optind != argc - 1) {
- usage (argv[0], 0);
- return 1;
- }
-
- rc = open(argv[optind], O_CREAT|O_EXCL, 0644);
- if (rc == -1)
- {
- if (want_eexist && errno == EEXIST)
- {
- printf("open failed: %s (expected)\n", strerror(errno));
- return (0);
- }
- printf("open failed: %s\n", strerror(errno));
- return (1);
- } else {
- if (want_eexist)
- {
- printf("open success (expecting EEXIST).\n");
- return (1);
- }
- printf("open success.\n");
- return (0);
- }
-
- return ((rc == 0) ? 0 : 1);
-}