#!/bin/sh -e #set -x # Manipulation, putting and getting of one dataset generated by poundtest.sh # Usage: putget testid numputs fileset if [ "$1" = "" ] then testid=`date "+%Y%m%d%H%M%S"` else testid=$1 fi if [ "$2" = "" ] then ddir="smallfiles" else ddir=$2 fi echo "Running $testid $ddir" # SDL get rid of hardcoding irodshome=../../ iDir=$irodshome/clients/icommands/bin resourceset=`cat ResourcesToTest` DATADIR=$irodshome/clients/concurrent-test/$ddir FILES=`ls $DATADIR` TMP_DIR=TMP # Initialize irods client environment, and get User information #$iDir/iinit -v #$iDir/iuserinfo -v #$iDir/ilsresc -vl # Make local directories if needed test -d $TMP_DIR || mkdir $TMP_DIR test -d Isub1 || mkdir Isub1 test -d Isub2 || mkdir Isub2 $iDir/imkdir $testid $iDir/icd $testid for myresc in $resourceset ; do echo "Testing puts and gets in resource: " $myresc $iDir/imkdir Isub1 $iDir/icd Isub1 # iput one file at a time or iput the whole directory? # SDL we should test for putting multiple files one at a time and also using wildcards for file in $FILES ; do $iDir/iput -f -R $myresc $DATADIR/$file $iDir/imeta add -d $file $file-A $file-B $file-C echo "putting file \"$file\"" done $iDir/icd .. # OK let's get back what we've just put in, just do a 'diff' for file in $FILES ; do $iDir/iget -f Isub1/$file $TMP_DIR/$file.$testid.tmp diffresult=`diff $DATADIR/$file $TMP_DIR/$file.$testid.tmp` # SDL Why bother with wc? wc $DATADIR/$file $TMP_DIR/$file.$testid.tmp if [ -n "$diffresult" ]; then echo "$file is different from it's retrieved counterpart" exit 3 fi done # Move all files from Isub1 to Isub2 $iDir/imkdir Isub2 for file in $FILES ; do $iDir/imv Isub1/$file Isub2 echo "moving file \"$file\"" attname=`$iDir/imeta qu -d $file-A = $file-B | grep -A 1 $testid | grep dataObj | awk {'print $2'}` echo $attname if [ "$attname" != "$file" ]; then echo "attribute name not retrieved correctly (or something)" exit 3 fi done # Copy all data across different platforms, replicate, then get data to local # environment, and compare with local copies of same data. #for store in $resourceset ; do # for file in $FILES ; do # $iDir/icp -f -R $store Isub2/$file Isub1/$file.$store # #iDir/irepl -R $store Isub1/$file.$store SDL what is this # done # # $iDir/iget -rf Isub1 # $iDir/iget -rf Isub2 # for file in $FILES ; do # $iDir/iget Isub1/$file.$store $TMP_DIR/$file.$testid.tmp # diff $DATADIR/$file $TMP_DIR/$file.$testid.tmp # wc $DATADIR/$file $TMP_DIR/$file.$testid.tmp # rm $TMP_DIR/$file.$testid.tmp # done # done $iDir/irm -r Isub1 $iDir/irm -r Isub2 done # Remove IRODS space test directories and end session $iDir/icd $iDir/irm -r $testid #$iDir/irmtrash (let caller do this or a failure may occur) $iDir/iexit # Clean up locally #/bin/rm -rf TMP Isub1 Isub2 (let caller do this so it is only once; avoid error) # SDL need proper return values exit 0