#!/bin/bash
# ----------------------------------------------------------------------
# File: eos-instance-test
# Author: Andreas-Joachim Peters - CERN
# ----------------------------------------------------------------------
# ************************************************************************
# * EOS - the CERN Disk Storage System *
# * Copyright (C) 2011 CERN/Switzerland *
# * *
# * This program is free software: you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation, either version 3 of the License, or *
# * (at your option) any later version. *
# * *
# * 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 for more details. *
# * *
# * You should have received a copy of the GNU General Public License *
# * along with this program. If not, see .*
# ************************************************************************
################################################################################
# Usage:
#
# - run full test suite: bash> eos-instance
# - list test id's: bash> eos-instance list
# - limit tests: bash> eos-instance 243 258 # run 243-258 (prepare+cleanup always runs)
# - limit tests: bash> eos-instance fuse,rain # run only fuse+rain tests
#
################################################################################
# default values can be overwritten in /etc/sysconfig/eos
#export EOS_TEST_MAILNOTIFY=apeters@mail.cern.ch
#export EOS_TEST_GSMNOTIFY="0041764875002@mail2sms.cern.ch"
export EOS_TEST_REDIRECTOR=localhost
export EOS_TEST_FULL_REDIRECTOR=$(hostname -f)
export EOS_TEST_TESTSYS=/tmp/eos-instance-test
export EOS_TEST_GSMLOCKTIME=3600
export EOS_TEST_TESTTIMESLICE=900
export EOS_HTTPS_PORT="$(grep -oP 'XrdHttp:\K(\d+)' /etc/xrd.cf.mgm)"
firsttest=$1
lasttest=$2
################################################################################
# COLOR FUNCTIONS
################################################################################
BOOTUP=color
RES_COL=60
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
echo_success() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
echo -n $" OK "
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 0
}
echo_failure() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo -n $"FAILED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
echo_passed() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo -n $"PASSED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
echo_warning() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo -n $"WARNING"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
# Log that something succeeded
success() {
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success
return 0
}
# Log that something failed
failure() {
local rc=$?
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure
[ -x /bin/plymouth ] && /bin/plymouth --details
return $rc
}
# Log that something passed, but may have had errors. Useful for fsck
passed() {
local rc=$?
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed
return $rc
}
# Log a warning
warning() {
local rc=$?
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning
return $rc
}
################################################################################
# Check which version of XRootD we are using
################################################################################
XRD_VERS=$(xrootd -v 2>&1)
XRD_VERS_MAJOR=${XRD_VERS:1:1}
if [ -e /etc/sysconfig/eos ]; then
. /etc/sysconfig/eos
fi
if [ -z "$EOS_TEST_INSTANCE" ]; then
if [ -n "$EOS_INSTANCE_NAME" ]; then
export EOS_TEST_INSTANCE=${EOS_INSTANCE_NAME#eos}
else
export EOS_TEST_INSTANCE="dev"
fi
fi
################################################################################
mkdir -p $EOS_TEST_TESTSYS
################################################################################
# don't touch
export failed=0
export success=0
export EOSLASTLOG=$EOS_TEST_TESTSYS/test-last.log
export EOSALLCERTLOG=$EOS_TEST_TESTSYS/test-result.log
export EOSCERTLOG="$EOS_TEST_TESTSYS/test-output.log"
export GSMLOCKFILE=$EOS_TEST_TESTSYS/eos-gsm.lock
export EOSTESTPID=$EOS_TEST_TESTSYS/eos-pid
export FAILFILE=$EOS_TEST_TESTSYS/eos-failed
export TIMEOUTFILE=$EOS_TEST_TESTSYS/eos-timeout
export TESTSYSFILE0K=$EOS_TEST_TESTSYS/file.0K
export TESTSYSFILE1K=$EOS_TEST_TESTSYS/file.1K
export TESTSYSFILE1M=$EOS_TEST_TESTSYS/file.1M
export TESTSYSFILE50M=$EOS_TEST_TESTSYS/file.50M
export TESTFSTFILE32M=$EOS_TEST_TESTSYS/file.32M
export EOSLOGBOOK=/var/log/eos/mgm/logbook.log
################################################################################
if [ "x$1" != "xlist" ]; then
if [ ! -e $TESTSYSFILE0K ]; then
echo "####################################"
echo "### Creating Test Pattern File 0K"
echo "####################################"
rm -rf $TESTSYSFILE0K >& /dev/null
touch $TESTSYSFILE0K
fi
if [ ! -e $TESTSYSFILE1K ]; then
echo "####################################"
echo "### Creating Test Pattern File 1K"
echo "####################################"
yes | dd of=$TESTSYSFILE1K bs=1k count=1
fi
CKS1K=`eos-adler32 $TESTSYSFILE1K | awk '{print $4}' | sed s/adler32=//`
echo "adler32 (1k) = $CKS1K"
if [ ! -e $TESTSYSFILE1M ]; then
echo "####################################"
echo "### Creating Test Pattern File 1M"
echo "####################################"
yes | dd of=$TESTSYSFILE1M bs=1k count=1000
fi
CKS1M=`eos-adler32 $TESTSYSFILE1M | awk '{print $4}' | sed s/adler32=//`
echo "adler32 (1M) = $CKS1M"
if [ ! -e $TESTSYSFILE50M ]; then
echo "####################################"
echo "### Creating Test Pattern File 50M"
echo "####################################"
yes | dd of=$TESTSYSFILE50M bs=1k count=50000
fi
CKS50M=`eos-adler32 $TESTSYSFILE50M | awk '{print $4}' | sed s/adler32=//`
echo "adler32 (50M) = $CKS50M"
if [ ! -e $TESTFSTFILE32M ]; then
echo "#######################################"
echo "### Creating FST Test Pattern File 32M"
echo "#######################################"
dd if=/dev/zero bs=1M count=32 | tr '\000' '\001' > $TESTFSTFILE32M
fi
export EOS_TEST_RAIN_DIR=$EOS_TEST_TESTSYS/rain
if [ ! -d $EOS_TEST_RAIN_DIR ]; then
echo "############################################"
echo "### Creating RAIN Dir"
echo "############################################"
mkdir -p $EOS_TEST_RAIN_DIR
dd if=/dev/urandom of=$EOS_TEST_RAIN_DIR/file1.rain bs=1552K count=1
dd if=/dev/urandom of=$EOS_TEST_RAIN_DIR/file2.rain bs=18227K count=1
dd if=/dev/urandom of=$EOS_TEST_RAIN_DIR/file3.rain bs=1M count=34
echo "############################################"
echo "### Creating Files and Patterns for IO Test"
echo "############################################"
cp $EOS_TEST_RAIN_DIR/file1.rain $EOS_TEST_RAIN_DIR/file1.io
(echo "0 524288"; echo "409600 786432"; echo "614400 1048576"; echo "1024000 1589248") >> $EOS_TEST_RAIN_DIR/file1.io.pattern
cp $EOS_TEST_RAIN_DIR/file2.rain $EOS_TEST_RAIN_DIR/file2.io
(echo "0 4194304"; echo "1048576 2097152"; echo "3145728 7340032"; echo "5242880 6291456"; echo "7340032 15728640"; echo "14680064 17825792"; echo "16777216 18664448") >> $EOS_TEST_RAIN_DIR/file2.io.pattern
cp $EOS_TEST_RAIN_DIR/file3.rain $EOS_TEST_RAIN_DIR/file3.io
(echo "0 524288"; echo "409600 786432"; echo "614400 1048576"; echo "1024000 1589248";
echo "1589248 20971520"; echo "20971520 20973568"; echo "20972544 20975616 ";
echo "20972544 20976640"; echo "20976640 35651584") >> $EOS_TEST_RAIN_DIR/file3.io.pattern
fi
fi
################################################################################
. /etc/rc.d/init.d/functions
echo "" > $EOSALLCERTLOG
rm -f $FAILFILE 2>/dev/null
rm -f $TIMEOUTFILE 2>/dev/null
rm -f $EOSCERTLOG 2>/dev/null
kill_child_processes() {
pid=$(bash -c 'echo $PPID');
if [ $1 -gt 0 ]; then
pids=`pstree -p $1 | sed 's/(/\n(/g' | grep '(' | sed 's/(\(.*\)).*/\1/' | tr "\n" " "`;
for name in $pids; do
if [ $name -ne $pid ]; then
kill -9 $name >& /dev/null
usleep 100000
fi
done
fi
}
kill_processes() {
echo
echo
echo "CONTORL-C received ... aborting ..."
echo
pid=`cat $EOSTESTPID 2>/dev/null`;
if [ -z "$pid" ]; then
pid=$(bash -c 'echo $PPID');
fi
kill_child_processes $pid;
exit 255;
}
################################################################################
mailnotify () {
OK="OK" && test -e $FAILFILE && OK="FAILED"
if [ $OK = "FAILED" ]; then
if [ -n "$EOS_TEST_MAILNOTIFY" ]; then
mutt -s "$EOS_TEST_INSTANCE $OK" $EOS_TEST_MAILNOTIFY < $EOSALLCERTLOG ; fi
if [ ! -e $GSMLOCKFILE ]; then
if [ -n "$EOS_TEST_GSMNOTIFY" ]; then
echo "$EOS_TEST_INSTANCE failed at `date`" | mail -s "$EOS_TEST_INSTANCE $OK" $EOS_TEST_GSMNOTIFY ; \
touch $GSMLOCKFILE; ( sleep EOS_TEST_GSMLOCKTIME; rm -rf $GSMLOCKFILE; ) >& /dev/null &
fi;
fi
exit 255;
fi
exit 0;
}
################################################################################
(
export XROOTSYS=/usr/
export LD_LIBRARY_PATH=$XROOTSYS/lib64/:$LD_LIBRARY_PATH
export PATH=$XROOTSYS/bin:$PATH
export EOS_XROOTSYS=/opt/eos/xrootd/
export LD_LIBRARY_PATH=$EOS_XROOTSYS/lib64/:$LD_LIBRARY_PATH
export PATH=$EOS_XROOTSYS/bin:$PATH
pid=$(bash -c 'echo $PPID');
echo -n $pid >& $EOSTESTPID
################################################################################
# Library
################################################################################
showtoken () {
echo "############### KRB 5 ##############"
/usr/kerberos/bin/klist -5
echo "############### X509 ##############"
xrdgsiproxy info
echo "####################################"
}
################################################################################
logoutput () {
echo "----------------- Error Output --------------------";cat $EOSCERTLOG ;echo "---------------------------------------------------"
}
################################################################################
upload () {
src=$1
dst=$2
shift
shift
echo xrdcp -np -v -f $* $src root://$EOS_TEST_REDIRECTOR/$dst >& $EOSLASTLOG ;eval command xrdcp -f $* $src root://$EOS_TEST_REDIRECTOR/$dst >> $EOSCERTLOG 2>&1
}
################################################################################
download () {
src=$1
dst=$2
shift
shift
echo xrdcp -np -v -f $* root://$EOS_TEST_REDIRECTOR/$dst $src >& $EOSLASTLOG ;eval command xrdcp -f $* root://$EOS_TEST_REDIRECTOR/$dst $src >> $EOSCERTLOG 2>&1
}
################################################################################
downloadh () {
src=$1
dst=$2
shift
shift
echo xrdcp -np -v -f $* root://$EOS_TEST_FULL_REDIRECTOR/$dst $src >& $EOSLASTLOG ;eval command xrdcp -f $* root://$EOS_TEST_FULL_REDIRECTOR/$dst $src >> $EOSCERTLOG 2>&1
}
################################################################################
timeout() {
echo "## TIMEOUT ##";
exit 0;
}
meta() {
echo xrdfs $EOS_TEST_REDIRECTOR $* >& $EOSLASTLOG ; eval command xrdfs $EOS_TEST_REDIRECTOR $* >> $EOSCERTLOG 2>&1
}
eos() {
echo eos -b $EOSROLE $EOSAPP root://$EOS_TEST_REDIRECTOR $* >& $EOSLASTLOG; eval command eos -b $EOSROLE $EOSAPP root://$EOS_TEST_REDIRECTOR $* >> $EOSCERTLOG 2>&1
}
eosj() {
echo eos -j -b $EOSROLE $EOSAPP root://$EOS_TEST_REDIRECTOR $* >& $EOSLASTLOG; eval command eos -j -b $EOSROLE $EOSAPP root://$EOS_TEST_REDIRECTOR $* >> $EOSCERTLOG 2>&1
}
tpc1() {
src=$1
dst=$2
echo xrdcp --tpc only root://$EOS_TEST_REDIRECTOR/$src root://$EOS_TEST_REDIRECTOR/$dst >& $EOSLASTLOG; eval command xrdcp -f --tpc only root://$EOS_TEST_REDIRECTOR/$src root://$EOS_TEST_REDIRECTOR/$dst >> $EOSCERTLOG 2>&1
}
tpc2() {
src=$1
dst=$2
echo xrdcopy --tpc only root://$EOS_TEST_REDIRECTOR/$src root://$EOS_TEST_REDIRECTOR/$dst >& $EOSLASTLOG; eval command xrdcopy --tpc only root://$EOS_TEST_REDIRECTOR/$src root://$EOS_TEST_REDIRECTOR/$dst >> $EOSCERTLOG 2>&1
}
tgrep() {
a=$1
shift
echo "eval $* | grep $a" >& $EOSLASTLOG; eval $* | grep $a >> $EOSCERTLOG 2>&1
}
stress() {
echo xrdstress $* >& $EOSLASTLOG; eval XRD_RUNFORKHANDLER=1 xrdstress $* >> $EOSCERTLOG 2>&1
}
append() {
echo xrdcpappend root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpappend root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
overlap() {
echo xrdcpappendoverlap root://123@$EOS_TEST_REDIRECTOR/$1 root://124@$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpappendoverlap root://123@$EOS_TEST_REDIRECTOR/$1 root://124@$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
abort() {
echo xrdcpabort root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpabort root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
extend() {
echo xrdcpextend root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpextend root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
delay() {
echo sleep $1 >& $EOSLASTLOG ; eval sleep $1 >> $EOSCERTLOG 2>&1
}
shrink() {
echo xrdcpshrink root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpshrink root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
random() {
echo xrdcprandom root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcprandom root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
truncate() {
echo xrdcptruncate root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcptruncate root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
cp_nonstreaming() {
echo xrdcpnonstreaming $1 root://$EOS_TEST_REDIRECTOR/$2 >& $EOSLASTLOG; eval xrdcpnonstreaming $1 root://$EOS_TEST_REDIRECTOR/$2 >> $EOSCERTLOG 2>&1
}
holes() {
echo xrdcpholesroot://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpholes root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
backward() {
echo xrdcpbackward root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpbackward root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
partial() {
echo xrdcppartial root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcppartial root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
downloadrandom() {
echo xrdcpdownloadrandom root://$EOS_TEST_REDIRECTOR/$1 >& $EOSLASTLOG; eval xrdcpdownloadrandom root://$EOS_TEST_REDIRECTOR/$1 >> $EOSCERTLOG 2>&1
}
eos_rain() {
echo eos-rain-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >& $EOSLASTLOG; eval eos-rain-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >> $EOSCERTLOG 2>&1
}
eos_quota() {
echo eos-quota-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >& $EOSLASTLOG; eval eos-quota-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >> $EOSCERTLOG 2>&1
}
eos_defaultcc() {
echo eos-defaultcc-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >& $EOSLASTLOG; eval eos-defaultcc-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >> $EOSCERTLOG 2>&1
}
eos_bash() {
echo env EOS_FUSE_SECRET=${EOS_FUSE_SECRET} eos-bash $* >& $EOSLASTLOG; env EOS_FUSE_SECRET=${EOS_FUSE_SECRET} eos-bash $* >> $EOSCERTLOG 2>&1
}
eos_synctime() {
echo eos-synctime-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >& $EOSLASTLOG; eval eos-synctime-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >> $EOSCERTLOG 2>&1
}
eos_rclone() {
echo eos-rclone-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >& $EOSLASTLOG; eval eos-rclone-test $1 $2 root://$EOS_TEST_REDIRECTOR/$3 >> $EOSCERTLOG 2>&1
}
eoscp_rain() {
echo eoscp-rain-test $1 root://$EOS_TEST_REDIRECTOR/$2 >& $EOSLASTLOG; eval eoscp-rain-test $1 root://$EOS_TEST_REDIRECTOR/$2 >> $EOSCERTLOG 2>&1
}
eos_io() {
echo eos-io-test root://$EOS_TEST_REDIRECTOR/$1 $2 >& $EOSLASTLOG; eval eos-io-test root://$EOS_TEST_REDIRECTOR/$1 $2 >> $EOSCERTLOG 2>&1
}
eos_rename() {
echo eos-rename-test $1 $EOS_TEST_REDIRECTOR; eval eos-rename-test $1 $EOS_TEST_REDIRECTOR >> $EOSCERTLOG 2>&1
}
eos_grpc() {
echo eos-grpc-test $1 ; eval eos-grpc-test $1 >> $EOSCERTLOG 2>&1
}
eos_token() {
echo eos-token-test $1 ; eval eos-token-test $1 >> $EOSCERTLOG 2>&1
}
eos_squash() {
echo eos-squash-test $1 ; eval eos-squash-test $1 ${EOS_TEST_FULL_REDIRECTOR} >> $EOSCERTLOG 2>&1
}
shell() {
echo $* >& $EOSLASTLOG; eval $* >> $EOSCERTLOG 2>&1
}
################################################################################
testout () {
echo Failed: $failed Success: $success
if [ $failed -gt 0 ]; then touch $FAILFILE; fi
}
################################################################################
testcnt=0;
runtest () {
testcnt=$((testcnt+1));
if [ -e $TIMEOUTFILE ]; then
echo -n $(date +"%x %X") timeout
failure
else
echo "-------------------------------------------------------------" >> $EOSCERTLOG 2>&1
echo "# Test $testcnt: $*" >> $EOSCERTLOG 2>&1
echo "-------------------------------------------------------------" >> $EOSCERTLOG 2>&1
if [ "$firsttest" = "list" ]; then
printf "# [ %-7s ]" $categorie ;
printf " ID %02d" $testcnt;
echo " $*"
return
fi
redir=$EOS_TEST_REDIRECTOR
if [ "$1" = H ]; then
EOS_TEST_REDIRECTOR=$EOS_TEST_FULL_REDIRECTOR
shift
fi
START=$(date +%s.%N)
echo $testcnt | awk '{printf("%04d ",$1);}'
echo -n $(date +"%x %X") "$1"
auth=$2
res=$3
renv=$4
shift
echo -n $*
shift
shift
shift
skip=0
if [ $categorie != "prep" ] && [ $categorie != "clean" ]; then
# --- if $firsttest is set and $lasttest not we assume it is a categorie list
if [ "x$firsttest" != "x" ] && [ "x$lasttest" == "x" ]; then
if [ "x$firsttest" = "x${firsttest/$categorie}" ] ; then
echo
warning "skipped" ; echo -n " ... skipped"
echo
skip=1
fi
else
# --- skip if start-range was given
if [ "x$firsttest" != "x" ] ; then
if [ $testcnt -lt $firsttest ]; then
echo
warning "skipped" ; echo -n " ... skipped"
echo
skip=1
fi
fi
# --- skip if end-range was given
if [ "x$lasttest" != "x" ] ; then
if [ $testcnt -gt $lasttest ]; then
echo
warning "skipped" ; echo -n " ... skipped"
echo
skip=1
fi
fi
fi
fi
if [ $skip = 0 ] ; then
if [ $auth = "krb5" ] ; then ( eval export X509_USER_CERT=/tmp/illegal X509_USER_KEY=/tmp/illegal $renv; $* ) ; ret=$?; fi
if [ $auth = "gsi" ] ; then ( eval export KRB5CCNAME=/tmp/illegal $renv; $* ) ; ret=$?; fi
if [ $auth = "unix" ] ; then ( eval export XrdSecPROTOCOL=unix $renv; $* ) ; ret=$?; fi
if [ $auth = "sss" ] ; then ( eval export XrdSecPROTOCOL=sss $renv; $* ) ; ret=$?; fi
echo
if [ $res -eq 0 ] ; then if [ $ret -eq 0 ]; then success; ((success++));else failure ; ((failed++)); echo ; fi; fi
if [ $res -eq 1 ] ; then if [ $ret -ne 0 ]; then success; ((success++));else failure ; ((failed++)); echo ; fi; fi
if [ $res -eq 2 ] ; then success; ((success++)); fi
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo " in $DIFF seconds ($ret)"
fi
echo "--------------------------------------------------------------------------------------------------------------------"
EOS_TEST_REDIRECTOR=$redir
fi
}
################################################################################
echo "==================================================="
echo "### Testing $EOS_TEST_REDIRECTOR"
echo "==================================================="
################################################################################
# define your tests here
# runtest
# : describes what you are testing
# : 'krb5','gsi','unix','sss' - choose krb5 or X509 authentication [ you have to create both tokens beforehand ]
# : can be used to set the execution environment env "
# : 0 or 1 => 0 - you expect the command works , 1 - you expect that the command failes, 2 - you run the command but it can fail or not, that is expected
# : upload|download|downloadh|meta|eos|stress|abort|extend|shrink|random|truncate|holes|backward|partial|downloadrandom|tpc1|tpc2|shell|eoscp_rain|eos_rain|eos_io :
# self explaining - meta executes command via xrd shell, eos via eos shell, stress runs xrdstress, abort runs xrdcpabort ...
# : is a local '/...' or remote '/eos/...' path
# : opaque information passed ... '&' has to be escaped !!!!
################################################################################
################################################################################
#xrdgsiproxy init >>& $EOSCERTLOG
showtoken >> $EOSCERTLOG 2>&1
################################################################################
# Preparation
################################################################################
# ------------------------------------------------------------------------------
categorie="prep"
# ------------------------------------------------------------------------------
runtest "### Access " unix 2 "" eos "access rm stall r"
runtest "### Access " unix 2 "" eos "access rm redirect"
runtest "### Access " unix 2 "" eos "access unban user nobody"
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/stress/"
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.blockchecksum /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.blocksize /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.checksum /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.layout /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.nstripes /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.space /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.forced.atomic /eos/$EOS_TEST_INSTANCE/test/
runtest "### Cleanup " unix 2 "" eos attr rm sys.versioning /eos/$EOS_TEST_INSTANCE/test
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Quota " unix 1 "" eos quota set -u 99 -p /eos/$EOS_TEST_INSTANCE/test -v 1G -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 99 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 11 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 100 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 2 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 3 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 2000 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
# Add quota for eos-user
runtest "### Quota " unix 0 "" eos quota set -u 1000 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
# Add quota for s3user
runtest "### Quota " unix 0 "" eos quota set -u 1004 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Rm " unix 0 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Chmod " unix 0 "" eos chmod "755" "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Motd " unix 0 "" eos motd
runtest "### Help " unix 0 "" eos "help | grep \"Display this text\""
################################################################################
# Upload,Download,Stat,Rename
################################################################################
# ------------------------------------------------------------------------------
categorie="core"
# ------------------------------------------------------------------------------
runtest "### Upload " unix 1 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-ODeos.space=default"
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-ODeos.space=default"
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Stat " unix 1 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.1"
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Part.Dwld " unix 0 "" partial "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Download " unix 1 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.1"
runtest "### Dowl Lfn " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/enoent" "-OSeos.lfn=/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Dowl Lfn " unix 1 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/enoent" "-OSeos.lfn=/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.1"
runtest "### Dowl Pfx " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/test/instancetest/passwd" "-OSeos.prefix=/eos/$EOS_TEST_INSTANCE/"
runtest "### Dowl Pfx " unix 1 "" download "$EOS_TEST_TESTSYS/dumpit" "/test/instancetest/passwd" "-OSeos.prefix=/eos/faulty/"
runtest "### Old find " unix 0 "" eos oldfind "-f --count /eos/$EOS_TEST_INSTANCE/test/ | grep nfiles=1"
runtest "### Find " unix 0 "" eos find "-f --count /eos/$EOS_TEST_INSTANCE/test/ | grep nfiles=1"
runtest "### Rem " unix 1 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.1"
runtest "### FileInfo " unix 1 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.1"
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Whoami " unix 0 "" eos "whoami | grep authz:unix | grep uid=0"
runtest "### Who " unix 0 "" eos "who | grep root"
runtest "### Rem " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Rename " unix 1 "" eos "file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.rename"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-ODeos.space=default"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.meta4" "-ODeos.space=default"
runtest "### Upload " unix 0 "XRD_METALINKPROCESSING=0" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.meta4"
runtest "### Rem " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.meta4"
runtest "### Chmod " unix 0 "" eos chmod "755" "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest "### Rename " unix 1 "EOSROLE='-r 99 99'" eos file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.rename
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest "### Rename " unix 0 "" eos file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.rename
runtest "### Mkdir " unix 0 "" eos "mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/rename.dir"
runtest "### Rename " unix 1 "" eos "file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/rename.dir /eos/$EOS_TEST_INSTANCE/test/instancetest/rename.dir/myself"
runtest "### Rename " unix 1 "" eos "file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/rename.dir /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.rename"
runtest "### Rename " unix 1 "" eos "file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/rename.dir.missing /eos/$EOS_TEST_INSTANCE/test/instancetest/rename"
runtest "### Rename " unix 0 "" eos "file rename /eos/$EOS_TEST_INSTANCE/test/instancetest/rename.dir /eos/$EOS_TEST_INSTANCE/test/instancetest/rename"
runtest "### Rem " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.rename"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-ODeos.space=default"
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Stat " unix 1 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd/"
runtest "### Upload " unix 1 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd/" "-ODeos.space=default"
runtest "### Upload " unix 1 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd/" "-f"
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/rename"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/a\&b"
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/a\&b"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/a\&b"
runtest "### Rem " unix 0 "" eos rm -rf "/eos/$EOS_TEST_INSTANCE/test/instancetest/a\&b"
runtest "### MkSpace " unix 0 "" eos "space define __test__"
runtest "### SetSpace " unix 0 "" eos "space set __test__ on "
runtest "### RmSpace " unix 0 "" eos "space rm __test__"
runtest "### MkGroup " unix 0 "" eos "group set __test__ on"
runtest "### RmGroup " unix 0 "" eos "group rm __test__"
runtest "### MkNode " unix 0 "" eos "node set __test__ on"
runtest "### RmNode " unix 0 "" eos "node rm __test__"
runtest "### eos-rename" unix 0 "" eos_rename "/eos/$EOS_TEST_INSTANCE/test/instancetest/rename-test"
runtest "### Rm " unix 0 "" eos rm -rf "/eos/$EOS_TEST_INSTANCE/test/instancetest/rename-test"
# --------------------------
# Constrain minimum file size
# --------------------------
runtest "### Mkdir " unix 0 "" eos "mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/minsize"
runtest "### Attr " unix 0 "" eos attr set sys.forced.minsize=1000000 /eos/$EOS_TEST_INSTANCE/test/instancetest/minsize
runtest "### Upload " unix 1 "" upload "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/minsize/f1"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1M" "/eos/$EOS_TEST_INSTANCE/test/instancetest/minsize/f1"
runtest "### Rem " unix 0 "" eos rm -r "/eos/$EOS_TEST_INSTANCE/test/instancetest/minsize"
# --------------------------
# Constrain maximum file size
# --------------------------
runtest "### Mkdir " unix 0 "" eos "mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/maxsize"
runtest "### Attr " unix 0 "" eos attr set sys.forced.maxsize=1000000 /eos/$EOS_TEST_INSTANCE/test/instancetest/maxsize
runtest "### Upload " unix 1 "" upload "$TESTSYSFILE1M" "/eos/$EOS_TEST_INSTANCE/test/instancetest/maxsize/f1"
runtest "### Upload " unix 0 "" upload "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/maxsize/f1"
runtest "### Rem " unix 0 "" eos rm -r "/eos/$EOS_TEST_INSTANCE/test/instancetest/maxsize"
# --------------------------
# Control-C
# --------------------------
runtest "### Abort " unix 1 "" abort /eos/$EOS_TEST_INSTANCE/test/instancetest/abort
runtest "### FileInfo " unix 1 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/abort"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/abort"
# --------------------------
# Extend a file via truncate
# --------------------------
runtest "### Extend " unix 0 "" extend /eos/$EOS_TEST_INSTANCE/test/instancetest/extend
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/extend"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/extend"
# --------------------------
# Shrink a file via truncate
# --------------------------
runtest "### Shrink " unix 0 "" shrink /eos/$EOS_TEST_INSTANCE/test/instancetest/shrink
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/shrink"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/shrink"
# --------------------------
# Write file in random order
# --------------------------
runtest "### Random " unix 0 "" random /eos/$EOS_TEST_INSTANCE/test/instancetest/random
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/random"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/random"
# --------------------------
# Extend file and rewrite the beginning
# --------------------------
runtest "### Truncate " unix 0 "" truncate /eos/$EOS_TEST_INSTANCE/test/instancetest/truncate
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/truncate"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/truncate"
# --------------------------
# Expand file several times
# --------------------------
runtest "### holes " unix 0 "" holes /eos/$EOS_TEST_INSTANCE/test/instancetest/holes
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/holes"
runtest "### backward " unix 0 "" backward /eos/$EOS_TEST_INSTANCE/test/instancetest/holes
runtest "### downrnd " unix 0 "" downloadrandom /eos/$EOS_TEST_INSTANCE/test/instancetest/holes
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/holes"
# --------------------------
runtest "### Attr " unix 0 "" eos attr set sys.forced.checksum=adler /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### UploadCks " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k" "-ODeos.checksum=$CKS1K"
runtest "### FileInfo " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k -m | grep nrep=1"
runtest "### UploadCks " unix 0 "" upload "$TESTSYSFILE0K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/good-checksum0k" "-ODeos.checksum=00000001"
runtest "### Rem " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/good-checksum0k"
runtest "### UploadCks " unix 1 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k" "-ODeos.checksum=00000000"
runtest "### FileInfo " unix 1 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k -m | grep nrep=0"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k"
runtest "### UploadCks " unix 1 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k" "-ODeos.checksum=00000000"
runtest "### FileInfo " unix 1 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k -m | grep nrep=0"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-checksum1k"
runtest "### Attr " unix 0 "" eos attr rm sys.forced.checksum /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### UploadSz " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-size1k" "-ODeos.targetsize=1024"
runtest "### FileInfo " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-size1k -m | grep nrep=1"
runtest "### UploadSz " unix 1 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-size1k" "-ODeos.targetsize=1000"
runtest "### FileInfo " unix 1 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-size1k -m | grep nrep=0"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/faulty-size1k"
#-------------------------------------------------------------------------------
# Verify sys.owner.auth behaviour
#-------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos "mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/"
runtest "### Attr " unix 0 "" eos "attr set sys.owner.auth=* /eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth"
runtest "### Chown " unix 0 "" eos chown 2000:2001 "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth"
runtest "### Upload-L3 " unix 0 "" upload "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/l1/l2/l3/f1"
runtest "### Vfy-Uid " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/l1/l2/l3/f1 -m | grep uid=2000"
runtest "### Vfy-Gid " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/l1/l2/l3/f1 -m | grep gid=2001"
runtest "### Upload-L1 " unix 0 "" upload "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/f1"
runtest "### Vfy-Uid " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/f1 -m | grep uid=2000"
runtest "### Vfy-Gid " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/f1 -m | grep gid=2001"
runtest "### Rem " unix 0 "" eos rm -r "/eos/$EOS_TEST_INSTANCE/test/instancetest/owner-auth/"
################################################################################
# VERSION
################################################################################
runtest "### Version " unix 0 "" eos "version | grep EOS_INSTANCE"
runtest "### Version " unix 0 "" eos "version | grep EOS_CLIENT_VERSION"
runtest "### Version " unix 0 "" eos "version | grep EOS_SERVER_VERSION"
runtest "### Version " unix 0 "" eos "version -m | grep xrootd.version"
################################################################################
# COMMENT
################################################################################
runtest "### Comment " unix 0 "" eos "whoami --comment \"Hello World\""
runtest "### Comment " unix 0 "" shell grep $EOSLOGBOOK -e \"Hello World\"
runtest "### Comment Proto " unix 0 "" eos "fs ls --comment \"Hello Proto World\""
runtest "### Comment Proto " unix 0 "" shell grep $EOSLOGBOOK -e \"Hello Proto World\"
################################################################################
# ACCESS
################################################################################
# Access ban
runtest "### Access " unix 0 "" eos "access ban user nobody"
# takes long
#runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
#runtest "### Download " unix 1 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-OSeos.ruid=99" "-DITransactionTimeout 1"
runtest "### Access " unix 0 "" eos "access ls | grep nobody"
runtest "### Access " unix 0 "" eos "access unban user nobody"
runtest "### Access " unix 1 "" eos "access ls | grep nobody"
# Access stall
runtest "### Access " unix 0 "" eos "access set stall 1 r"
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
runtest "### Download " unix 1 "" eosssh-timeout -t 3 download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-OSeos.ruid=99"
runtest "### Access " unix 0 "" eos "access ls | grep \"r:\* => 1\""
runtest "### Access " unix 0 "" eos "access rm stall r"
runtest "### Access " unix 1 "" eos "access ls | grep \"r:\* => 1\""
# Access redirect
runtest "### Access " unix 0 "" eos "access set redirect foo.senf"
runtest "### Download " unix 1 "" downloadh "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd" "-DIFirstConnectTimeout 2 -DIConnectTimeout 2 -DIReconnectWait 1 -DIMaxRedirectCnt 1"
runtest "### Access " unix 0 "" eos "access ls | grep foo"
runtest "### Access " unix 0 "" eos "access rm redirect"
runtest "### Access " unix 1 "" eos "access ls | grep foo"
runtest "### Rm " unix 0 "" eos "rm /eos/$EOS_TEST_INSTANCE/test/instancetest/passwd"
# Access whitelist domain
runtest "### Access " unix 0 "" eos "access allow user bin"
runtest "### Ls " unix 0 "EOSROLE='-r 1 1'" eos ls /eos/$EOS_TEST_INSTANCE/
runtest "### Ls " unix 1 "EOSROLE='-r 99 99'" eos ls /eos/$EOS_TEST_INSTANCE/
runtest "### Access " unix 0 "" eos "access ls | grep bin"
runtest "### Access " unix 0 "" eos "access unallow user bin"
runtest "### Ls " unix 0 "EOSROLE='-r 1 1'" eos ls /eos/$EOS_TEST_INSTANCE/test
runtest "### Access " unix 0 "" eos "access allow user bin"
runtest "### Ls " unix 1 "EOSROLE='-r 99 99'" eos ls /eos/$EOS_TEST_INSTANCE/
runtest "### Access " unix 0 "" eos "access allow domain nobody@localdomain"
runtest "### Ls " unix 1 shell runuser -u nobody eos ls /eos/$EOS_TEST_INSTANCE/
runtest "### Access " unix 0 "" eos "access allow domain -"
runtest "### Ls " unix 0 shell runuser -u nobody eos ls /eos/$EOS_TEST_INSTANCE/
runtest "### Access " unix 0 "" eos "access ls"
runtest "### Access " unix 0 "" eos "access unallow user bin"
runtest "### Access " unix 0 "" eos "access unallow domain -"
runtest "### Access " unix 0 "" eos "access unallow domain nobody@localdomain"
# root, admins and sudoers only can `eos access`
runtest "### Access " unix 0 "" eos "access allow user nobody"
runtest "### Access " unix 1 shell runuser -u nobody eos access ls
runtest "### Access " unix 0 "" eos "access unallow user nobody"
################################################################################
# Quota Tests
################################################################################
# ------------------------------------------------------------------------------
categorie="quota"
# ------------------------------------------------------------------------------
command eos -b space status default | grep quota | grep on >& /dev/null 2>&1
if [ $? -eq 0 ]; then
# --------------------------
# if quota is enabled
# --------------------------
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest "### Quota " unix 0 "" eos quota set -u 99 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.quota" "-ODeos.ruid=99" "-DITransactionTimeout 30"
runtest "### Quota " unix 0 "" eos quota set -u 99 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.quota" "-ODeos.ruid=99" "-DITransactionTimeout 30"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/passwd.quota"
runtest "### Quota " unix 0 "" eos quota set -u 99 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Quota " unix 1 "" eos quota set -u 99 -p /doesnotexist -v 1T -i 1M
runtest "### Quota " unix 0 "" eos quota set -u 3 -p /eos/$EOS_TEST_INSTANCE/test -v 1T -i 1M
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/1k" "-ODeos.ruid=3" "-DITransactionTimeout 30"
runtest "### QUpdate " unix 0 "" eos_quota "/eos/$EOS_TEST_INSTANCE/test/" "uid=adm"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/1k"
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/testproj
runtest "### Quota " unix 0 "" eos quota set -g 99 -p /eos/$EOS_TEST_INSTANCE/test/testproj -v 1T -i 1M
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/testproj/1k" "-ODeos.ruid=3"
runtest "### QUpdate " unix 0 "" eos quota ls -m "/eos/$EOS_TEST_INSTANCE/test/testproj" | grep "gid=project space=/eos/$EOS_TEST_INSTANCE/test/testproj"
runtest "### Rem " unix 2 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/testproj/1k"
runtest "### RmdQuota " unix 0 "" eos quota rmnode --really-want -p "/eos/$EOS_TEST_INSTANCE/test/testproj/"
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/testproj/"
fi
################################################################################
# RECYCLE BIN TEST
################################################################################
# ------------------------------------------------------------------------------
categorie="recycle"
# ------------------------------------------------------------------------------
recyclesize=`command eos -b $EOSROLE root://$EOS_TEST_REDIRECTOR recycle -m | grep maxbytes | awk '{print $3}' | sed s/maxbytes=//`
recycletime=`command eos -b $EOSROLE root://$EOS_TEST_REDIRECTOR recycle -m | grep lifetime | awk '{print $6}' | sed s/lifetime=//`
test -z $recyclesize && recyclesize=0
test -z $recycletime && recycletime=0
if [ $recyclesize -eq 0 ] ; then
runtest "### Recycle " unix 0 "" eos quota set -g 99 -v 100G -i 10M /eos/$EOS_TEST_INSTANCE/proc/recycle/
fi
if [ $recycletime -eq 0 ]; then
runtest "### Recycle " unix 0 "" eos recycle config --lifetime 86400
fi
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle"
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle"
runtest "### Recycle " unix 0 "" eos recycle config --add-bin /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle"
runtest "### Rem " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle"
runtest "### Old find " unix 0 "" eos oldfind -f /eos/$EOS_TEST_INSTANCE/proc/recycle/ | grep passwd.recycle | wc -l |grep -w 1
runtest "### Find " unix 0 "" eos find -f /eos/$EOS_TEST_INSTANCE/proc/recycle/ | grep passwd.recycle | wc -l |grep -w 1
runtest "### Recycle-Ls" unix 0 "" eos recycle ls | grep /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle | wc -l | grep -w 1
runtest "### Restore " unix 1 "" eos recycle restore `command eos -b root://$EOS_TEST_REDIRECTOR recycle ls -g | grep /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle | awk '{print $10}' | tail -1`
runtest "### Restore " unix 0 "EOSROLE='-r 3 4'" eos recycle restore `command eos -b root://$EOS_TEST_REDIRECTOR recycle ls -g | grep /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle | awk '{print $10}' | tail -1`
runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle"
runtest "### Rem " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle"
runtest "### Restore " unix 1 "EOSROLE='-r 3 4'" eos recycle restore `command eos -b root://$EOS_TEST_REDIRECTOR recycle ls -g | grep /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle | awk '{print $10}' | tail -1`
runtest "### Restore " unix 0 "EOSROLE='-r 3 4'" eos recycle restore -f `command eos -b root://$EOS_TEST_REDIRECTOR recycle ls -g | grep /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle/passwd.recycle | awk '{print $10}' | tail -1`
runtest "### Recycle " unix 0 "" eos recycle config --remove-bin /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle
runtest "### Rem " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/recycle
################################################################################
# STRESS
################################################################################
## -----------------------------------------------------------------------------
categorie="stress"
# ------------------------------------------------------------------------------
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Attr Set " unix 0 "" eos attr set default=replica "/eos/$EOS_TEST_INSTANCE/test"
runtest "### Stress Wpp " unix 0 "" stress "-d root://localhost//eos/$EOS_TEST_INSTANCE/test -o wr -f 50 -s 1KB -n stress -j 10 -c -p"
runtest "### Stress Wp " unix 0 "" stress "-d root://localhost//eos/$EOS_TEST_INSTANCE/test -o wr -f 50 -s 1KB -n stress -j 10 -c "
runtest "### Old find " unix 0 "" eos oldfind "-f --count /eos/$EOS_TEST_INSTANCE/test/ | grep nfiles=100"
runtest "### Find " unix 0 "" eos find "-f --count /eos/$EOS_TEST_INSTANCE/test/ | grep nfiles=100"
runtest "### Stress Rp " unix 0 "" stress "-d root://localhost//eos/$EOS_TEST_INSTANCE/test -o rd -f 50 -s 1KB -n stress -j 10 -c"
runtest "### Stress Rpp " unix 0 "" stress "-d root://localhost//eos/$EOS_TEST_INSTANCE/test -o rd -f 50 -s 1KB -n stress -j 10 -c -p"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/stress/*"
runtest "### Ls " unix 0 "" eos ls "/eos/$EOS_TEST_INSTANCE/test | grep [a-z] | wc -l | grep -w 2"
runtest "### Ls " unix 0 "" eos ls -l "/eos/$EOS_TEST_INSTANCE/test | grep ^d| wc -l | grep -w 2"
runtest "### Ls " unix 0 "" eos ls -la "/eos/$EOS_TEST_INSTANCE/test | grep ^d| wc -l | grep -w 4"
runtest "### Old find " unix 0 "" eos oldfind -d "/eos/$EOS_TEST_INSTANCE/test | grep eos | wc -l | grep -w 3"
runtest "### Find " unix 0 "" eos find -d "/eos/$EOS_TEST_INSTANCE/test | grep eos | wc -l | grep -w 3"
################################################################################
# ATTRIBUTES
###################################################A############################
categorie="attr"
runtest "### Attr Set " unix 0 "" eos attr set default=replica "/eos/$EOS_TEST_INSTANCE/test"
runtest "### Attr Ls " unix 0 "" eos attr ls "/eos/$EOS_TEST_INSTANCE/test | grep sys | wc -l | grep -w 6"
runtest "### Attr Get " unix 0 "" eos attr get "sys.forced.space /eos/$EOS_TEST_INSTANCE/test | grep default"
runtest "### Attr Rm " unix 0 "" eos attr rm "sys.forced.blocksize /eos/$EOS_TEST_INSTANCE/test"
runtest "### Attr Rm " unix 0 "" eos attr rm "sys.forced.checksum /eos/$EOS_TEST_INSTANCE/test"
runtest "### Attr Rm " unix 0 "" eos attr rm "sys.forced.layout /eos/$EOS_TEST_INSTANCE/test"
runtest "### Attr Rm " unix 0 "" eos attr rm "sys.forced.nstripes /eos/$EOS_TEST_INSTANCE/test"
runtest "### File Touch" unix 0 "" eos file touch "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Set " unix 0 "" eos attr set sys.forced.atomic=1 "/eos/$EOS_TEST_INSTANCE/test"
runtest "### File Touch" unix 0 "" eos file touch "/eos/$EOS_TEST_INSTANCE/test/file.atomic"
runtest "### Attr Set " unix 0 "" eos attr rm sys.forced.atomic "/eos/$EOS_TEST_INSTANCE/test"
runtest "### Attr Set " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/file.atomic"
runtest "### Attr Set " unix 0 "" eos attr set user.attr.test=foo "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Get " unix 0 "" eos attr get user.attr.test "/eos/$EOS_TEST_INSTANCE/test/file | grep foo"
runtest "### Attr Get " unix 1 "" eos attr get user.attr.bar "/eos/$EOS_TEST_INSTANCE/test/file | grep foo"
runtest "### Attr Ls " unix 0 "" eos attr ls "/eos/$EOS_TEST_INSTANCE/test/file | grep foo"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.test "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Rm " unix 1 "" eos attr rm user.attr.test "/eos/$EOS_TEST_INSTANCE/test/file"
#----------------------------------------------------------------------------
# Test JSON output for attributes
#----------------------------------------------------------------------------
runtest "### Attr Set " unix 0 "" eos attr set user.attr.json='value' "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Set " unix 0 "" eos attr set user.attr.json2='2ndvalue' "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Set " unix 0 "" eos attr set user.attr.json3='3' "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Set " unix 0 "" eos attr set user.attr.json4='value\"quote' "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Set " unix 0 "" eos attr set user.attr.json5='value1\&value2\&value3' "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Get " unix 0 "" eosj attr get user.attr.json "/eos/$EOS_TEST_INSTANCE/test/file | jq -r '.attr.get[].user.attr.json' | grep -w 'value'"
runtest "### Attr Get " unix 0 "" eosj attr get user.attr.json2 "/eos/$EOS_TEST_INSTANCE/test/file | jq -r '.attr.get[].user.attr.json2' | grep -w '2ndvalue'"
runtest "### Attr Get " unix 0 "" eosj attr get user.attr.json3 "/eos/$EOS_TEST_INSTANCE/test/file | jq -r '.attr.get[].user.attr.json3' | grep -w '3'"
runtest "### Attr Get " unix 0 "" eosj attr get user.attr.json4 "/eos/$EOS_TEST_INSTANCE/test/file | jq -r '.attr.get[].user.attr.json4' | grep -w 'value\"quote'"
runtest "### Attr Get " unix 0 "" eosj attr get user.attr.json5 "/eos/$EOS_TEST_INSTANCE/test/file | jq -r '.attr.get[].user.attr.json5' | grep -w 'value1\&value2\&value3'"
runtest "### Attr Ls " unix 1 "" eosj attr ls "/eos/$EOS_TEST_INSTANCE/test/file | jq -r '.attr.ls[].user.attr.json5' | grep -w 'nullvalues'"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.json "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.json2 "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.json3 "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.json4 "/eos/$EOS_TEST_INSTANCE/test/file"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.json5 "/eos/$EOS_TEST_INSTANCE/test/file"
#----------------------------------------------------------------------------
# Test fid|fxid|pid|pxid identifiers for attributes
#----------------------------------------------------------------------------
fid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo "/eos/$EOS_TEST_INSTANCE/test/file" | jq -r .id)
runtest "### Attr Set " unix 0 "" eos attr set user.attr.key='value' "fid:${fid}"
runtest "### Attr Get " unix 0 "" eos attr get user.attr.key "fid:${fid} | grep -w 'value'"
runtest "### Attr Get " unix 0 "" eosj attr get user.attr.key "fid:${fid} | jq -r '.attr.get[].user.attr.key' | grep -w 'value'"
runtest "### Attr Rm " unix 0 "" eos attr rm user.attr.key "fid:${fid}"
runtest "### Attr Ls " unix 0 "" eos attr ls "fid:${fid} | wc -l | grep -w 4"
runtest "### Attr Get " unix 1 "" eos attr get user.attr.key "fid:invalid"
runtest "### Attr Get " unix 1 "" eos attr get user.attr.key "fxid:123456"
runtest "### Attr Get " unix 1 "" eos attr get user.attr.key "pxid:"
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/file"
#-------------------------------------------------------------------------------
# Xattr locks
#-------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos "mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/"
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock"
runtest "### File Lck " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### File Lck " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### File Lck " unix 1 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### eoscp " unix 1 "EOSROLE='-r 2 2'" eos cp /eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1 /dev/null
runtest "### eoscp " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
runtest "### eoscp " unix 1 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
runtest "### File ULck " unix 1 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos file touch -u "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### File ULck " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -u "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### File Lck " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" 0
runtest "### Delay " unix 0 "" delay 1
runtest "### File Lck " unix 0 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### File Lck " unix 1 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### File Lck " unix 0 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos file touch -u "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
# user audience
runtest "### File Lck " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1 1000 user"
runtest "### eoscp " unix 0 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
runtest "### eoscp " unix 1 "EOSAPP='-a app2' EOSROLE='-r 3 3'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
# app audience
runtest "### File Lck " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos file touch -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1 1000 app"
runtest "### eoscp " unix 1 "EOSAPP='-a app2' EOSROLE='-r 2 2'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
runtest "### eoscp " unix 0 "EOSAPP='-a app1' EOSROLE='-r 2 2'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
runtest "### eoscp " unix 0 "EOSAPP='-a app1' EOSROLE='-r 3 3'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1" /dev/null
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock/lock1"
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/xattr-lock"
################################################################################
# FILEINFO
###################################################A############################
categorie="fileinfo"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirB/"
runtest "### Chmod " unix 0 "" eos chmod -r "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/"
runtest "### Attr Set " unix 0 "" eos attr set default=replica "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/"
runtest "### Attr Set " unix 0 "" eos attr set user.attr.key='value' "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirB/"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file\&symbol"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/fileA"
#----------------------------------------------------------------------------
# Test basic functionality (including JSON)
#----------------------------------------------------------------------------
runtest "### Fileinfo " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/ -m | grep container=2 | grep files=1"
runtest "### Fileinfo " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirB/ -m | grep 'xattrn=user.attr.key' | grep xattrv=value"
runtest "### Fileinfo " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/fileA -m | grep nrep=2"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file\&symbol | jq -r '.name' | grep -w 'file\&symbol'"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirB/ | jq -r '.xattr' | grep -w 'user.attr.key' | grep -w value"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/fileA -m | jq -r '.nstripes' | grep -w 2"
#----------------------------------------------------------------------------
# Test fid|fxid|pid|pxid identifiers
#----------------------------------------------------------------------------
pid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/" | jq -r .id)
pxid=$(printf "%x" $pid)
fid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file&symbol" | jq -r .id)
fxid=$(printf "%x" $fid)
#----------------------------------------------------------------------------
runtest "### Fileinfo " unix 0 "" eosj fileinfo "pid:${pid} | jq -r '.name' | grep -w fileinfo"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "pxid:${pxid} | jq -r '.name' | grep -w fileinfo"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "fid:${fid} | jq -r '.name' | grep -w 'file\&symbol'"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "fxid:${fxid} | jq -r '.name' | grep -w 'file\&symbol'"
#----------------------------------------------------------------------------
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file\&symbol"
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/fileA"
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirA/"
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/dirB/"
#----------------------------------------------------------------------------
# Test detached flag
#----------------------------------------------------------------------------
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file1"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file2"
runtest "### Fileinfo " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file1 -m | grep -w detached=0"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file1 | jq -r '.detached' | grep false"
#----------------------------------------------------------------------------
fid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file1" | jq -r .id)
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file1"
runtest "### Fileinfo " unix 0 "" eos fileinfo "fid:${fid} -m | grep -w detached=1"
#----------------------------------------------------------------------------
fid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file2" | jq -r .id)
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/file2"
runtest "### Fileinfo " unix 0 "" eosj fileinfo "fid:${fid} | jq -r '.detached' | grep true"
#----------------------------------------------------------------------------
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fileinfo/"
################################################################################
# FIND
################################################################################
# @note recursive find missing
categorie="oldfind"
echo "### Skipping old find test"
#runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest"
#runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a"
#runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b"
#runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c"
#runtest "### Mkdir " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
#runtest "### Mkdir " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b.txt"
#runtest "### Mkdir " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c.txt"
#runtest "### Chmod " unix 0 "" eos chmod "750" "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c"
#runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest"
#runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a"
#runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b"
#runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c"
#runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
#runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b.txt"
#runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c.txt"
#runtest "### Find " unix 0 "" eos find -d -flag 750 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
#runtest "### Find " unix 0 "" eos find -d -nflag 750 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 3"
#runtest "### Find " unix 0 "" eos find -d -uid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
#runtest "### Find " unix 0 "" eos find -d -nuid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 3"
#runtest "### Find " unix 0 "" eos find -d -gid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
#runtest "### Find " unix 0 "" eos find -d -ngid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 3"
#runtest "### Find " unix 0 "" eos find -f -uid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
#runtest "### Find " unix 0 "" eos find -f -nuid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 2"
#runtest "### Find " unix 0 "" eos find -f -gid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
#runtest "### Find " unix 0 "" eos find -f -ngid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 2"
#runtest "### Attr Set " unix 0 "" eos attr set sys.test=abc "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
#runtest "### Attr Set " unix 0 "" eos attr set sys.test=def "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b.txt"
#runtest "### Attr Set " unix 0 "" eos attr set sys.test=def "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c.txt"
#runtest "### Find " unix 0 "" eos find -f -x sys.test=abc "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
################################################################################
# Find - using the protobuf implementation
################################################################################
categorie="find"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c"
runtest "### Mkdir " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
runtest "### Mkdir " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b.txt"
runtest "### Mkdir " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c.txt"
runtest "### Chmod " unix 0 "" eos chmod "750" "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c"
runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest"
runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a"
runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b"
runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c"
runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b.txt"
runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c.txt"
runtest "### Find " unix 0 "" eos find -d -flag 750 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
runtest "### Find " unix 0 "" eos find -d -nflag 750 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 3"
runtest "### Find " unix 0 "" eos find -d -uid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
runtest "### Find " unix 0 "" eos find -d -nuid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 3"
runtest "### Find " unix 0 "" eos find -d -gid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
runtest "### Find " unix 0 "" eos find -d -ngid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 3"
runtest "### Find " unix 0 "" eos find -f -uid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
runtest "### Find " unix 0 "" eos find -f -nuid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 2"
runtest "### Find " unix 0 "" eos find -f -gid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
runtest "### Find " unix 0 "" eos find -f -ngid 99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 2"
runtest "### Attr Set " unix 0 "" eos attr set sys.test=abc "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
runtest "### Attr Set " unix 0 "" eos attr set sys.test=def "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/b.txt"
runtest "### Attr Set " unix 0 "" eos attr set sys.test=def "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/c.txt"
runtest "### Find " unix 0 "" eos find -f -x sys.test=abc "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest | wc -l | grep -w 1"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/links/"
runtest "### Symlink " unix 0 "" eos file symlink "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/links/a.ln" "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt"
runtest "### Find " unix 0 "" eos find "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/links/ | grep -w \"/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/links/a.ln -> /eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/a.txt\""
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/links/a.ln"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1M" "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/f1" "-ODeos.ruid=0"
runtest "### Delay " unix 0 "" delay 10
runtest "### Du -s " unix 0 "" eos du -s "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/ | grep 1024000"
runtest "### Du -s " unix 0 "" eos du -s -h "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/ | grep 1.02 | grep MB"
runtest "### Du -s " unix 0 "" eos du -s -h --si "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest/ | grep 1000.00 | grep kiB"
runtest "### Rm " unix 0 "" eos rm -r "/eos/$EOS_TEST_INSTANCE/test/instancetest/findtest"
################################################################################
# WFE
################################################################################
categorie="wfe"
runtest "### Space " unix 0 "" eos space config "default space.wfe=on"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Touch " unix 0 "" eos touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe/test1.dat"
runtest "### Prepare " unix 0 "" meta prepare "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe/test1.dat\?eos.ruid=99\&eos.rgid=99 | wc -l | grep -w 0"
runtest "### Chmod " unix 0 "" eos chmod "755" "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:99:p "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Attr " unix 0 "" eos attr set sys.workflow.sync::prepare.default=test "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Prepare " unix 0 "" meta prepare "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe/test1.dat\?eos.ruid=99\&eos.rgid=99"
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:99:p "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Prepare " unix 0 "" meta prepare "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe/test1.dat\?eos.ruid=99\&eos.rgid=99"
runtest "### Attr " unix 0 "" eos attr rm sys.acl "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe"
runtest "### Prepare " unix 0 "" meta prepare "/eos/$EOS_TEST_INSTANCE/test/instancetest/wfe/test1.dat\?eos.ruid=0\&eos.rgid=0"
runtest "### Space " unix 0 "" eos space config "default space.wfe=off"
################################################################################
# ACL
###################################################A############################
categorie="acl"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl ls " unix 1 "" eos acl -l "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl set " unix 0 "" eos acl u:daemon=rwx "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl ls " unix 0 "" eos acl -l "/eos/$EOS_TEST_INSTANCE/test/acl" | grep "u:daemon:rwx"
runtest "### Acl upd " unix 0 "" eos acl u:daemon:+\!d+\!u+q+c "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl ls " unix 0 "" eos acl -l "/eos/$EOS_TEST_INSTANCE/test/acl" | grep "u:daemon:rwx!d!uqc"
runtest "### Acl upd " unix 0 "" eos acl u:daemon:-x-\!d-\!u-c "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl ls " unix 0 "" eos acl -l "/eos/$EOS_TEST_INSTANCE/test/acl" | grep "u:daemon:rwq"
runtest "### Acl set " unix 0 "" eos acl u:daemon=rw+d+u "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl ls " unix 0 "" eos acl -l "/eos/$EOS_TEST_INSTANCE/test/acl" | grep "u:daemon:rw+d+u"
runtest "### Acl upd " unix 0 "" eos acl u:daemon:-r-w-+d-+u "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl ls " unix 1 "" eos acl -l "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### dir ls " unix 0 "EOSROLE='-r daemon daemon'" eos ls "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl deny ls" unix 0 "" eos acl u:daemon=\!x "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### dir ls " unix 1 "EOSROLE='-r daemon daemon'" eos ls "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Acl set " unix 0 "" eos acl u:daemon=rwx "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### dir ls " unix 0 "EOSROLE='-r daemon daemon'" eos ls "/eos/$EOS_TEST_INSTANCE/test/acl"
# Test the fact that both directory and file level sys.acl are taken into account
runtest "### Rmdir " unix 0 "" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Chown " unix 0 "" eos chown 2:2 "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Chmod " unix 0 "" eos chmod "700" "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Upload " unix 0 "EOSROLE='-r 2 2'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat"
runtest "### Download" unix 0 "EOSROLE='-r 2 2'" eos cp "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat" -
runtest "### Download" unix 1 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat" -
runtest "### Acl set " unix 0 "" eos acl u:99=rw "/eos/$EOS_TEST_INSTANCE/test/acl"
runtest "### Download" unix 0 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat" -
runtest "### Download" unix 1 "EOSROLE='-r 985 979'" eos cp "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat" -
runtest "### Acl set " unix 0 "" eos acl u:985=rw "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat"
runtest "### Download" unix 0 "EOSROLE='-r 985 970'" eos cp "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat" -
runtest "### Download" unix 0 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/acl/file.dat" -
runtest "### Rmdir " unix 0 "" eos rm -rf "/eos/$EOS_TEST_INSTANCE/test/acl"
################################################################################
# CHECKSUMS
###################################################A############################
categorie="checksum"
runtest "### adler32 " unix 0 "" shell echo -n "123456789 | eos-checksum adler /dev/stdin | grep 091e01de"
runtest "### crc32 " unix 0 "" shell echo -n "123456789 | eos-checksum crc32 /dev/stdin | grep cbf43926"
runtest "### crc32c " unix 0 "" shell echo -n "123456789 | eos-checksum crc32c /dev/stdin | grep e3069283"
runtest "### crc64 " unix 0 "" shell echo -n "123456789 | eos-checksum crc64 /dev/stdin | grep 6c40df5f0b497347"
runtest "### md5 " unix 0 "" shell echo -n "123456789 | eos-checksum md5 /dev/stdin | grep 25f9e794323b453885f5181f1b624d0b"
runtest "### xxhash64" unix 0 "" shell echo -n "123456789 | eos-checksum xxhash64 /dev/stdin | grep 8cb841db40e6ae83"
runtest "### sha1 " unix 0 "" shell echo -n "123456789 | eos-checksum sha /dev/stdin | grep f7c3bc1d808e04732adf679965ccc34ca7ae3441"
runtest "### sha256 " unix 0 "" shell echo -n "123456789 | eos-checksum sha256 /dev/stdin | grep 15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225"
################################################################################
# race
###################################################A############################
categorie="race"
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/race"
runtest "### Chmod " unix 0 "" eos chmod 777 /eos/$EOS_TEST_INSTANCE/test/instancetest/race/
runtest "### Attr " unix 0 "" eos attr set sys.forced.checksum=adler /eos/$EOS_TEST_INSTANCE/test/instancetest/race/
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/race/file.1k" ""
runtest "### Checksum " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/race/file.1k --checksum | grep 14c30610"
runtest "### AppendOL " unix 0 "" overlap "/eos/$EOS_TEST_INSTANCE/test/instancetest/race/file.1k"
runtest "### Delay " unix 0 "" delay 1
runtest "### Checksum " unix 0 "" eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/race/file.1k --checksum | grep fc46d811"
runtest "### Rm " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/race/
################################################################################
# Public access
###################################################A############################
categorie="publicaccess"
runtest "### Mkdir " unix 0 "" eos mkdir -p /eos/$EOS_TEST_INSTANCE/test/instancetest/public/
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/public/"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/public/p1" "-ODeos.space=default"
runtest "### Vid " unix 0 "" eos vid publicaccesslevel 2
runtest "### Rm " unix 1 "EOSROLE='-r 99 99'" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/public/p1"
runtest "### Rm " unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/public/p1"
runtest "### Rmdir " unix 1 "EOSROLE='-r 99 99'" eos rmdir /eos/$EOS_TEST_INSTANCE/test/instancetest/public
runtest "### Ls " unix 1 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Ls " unix 0 "" eos ls -l "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Old find " unix 1 "EOSROLE='-r 99 99'" eos oldfind "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Find " unix 1 "EOSROLE='-r 99 99'" eos find "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Vid " unix 0 "" eos vid publicaccesslevel 1024
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Old find " unix 0 "EOSROLE='-r 99 99'" eos oldfind "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Find " unix 0 "EOSROLE='-r 99 99'" eos find "/eos/$EOS_TEST_INSTANCE/test/"
runtest "### Rmdir " unix 0 "" eos rmdir /eos/$EOS_TEST_INSTANCE/test/instancetest/public
################################################################################
# eosnobody
###################################################A############################
categorie="eosnobody"
SERVERKEY=$(grep "sec.protocol sss" /etc/xrd.cf.mgm | grep -o '\-s.*' | cut -d' ' -f2)
grep eosnobody $SERVERKEY > /tmp/eos.nobody.keytab
if [ $? -eq 0 ]; then
chmod 400 /tmp/eos.nobody.keytab
runtest "### Mkdir " unix 0 "" eos mkdir -p /eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/p1"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/.p1.sqsh"
runtest "### Chmod " unix 0 "" eos chmod "700" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/"
runtest "### Ls " unix 1 "XrdSecSSSKT='/tmp/eos.nobody.keytab'" eosr ls -la /eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/
runtest "### Ls " sss 1 "XrdSecSSSKT='/tmp/eos.nobody.keytab'" eosr ls -la /eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/
runtest "### Download " sss 1 "XrdSecSSSKT='/tmp/eos.nobody.keytab'" downloadh "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/p1"
runtest "### Download " sss 0 "XrdSecSSSKT='/tmp/eos.nobody.keytab'" eos_squash /eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/.p1.sqsh
runtest "### Rm " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/eosnobody/
chmod 700 /tmp/eos.nobody.keytab
unlink /tmp/eos.nobody.keytab
fi
################################################################################
# POLICIES
###################################################A############################
categorie="policy"
runtest "### Cd " unix 0 "" eos cd /eos/$EOS_TEST_INSTANCE/test
runtest "### Mkdir " unix 0 "" eos mkdir -p /eos/$EOS_TEST_INSTANCE/test/instancetest/policies/
runtest "### Attr " unix 2 "" eos attr rm sys.forced.layout /eos/$EOS_TEST_INSTANCE/test/instancetest/policies/
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p1" "-ODeos.space=default"
runtest "### Grep " unix 0 "" eos file info "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p1"
runtest "### Grep " unix 0 "" eos file info "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p1| grep plain | wc -l | grep -w 1"
runtest "### Policy " unix 0 "" eos space config default space.policy.layout=replica
runtest "### Policy " unix 0 "" eos space config default space.policy.nstripes=2
runtest "### Grep " unix 0 "" eos space status "default | grep policy.layout | wc -l | grep -w 1"
runtest "### Grep " unix 0 "" eos space status "default | grep policy.nstripes | wc -l | grep -w 1"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p2" "-ODeos.space=default"
runtest "### Grep " unix 0 "" eos file info "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p2| grep replica | wc -l | grep -w 1"
runtest "### Policy " unix 0 "" eos space config default space.policy.checksum=adler
runtest "### Grep " unix 0 "" eos space status "default | grep policy.checksum | wc -l | grep -w 1"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p3" "-ODeos.space=default"
runtest "### Grep " unix 0 "" eos file info "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p3| grep adler | wc -l | grep -w 1"
runtest "### Policy " unix 0 "" eos space config default space.policy.blocksize=1M
runtest "### Grep " unix 0 "" eos space status "default | grep policy.blocksize | wc -l | grep -w 1"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p4" "-ODeos.space=default"
runtest "### Grep " unix 0 "" eos file info "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p4| grep 1M | wc -l | grep -w 1"
runtest "### Policy " unix 0 "" eos space config default space.policy.blockchecksum=crc32c
runtest "### Grep " unix 0 "" eos space status "default | grep policy.blockchecksum | wc -l | grep -w 1"
runtest "### Upload " unix 0 "" upload "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/policies/p5" "-ODeos.space=default"
runtest "### Policy " unix 0 "" eos space config default space.policy.layout=remove
runtest "### Policy " unix 0 "" eos space config default space.policy.nstripes=remove
runtest "### Policy " unix 0 "" eos space config default space.policy.checksum=remove
runtest "### Policy " unix 0 "" eos space config default space.policy.blockchecksum=remove
runtest "### Policy " unix 0 "" eos space config default space.policy.blocksize=remove
runtest "### Policy " unix 1 "" eos space config default space.policy.blocksize=remove
runtest "### Grep " unix 0 "" eos space status "default | grep policy.layout | wc -l | grep -w 0"
runtest "### Grep " unix 0 "" eos space status "default | grep policy.nstripes | wc -l | grep -w 0"
runtest "### Grep " unix 0 "" eos space status "default | grep policy.checksum | wc -l | grep -w 0"
runtest "### Grep " unix 0 "" eos space status "default | grep policy.blockchecksum | wc -l | grep -w 0"
runtest "### Grep " unix 0 "" eos space status "default | grep policy.blocksize | wc -l | grep -w 0"
runtest "### Rm " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/policies
################################################################################
# NAMESPACE
################################################################################
# ------------------------------------------------------------------------------
categorie="ns"
# ------------------------------------------------------------------------------
runtest "### Cd " unix 1 "" eos cd /__dont_exists
runtest "### Cd " unix 0 "" eos cd /eos/$EOS_TEST_INSTANCE/test
runtest "### Ls " unix 1 "" eos ls /__dont_exist
runtest "### Chmod " unix 0 "" eos chmod 700 /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Ls " unix 1 "EOSROLE='-r 99 99'" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Ls " unix 0 "" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 1 "" eos attr set sys.acl=illegal /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:nobody:rx /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Upload " unix 1 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:nobody:rwox /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Upload " unix 1 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Rm " unix 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:nobody:rwx,u:100:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.100.1k" "-ODeos.ruid=100\&eos.rgid=100"
runtest "### Chmod " unix 0 "" eos chmod 777 /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:nobody:rwox /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Rm " unix 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:nobody:rwx!d /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Rm " unix 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.100.1k
runtest "### Rm " unix 0 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:100:rwx+d,g:nobody:rwx!d /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Rm " unix 0 "EOSROLE='-r 100 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.100.1k
runtest "### Attr " unix 0 "" eos attr rm sys.acl /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:nobody:rwx!u /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Update " unix 1 "" append "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99"
runtest "### Chmod " unix 0 "" eos chmod 755 /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 0 "" eos attr rm sys.acl /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 0 "" eos attr set sys.eval.useracl=1 /eos/$EOS_TEST_INSTANCE/test/instancetest/
# "runtest H" with sss-auth secures "not sudoer" and group list contains 99 where needed... without H the former fails, with unix-auth the latter (gids=[2] hence hasAcl=0)
# ACL impact: no ACL or user neither granted nor denied -> dir mode bits
# ACL denials: override except for u/d for file owner
runtest "### Attr " unix 0 "" eos debug debug '\*'
runtest "### Chown " unix 0 "" eos chown daemon /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Chown " unix 0 "" eos chown daemon /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
# most frequent case, file/dir without ACL mode bits decide
runtest "### Chmod " unix 0 "" eos chmod 777 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 0 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # no ACL, dir mode bits allow (o=rw)
runtest "### Chmod " unix 0 "" eos chmod 755 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # fail: no ACL, dir mode bits deny
runtest "### Chmod " unix 0 "" eos chmod 775 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # fail: no ACL, dir mode bits deny (g=rw but not group)
runtest "### Chown " unix 0 "" eos chown 2:99 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 0 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # no ACL, dir mode bits allow (g=rw same group)
runtest "### Chown " unix 0 "" eos chown 99:2 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 0 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # no ACL, dir mode bits allow (u=rw same user)
runtest "### Chown " unix 0 "" eos chown 2:2 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Rm " sss 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # fail: dir not owned, no ACL
runtest "### Attr " unix 0 "" eos attr set user.acl=u:nobody:rwx!d /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Rm " sss 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # fail: dir not owned, ACL denies delete
runtest H "### Attr " unix 0 "" eos whoami # running as user 2:2
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl
runtest "### Chown " unix 0 "" eos chown 1:1 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl
runtest "### Attr " unix 0 "" eos attr set user.acl=u:2:rwxc /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # the 'c'-right should be ignored on user.acl
runtest H "### Chown " sss 1 "" eos chown 99 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # fail: 'c' must only effective in sys.acl
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:2:c /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl
runtest H "### Chown " sss 0 "" eos chown 99 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # should work with 'c' in sys.acl
runtest "### Chown " unix 0 "" eos chown root /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Attr " unix 0 "" eos attr set user.acl=u:99:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest # the 'c'-right should be ignored on user.acl
# dir not owned
runtest H "### Rm " sss 0 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # dir not owned, but ACL allows write
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99" # ACL allows write, new file owned
runtest H "### Update " sss 0 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # dir not owned, ACL allows write
runtest "### Attr " unix 0 "" eos attr set user.acl=u:nobody:rx /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # fail: dir not owned, ACL does not grant write
runtest "### Chown " unix 0 "" eos chown root /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # fail: not owner, ACL allows rx only
runtest "### Attr " unix 0 "" eos attr set user.acl=u:nobody:rwx\!u /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # fail: not owner, ACL allows RW but denies update
runtest "### Attr " unix 0 "" eos attr set user.acl=u:1:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # fail: not owner, not in ACL
runtest "### Attr " unix 0 "" eos attr set user.acl=u:99:rwx\!d /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Rm " sss 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # fail: dir not owned, ACL denies delete
runtest "### Attr " unix 0 "" eos attr set user.acl=u:99:rwx\!d,g:99:rwx+d /eos/$EOS_TEST_INSTANCE/test/instancetest # +d for group 99, but should be ignored in user.acl
runtest H "### Rm " sss 1 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # fail: dir not owned, ACL denies delete
runtest "### Attr " unix 0 "" eos attr set sys.acl=g:99:rwx+d /eos/$EOS_TEST_INSTANCE/test/instancetest # +d for nobody, this should work in sys.acl
runtest H "### Rm " sss 0 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # ACL allows delete
runtest "### Attr " unix 0 "" eos attr rm sys.acl /eos/$EOS_TEST_INSTANCE/test/instancetest
# dir owned
runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99" # ACL allows write, new file owned
runtest H "### Update " sss 0 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # dir owned
runtest H "### Upload " sss 0 "EOSROLE='-r 99 99'" eos cp -a "$TESTSYSFILE1K" /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # dir owned
runtest "### Attr " unix 0 "" eos attr set user.acl=u:nobody:r!wx /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Update " sss 1 "" append "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k\?eos.ruid=99\&eos.rgid=99" # writes are denied, and updates are note allowed explicitly
runtest H "### Upload " sss 1 "EOSROLE='-r 99 99'" eos cp -a "$TESTSYSFILE1K" /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # writes are denied, and updates are not allowed explicitly
runtest "### Attr " unix 0 "" eos attr set user.acl=u:99:rwx!d /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" # make sure file owned
runtest H "### Rm " sss 0 "EOSROLE='-r 99 99'" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # ACL denies delete but file owned
# chown on file
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99" # owned by 99
runtest "### Chmod " unix 0 "" eos chmod 775 /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest "### Attr " unix 0 "" eos attr set user.acl=g:99:rwxc /eos/$EOS_TEST_INSTANCE/test/instancetest # 'c' (chown) in user.acl
runtest H "### Chown " sss 0 "EOSROLE='-r 99 99'" eos chown 98 /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # fail: user.acl cannot grant this chown but 99 is the owner
runtest "### Attr " unix 0 "" eos attr set sys.acl=g:99:c /eos/$EOS_TEST_INSTANCE/test/instancetest # 'c' (chown) in sys.ascl
runtest H "### Chown " sss 0 "EOSROLE='-r 99 99'" eos chown 98 /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
runtest "### Attr " unix 0 "" eos attr rm sys.acl /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest H "### Chown " sss 0 "EOSROLE='-r 99 99'" eos chown 99 /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k # chown to self should work in user.acl
# chown on directory - the ACL that applies is that of the directory itself
runtest "### Chown " unix 0 "" eos chown 99:99 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # same tests with a directory
runtest "### Attr " unix 0 "" eos attr set user.acl=g:99:rwxc /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # 'c' (chown) in user.acl
runtest H "### Chown " sss 1 "EOSROLE='-r 99 99'" eos chown 98 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # fail: user.acl cannot grant this chown
runtest "### Attr " unix 0 "" eos attr set sys.acl=g:99:c /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # 'c' (chown) in sys.ascl
runtest H "### Chown " sss 0 "EOSROLE='-r 99 99'" eos chown 98 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl
runtest "### Attr " unix 0 "" eos attr set sys.acl= /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # rm sys.acl, user.acl remains
runtest H "### Chown " sss 0 "EOSROLE='-r 99 99'" eos chown 99 /eos/$EOS_TEST_INSTANCE/test/instancetest/testAcl # chown to self should work in user.acl
# test inheritance of file acls
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Attr " unix 0 "" eos attr set sys.acl=g:99:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1" "-ODeos.ruid=99\&eos.rgid=99" # should have now sys.acl
runtest "### Attr " unix 0 "" eos attr ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1 | grep sys.acl | wc -l | grep -w 0 "
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.2" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Attr " unix 0 "" eos attr set user.acl=g:99:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest/file.2
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.2" "-ODeos.ruid=99\&eos.rgid=99" # should have no user.acl
runtest "### Attr " unix 0 "" eos attr ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.2 | grep user.acl | wc -l | grep -w 0 "
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.3" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Attr " unix 0 "" eos attr set user.acl=g:99:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest/file.3
runtest "### Attr " unix 0 "" eos attr set sys.eval.useracl=1 /eos/$EOS_TEST_INSTANCE/test/instancetest/file.3
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.3" "-ODeos.ruid=99\&eos.rgid=99" # should have user.acl and sys.eval.useracl
runtest "### Attr " unix 0 "" eos attr ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.3 | grep user.acl | wc -l | grep -w 1 "
runtest "### Attr " unix 0 "" eos attr ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.3 | grep sys.eval.useracl | wc -l | grep -w 1 "
# test sys file acl
runtest "### Attr " unix 0 "" eos attr rm user.acl /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest "### Chmod " sss 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Chmod " sss 0 "" eos chown root:root "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest H "### Upload " sss 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4"
runtest "### Chmod " sss 0 "" eos chmod 700 "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Ls " sss 0 "" eos ls -la "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Download " unix 0 "EOSROLE='-r 0 0'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4" $EOS_TEST_TESTSYS/null.txt
runtest "### Download " unix 1 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4" $EOS_TEST_TESTSYS/null.txt
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:99:rx "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4"
runtest "### Download " unix 0 "EOSROLE='-r 0 0'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4" $EOS_TEST_TESTSYS/null.txt
runtest "### Download " unix 0 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4" $EOS_TEST_TESTSYS/null.txt
runtest "### Chmod " sss 0 "" eos chmod 700 "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Attr " unix 0 "" eos attr set sys.acl=u:99:w "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4"
runtest "### Download " unix 0 "EOSROLE='-r 0 0'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4" $EOS_TEST_TESTSYS/null.txt
runtest "### Download " unix 1 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.4" $EOS_TEST_TESTSYS/null.txt
runtest "### Chmod " sss 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
# date +%s.%N;exit
#cleanup
runtest "### Attr " unix 0 "" eos debug info '\*'
runtest "### Rm " unix 2 "" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k
runtest "### Attr " unix 0 "" eos attr set user.acl=u:nobody:rwx /eos/$EOS_TEST_INSTANCE/test/instancetest
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.1k" "-ODeos.ruid=99\&eos.rgid=99"
runtest "### Attr " unix 0 "" eos attr rm user.acl /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Chown " unix 0 "" eos chown 0:0 "/eos/$EOS_TEST_INSTANCE/test/instancetest"
#-------------------------------------------------------------------------------
# Ns map functionality
#-------------------------------------------------------------------------------
runtest "### Map ls " unix 0 "" eos map ls
runtest "### Map mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/map_test/
runtest "### Touch " unix 0 "" eos touch /eos/$EOS_TEST_INSTANCE/test/map_test/file1.dat
runtest "### Stat " unix 0 "" eos stat /eos/$EOS_TEST_INSTANCE/test/map_test/file1.dat
runtest "### Ls " unix 0 "" eos ls /eos/$EOS_TEST_INSTANCE/test/map_test/file1.dat
runtest "### Map link " unix 0 "" eos map link /store/ /eos/$EOS_TEST_INSTANCE/test/map_test/
runtest "### Stat " unix 0 "" eos stat /store/file1.dat
runtest "### Ls " unix 0 "" eos ls /store/file1.dat
runtest "### Rm " unix 0 "" eos rm /store/file1.dat
runtest "### Map unlink" unix 0 "" eos map unlink /store/
runtest "### Rmdir " unix 0 "" eos rm -rf /eos/$EOS_TEST_INSTANCE/test/map_test/
# ------------------------------------------------------------------------------
categorie="symlink"
# ------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/ref/
runtest "### Touch " unix 0 "" eos touch /eos/$EOS_TEST_INSTANCE/test/instancetest/ref/touch
runtest "### Symlink-d " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/symdir /eos/$EOS_TEST_INSTANCE/test/instancetest/ref
runtest "### Symlink-r " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/symrel2 ../../test/instancetest/ref/
runtest "### Symlink " unix 0 "" eos stat /eos/$EOS_TEST_INSTANCE/test/instancetest/symrel2/touch
runtest "### Symlink-r " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/symrel1 ../instancetest/ref/
runtest "### Symlink " unix 0 "" eos stat /eos/$EOS_TEST_INSTANCE/test/instancetest/symrel1/touch
runtest "### Symlink-f " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/whoami /eos/$EOS_TEST_INSTANCE/test/instancetest/ref/touch
runtest "### Symlink-E " unix 1 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/whoami /eos/$EOS_TEST_INSTANCE/proc/whoami
runtest "### Symlink-E " unix 1 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/symdir /eos/$EOS_TEST_INSTANCE/test/instancetest/ref
runtest "### Symlink " unix 0 "" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/symdir/touch
runtest "### Symlink " unix 0 "" eos stat /eos/$EOS_TEST_INSTANCE/test/instancetest/whoami
runtest "### Symlink " unix 0 "" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/whoami
runtest "### Symlink-L " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/fwd-loop /eos/$EOS_TEST_INSTANCE/bwd-loop
runtest "### Symlink-L " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/bwd-loop /eos/$EOS_TEST_INSTANCE/fwd-loop
runtest "### Symlink-L " unix 1 "" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/bwd-loop
runtest "### Symlink-L " unix 1 "" eos ls /eos/$EOS_TEST_INSTANCE/test/instancetest/fwd-loop
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/
runtest "### Chown " unix 0 "" eos chown 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer"
runtest "### Upload " unix 0 "EOSROLE='-r 0 0'" eos cp /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/passwd
runtest "### Chmod " unix 0 "" eos chmod 700 /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/
runtest "### Symlink-S " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/passwd
runtest "### Chown " unix 0 "" eos chown -h 99:99 "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/passwd"
runtest "### Download " unix 0 "EOSROLE='-r 0 0'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/passwd" -
runtest "### Download " unix 0 "EOSROLE='-r 0 0'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/passwd" -
runtest "### Download " unix 1 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/passwd" -
runtest "### Download " unix 1 "EOSROLE='-r 99 99'" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/passwd" -
runtest "### Rm " unix 0 "" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/passwd
runtest "### Rm " unix 0 "" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/passwd
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/dir
runtest "### Symlink-S " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/link-dir /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/dir
runtest "### Touch " unix 0 "" eos touch /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/file
runtest "### Symlink-S " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/link-file /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/file
runtest "### Ownership " unix 0 "" eos ls -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/ | grep -w root | wc -l | grep -w 4"
runtest "### Ownership " unix 0 "" eos chown -h bin "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/link-file"
runtest "### Ownership " unix 0 "" eos ls -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/ | grep -w bin | wc -l | grep -w 1"
runtest "### Ownership " unix 0 "" eos chown -h root "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/link-file"
runtest "### Ownership " unix 0 "" eos ls -l "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/ | grep -w root | wc -l | grep -w 4"
runtest "### Ownership " unix 0 "" eos chown -r bin "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/"
runtest "### Ownership " unix 0 "" eos ls -la "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/ | grep -w bin | wc -l | grep -w 3"
runtest "### Ownership " unix 0 "" eos chown -r -h bin "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/"
runtest "### Ownership " unix 0 "" eos ls -la "/eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/ | grep -w bin | wc -l | grep -w 5"
runtest "### Rmdir " unix 0 "" eos rm -rf /eos/$EOS_TEST_INSTANCE/test/instancetest/link-source/
runtest "### Rmdir " unix 0 "" eos rm -rf /eos/$EOS_TEST_INSTANCE/test/instancetest/link-sniffer/
# ------------------------------------------------------------------------------
categorie="tag"
# ------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos mkdir /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/
runtest "### Touch " unix 0 "" eos touch -n /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch
runtest "### Tag " unix 0 "" eos file tag /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch +1
runtest "### Tag " unix 1 "" eos file tag /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch +1
runtest "### Tag " unix 0 "" eos file tag /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch ~1
runtest "### Tag " unix 0 "" eos file tag /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch ~1
runtest "### Tag " unix 0 "" eos file tag /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch -1
runtest "### Tag " unix 1 "" eos file tag /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch -1
runtest "### Rm " unix 0 "" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/touch
runtest "### Rmdir " unix 0 "" eos rmdir /eos/$EOS_TEST_INSTANCE/test/instancetest/tag/
# ------------------------------------------------------------------------------
categorie="rm"
# ------------------------------------------------------------------------------
# These tests assume that the polling interval for deletions on the FST side is
# less than 7 seconds. Set the EOS_FST_DELETE_QUERY_INTERVAL=5.
# First test that the removal of a detached file will retrigger the deletion on
# the diskserver and will wait for the confirmation before dropping the ns entry
RM_TEST_FILE="/eos/$EOS_TEST_INSTANCE/test/instancetest/rm_test.dat"
runtest "### Upload " unix 0 "" eos cp /etc/passwd ${RM_TEST_FILE}
rm_fxid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo ${RM_TEST_FILE} | jq -r .fxid)
rm_fsid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo ${RM_TEST_FILE} | jq -r .locations[].fsid | head -n 1)
runtest "### Rm " unix 0 "" eos rm -F ${RM_TEST_FILE}
runtest "### Dropdel " unix 0 "" eos fs dropdeletion "${rm_fsid}"
runtest "### Delay " unix 0 "" delay 7
runtest "### Fileinfo " unix 0 "" eos fileinfo "fxid:${rm_fxid}"
runtest "### Rm detached " unix 0 "" eos rm "fxid:${rm_fxid}"
runtest "### Delay " unix 0 "" delay 11
runtest "### Fileinfo " unix 1 "" eos fileinfo "fxid:${rm_fxid}"
# Secondly test that rm -F on a detached file will clean up the namespace
# without waiting for a confirmation from the diskservers
runtest "### Upload " unix 0 "" eos cp /etc/passwd ${RM_TEST_FILE}
rm_fxid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo ${RM_TEST_FILE} | jq -r .fxid)
rm_fsid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo ${RM_TEST_FILE} | jq -r .locations[].fsid | head -n 1)
runtest "### Rm " unix 0 "" eos rm -F ${RM_TEST_FILE}
runtest "### Dropdel " unix 0 "" eos fs dropdeletion "${rm_fsid}"
runtest "### Delay " unix 0 "" delay 7
runtest "### Fileinfo " unix 0 "" eos fileinfo "fxid:${rm_fxid}"
runtest "### Rm force " unix 0 "" eos rm -F "fxid:${rm_fxid}"
runtest "### Fileinfo " unix 1 "" eos fileinfo "fxid:${rm_fxid}"
# ------------------------------------------------------------------------------
categorie="adjustreplica"
# ------------------------------------------------------------------------------
ADJUST_TEST_DIR="/eos/$EOS_TEST_INSTANCE/test/instancetest/adjustreplica"
ADJUST_TEST_FILE="${ADJUST_TEST_DIR}/file.dat"
runtest "### Mkdir " unix 0 "" eos mkdir ${ADJUST_TEST_DIR}
runtest "### Mkdir " unix 0 "" eos attr set default=replica ${ADJUST_TEST_DIR}
runtest "### Upload " unix 0 "" eos cp ${TESTSYSFILE1K} ${ADJUST_TEST_FILE}
adj_fsid=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo ${ADJUST_TEST_FILE} | jq -r .locations[].fsid | head -n 1)
runtest "### Drop fsid " unix 0 "" eos file drop ${ADJUST_TEST_FILE} ${adj_fsid}
runtest "### Adjust - " unix 0 "" eos file adjustreplica ${ADJUST_TEST_FILE}
runtest "### Delay " unix 0 "" delay 3
runtest "### Check " unix 0 "" eosj fileinfo "${ADJUST_TEST_FILE} | jq -r .locations[].fsid | wc -l | grep 2"
# Find a new file system where to over-replicate the current file
list_fsids=$(command eos -j -b root://$EOS_TEST_REDIRECTOR fileinfo ${ADJUST_TEST_FILE} | jq -r .locations[].fsid)
array_fsids=($list_fsids)
source_fsid=${array_fsids[0]}
target_fsid=0
NUM_FST=$(command eos -b $EOSROLE root://$EOS_TEST_REDIRECTOR fs ls | awk '{ if (($6 ~ /booted/) || ($7 ~ /booted/)) c++} END {print c}')
for ((i=1; i<=${NUM_FST}; i++)); do if [[ ! " ${array_fsids[*]} " =~ " $i " ]]; then target_fsid=$i; break; fi done
runtest "### Replicate " unix 0 "" eos file replicate ${ADJUST_TEST_FILE} ${source_fsid} ${target_fsid}
runtest "### Delay " unix 0 "" delay 3
runtest "### Check " unix 0 "" eosj fileinfo "${ADJUST_TEST_FILE} | jq -r .locations[].fsid | wc -l | grep 3"
runtest "### Adjust + " unix 0 "" eos file adjustreplica ${ADJUST_TEST_FILE}
runtest "### Check " unix 0 "" eosj fileinfo "${ADJUST_TEST_FILE} | jq -r .locations[].fsid | wc -l | grep 2"
runtest "### Rm " unix 0 "" eos rm -F ${ADJUST_TEST_FILE}
runtest "### Rmdir " unix 0 "" eos rmdir ${ADJUST_TEST_DIR}
# --------------------------
# Parallel sockets (does not work currently with 3.1.0 clients)
# --------------------------
#runtest "### UploadP " unix 0 "" upload "$TESTSYSFILE50M" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.50k" "-S10"
#runtest "### Download " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.50k"
#runtest "### DownloadP " unix 0 "" download "$EOS_TEST_TESTSYS/dumpit" "/eos/$EOS_TEST_INSTANCE/test/instancetest/file.50k" "-S10"
################################################################################
# eoscp tests
################################################################################
# ------------------------------------------------------------------------------
categorie="eoscp"
# ------------------------------------------------------------------------------
runtest "### Setup " unix 0 "" shell ln -s /etc/passwd /tmp/passwd.ln
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp -d /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp -
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp.1
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp root://$EOS_TEST_REDIRECTOR//eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp.1 root://$EOS_TEST_REDIRECTOR//eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp.2
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp root://$EOS_TEST_REDIRECTOR//eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp.2 /tmp/
runtest "### eoscp " unix 1 "EOSROLE='-r 0 0'" eos cp /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/a/b/c/
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp -p /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/a/b/c/
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp -p /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/* /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp2
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp -r /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp3
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp /tmp/passwd.ln /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp3
runtest "### Symlink-S " unix 0 "" eos ln /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp.ln /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp3
runtest "### eoscp " unix 0 "EOSROLE='-r 0 0'" eos cp /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp/passwd.eoscp.ln /tmp/
runtest "### Cleanup " unix 0 "" shell rm /tmp/passwd.ln /tmp/passwd.eoscp.2 /tmp/passwd.eoscp.ln
runtest "### Cleanup " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp
runtest "### Cleanup " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp2
runtest "### Cleanup " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp3
################################################################################
# eos FUSE tests
################################################################################
# ------------------------------------------------------------------------------
categorie="fuse"
# ------------------------------------------------------------------------------
if [ -e "/eos/$EOS_TEST_INSTANCE" ];
then
echo "### Running FUSE tests ... disabling krb5/x509 ..."
export X509_USER_PROXY=/tmp/invalid
export KRB5CCNAME=/tmp/invalid
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### Chmod " unix 0 "" eos chmod 755 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE cp " unix 1 "" shell cp "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k"
runtest "### FUSE touch" unix 0 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/touch"
runtest "### FUSE cat " unix 0 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/touch"
runtest "### FUSE rm " unix 0 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/touch"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE cp " unix 0 "" shell cp "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k"
runtest "### Chmod " unix 0 "" eos chmod 755 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE mkdr " unix 1 "" shell mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.forbidden"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE mkdr " unix 0 "" shell mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### FUSE mkdr " unix 0 "" shell mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed2"
runtest "### Chmod " unix 0 "" eos chmod 755 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE mkdr " unix 1 "" shell rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE mkdr " unix 0 "" shell rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### FUSE chmd " unix 1 "" shell chmod 755 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/"
runtest "### Chown " unix 0 "" eos chown 2:2 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE chmd " unix 0 "" shell chmod 555 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE mv " unix 1 "" shell mv "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k.forbidden"
runtest "### FUSE chmd " unix 0 "" shell chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse"
runtest "### FUSE mv " unix 0 "" shell mv "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k.forbidden"
runtest "### Chmod " unix 0 "" eos chmod 555 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed2"
runtest "### FUSE mv " unix 1 "" shell mv "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k.forbidden" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed2"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed2"
runtest "### FUSE mv " unix 0 "" shell mv "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file.1k.forbidden" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed2"
runtest "### FUSE mv " unix 0 "" shell mv "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed2" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### Chmod " unix 0 "" eos chmod 555 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### Chmod " unix 0 "" eos chmod 555 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/"
runtest "### rm " unix 1 "" shell rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### rm " unix 1 "" shell rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed/file.1k.forbidden"
runtest "### rmdir " unix 1 "" shell rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed/"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed"
runtest "### rmdir " unix 1 "" shell rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed/"
runtest "### rm " unix 0 "" shell rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed/file.1k.forbidden"
runtest "### rmdir " unix 0 "" shell rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir.allowed/"
runtest "### touch sp " unix 0 "" shell touch "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file\ 1"
runtest "### mv sp " unix 0 "" shell mv "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file\ 1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file\ 2"
runtest "### stat sp " unix 1 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file\ 1"
runtest "### stat sp " unix 0 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file\ 2"
runtest "### rm sp " unix 0 "" shell rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/file\ 2"
runtest "### FUSE mkdr " unix 0 "" eos mkdir -p "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/"
runtest "### FUSE mkdr " unix 0 "" mkdir -p "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir1/"
runtest "### FUSE lnk " unix 0 "" shell ln -s "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/link1"
runtest "### FUSE lnk " unix 0 "" shell ln -s "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/link1"
runtest "### FUSE lnk " unix 1 "" shell ln -s "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/link1"
runtest "### FUSE mkdr " unix 0 "" shell mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/link1/dir2"
runtest "### FUSE stat " unix 0 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/link1/dir2"
runtest "### FUSE stat " unix 0 "" shell stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fuse/dir1/dir2"
fi
################################################################################
# eos FUSE tests
################################################################################
# ------------------------------------------------------------------------------
categorie="fusex"
# ------------------------------------------------------------------------------
echo "### Running FUSEX tests ... disabling krb5/x509 ..."
export X509_USER_PROXY=/tmp/invalid
export KRB5CCNAME=/tmp/invalid
test -d /test-fusex/ && umount -fl /test-fusex/
test -d /test-fusex/ || mkdir /test-fusex/
test -e /etc/eos/fuse.sss.keytab && mv -f /etc/eos/fuse.sss.keytab /etc/eos/fuse.sss.keytab.save
grep eosnobody $SERVERKEY > /etc/eos/fuse.sss.keytab
chmod 444 /etc/eos/fuse.sss.keytab
# make sure /var/run/eod is ensured everytime a daemon is running... at least
rm -rfv /var/run/eos
eosxd -ofsname=localhost.localdomain:/eos /test-fusex/
ls -la /test-fusex/
runtest "### Stat /run/eos " unix 0 "" test "$(stat -c '%a' /var/run/eos/credentials)" = 1777 -a "$(stat -c '%a' /var/run/eos/credentials/store)" = 1777
if [ -e "/test-fusex/$EOS_TEST_INSTANCE" ];
then
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex"
runtest "### Attr Set " unix 0 "" eos attr set user.fusex.rename.version=1 /eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/
runtest "### Attr Set " unix 0 "" eos attr set sys.versioning=3 /eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/"
runtest "### Mkdir " unix 0 "" eos mkdir "-p" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/group" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2"
runtest "### Fusex-Stat" unix 0 "" shell stat "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex"
runtest "### Fusex-Stat" unix 0 "" shell stat "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/f1"
runtest "### Fusex-Stat" unix 0 "" shell stat "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2"
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f1 | wc -l | grep -w 1"
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2 | wc -l | grep -w 2"
runtest "### Rename " unix 0 "" shell mv -f /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/f1 /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2
runtest "### Versions " unix 1 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f1 | wc -l | grep -w 1"
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/f2 | wc -l | grep -w 1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f2"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f2"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r1"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r1"
# version overwriting
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f1 | wc -l | grep -w 2"
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f1 | wc -l | grep -w 1"
runtest "### Rename " unix 0 "" shell mv -f /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f1 /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f1
runtest "### Rename " unix 0 "" shell mv -f /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/f2 /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f2
runtest "### Delay " unix 0 "" delay 1
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f2 | wc -l | grep -w 1"
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/f1 | wc -l | grep -w 2"
# rename including versions
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r1 | wc -l | grep -w 2"
runtest "### Rename " unix 0 "" shell mv -f /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r1 /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r2
runtest "### Delay " unix 0 "" delay 1
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r2 | wc -l | grep -w 2"
# move including versions
runtest "### Rename " unix 0 "" shell mv -f /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir1/r2 /test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/r1
runtest "### Delay " unix 0 "" delay 1
runtest "### Versions " unix 0 "" eos file versions "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/dir2/r1 | wc -l | grep -w 2"
#
runtest "### Upload " unix 0 "" shell cp /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### Chmod " unix 0 "" shell chmod 444 "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### test -x " unix 1 "" shell test -x "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### Chmod " unix 0 "" shell chmod 744 "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### test -x " unix 0 "" shell test -x "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### Chmod " unix 0 "" shell chmod 474 "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### test -x " unix 0 "" shell test -x "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### Chmod " unix 0 "" shell chmod 447 "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### test -x " unix 0 "" shell test -x "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/perm"
runtest "### symlink " unix 0 "" shell ln -s "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/target" "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.1"
runtest "### symlink " unix 0 "" shell ln -s "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/target" "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.2"
runtest "### syj-mkd " unix 0 "" shell mkdir "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symdir/"
runtest "### Delay " unix 0 "" delay 3
runtest "### stat l1 " unix 0 "" eos stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.1"
runtest "### stat l2 " unix 0 "" eos stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.2"
runtest "### sym-mv " unix 0 "" shell mv -f "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.1" "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.3"
runtest "### sym-mv " unix 0 "" shell mv -f "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.2" "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/symdir/symlink.4"
runtest "### Delay " unix 0 "" delay 3
runtest "### stat l1 " unix 1 "" eos stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.1"
runtest "### stat l2 " unix 1 "" eos stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.2"
runtest "### stat l1 " unix 0 "" eos stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/symlink.3"
runtest "### stat l2 " unix 0 "" eos stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/symdir/symlink.4"
#hardlinks
runtest "### Recycle " unix 0 "" eos recycle config --add-bin /eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink
runtest "### mkdir " unix 0 "" shell mkdir -p "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/"
runtest "### cp " unix 0 "" shell cp /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/file"
runtest "### link " unix 0 "" shell cd "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/ && ln file file.hardlink"
dd of="/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/file.hardlink" oflag=nocache conv=notrunc,fdatasync count=0
runtest "### cp " unix 0 "" shell cp /etc/passwd "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/newfile"
runtest "### cp " unix 0 "" shell mv -f "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/newfile" "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/file"
runtest "### Diff " unix 0 "" shell diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink/file.hardlink"
runtest "### Rm " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/hardlink
#obfuscation
runtest "### Obfuscate " unix 0 "" shell mkdir "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/"
runtest "### Obfuscate " unix 0 "" shell eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/"
runtest "### Obfuscate " unix 0 "" shell eos attr set sys.file.obfuscate=1 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/"
runtest "### Upload " unix 0 "" shell cp /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/group"
runtest "### Upload " unix 0 "" shell cp /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/group"
runtest "### Download " unix 0 "" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/group?eos.obfuscate=0" "/var/tmp/obfuscate.raw"
runtest "### Download " unix 0 "" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/group" "/var/tmp/obfuscate"
runtest "### Diff " unix 0 "" shell diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/group"
runtest "### Diff " unix 1 "" shell diff /etc/group "/var/tmp/obfuscate.raw"
runtest "### Diff " unix 0 "" shell diff /etc/group "/var/tmp/obfuscate"
runtest "### Diff " unix 0 "" shell rm "/var/tmp/obfuscate"
runtest "### Cleanup" unix 0 "" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/group"
#encryption
runtest "### Id " unix 0 "" shell env EOS_FUSE_SECRET=bla eosxd get eos.reconnect "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/"
runtest "### Upload " unix 0 "EOS_FUSE_SECRET=12e629ee-e68a-4a5b-9743-33ba8f794e07" eos_bash cp /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted"
runtest "### Download " unix 0 "EOS_FUSE_SECRET=12e629ee-e68a-4a5b-9743-33ba8f794e07" eos cp /etc/group "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted.cp"
runtest "### Dowload " unix 0 "EOS_FUSE_SECRET=12e629ee-e68a-4a5b-9743-33ba8f794e07" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted /var/tmp/encrypted.ok"
runtest "### Dowload " unix 0 "EOS_FUSE_SECRET=false" eos cp "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted /var/tmp/encrypted.false"
runtest "### Diff " unix 0 "" eos_bash diff /etc/group /var/tmp/encrypted.ok
runtest "### Diff " unix 1 "" eos_bash diff /etc/group /var/tmp/encrypted.false
# drop from buffer cache
dd of="/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted" oflag=nocache conv=notrunc,fdatasync count=0
runtest "### Diff " unix 0 "EOS_FUSE_SECRET=12e629ee-e68a-4a5b-9743-33ba8f794e07" eos_bash diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted"
runtest "### Diff " unix 0 "EOS_FUSE_SECRET=12e629ee-e68a-4a5b-9743-33ba8f794e07" eos_bash diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted.cp"
dd of="/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted" oflag=nocache conv=notrunc,fdatasync count=0
runtest "### Diff " unix 1 "EOS_FUSE_SECRET=false" eos_bash diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted"
dd of="/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted" oflag=nocache conv=notrunc,fdatasync count=0
runtest "### Diff " unix 0 "EOS_FUSE_SECRET=12e629ee-e68a-4a5b-9743-33ba8f794e07" eos_bash diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted"
dd of="/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted" oflag=nocache conv=notrunc,fdatasync count=0
runtest "### Diff " unix 1 "" eos_bash diff /etc/group "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/obfuscate/encrypted"
runtest "### defaultcc " unix 0 "" eos_defaultcc "/test-fusex/"
runtest "### sycntime " unix 0 "" eos_synctime "/test-fusex/" "$EOS_TEST_INSTANCE/test/instancetest/fusex/"
# enable sss now
chmod 400 /etc/eos/fuse.sss.keytab
runtest "### EnableTok " unix 0 "" eos space config default space.token.generation=1
export EXPIRE=`date +%s`; let LATER=$EXPIRE+9000
export EOSTOKENR=`/usr/bin/eos token --path /eos/ --permission rx --tree --owner nobody --group nobody --expires $LATER`
export EOSTOKENW=`/usr/bin/eos token --path /eos/ --permission rwx --tree --owner nobody --group nobody --expires $LATER`
runtest "### Id " unix 0 "" shell eosxd get eos.reconnect "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/"
# tokensudo arg tests
runtest "### tokensudo " unix 0 "" eos vid tokensudo always
runtest "### tokensudo " unix 0 "" eos vid tokensudo encrypted
runtest "### tokensudo " unix 0 "" eos vid tokensudo strong
runtest "### tokensudo " unix 0 "" eos vid tokensudo never
runtest "### tokensudo " unix 1 "" eos vid tokensudo bla
runtest "### tokensudo " unix 0 "" eos vid tokensudo always
# token via fusex tests
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/token"
runtest "### Chown " unix 0 "" eos chown root:root "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/token"
runtest "### Chmod " unix 0 "" eos chmod 700 "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/token"
runtest "### LsFuse " unix 1 "" shell ls -la "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/token/"
runtest "### LsRoot " unix 0 "" eos ls -la "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/token/"
runtest "### LsNobody " unix 1 "EOSROLE='-r 99 99'" eos ls -la "/eos/$EOS_TEST_INSTANCE/test/instancetest/fusex/token/"
runtest "### EosToken " unix 0 "XrdSecsssENDORSEMENT=$EOSTOKENR" shell eosxd get eos.reconnect "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/token"
runtest "### WhoToken " unix 0 "XrdSecsssENDORSEMENT=$EOSTOKENR" shell cat "/test-fusex/$EOS_TEST_INSTANCE/proc/whoami"
runtest "### LsToken " unix 0 "XrdSecsssENDORSEMENT=$EOSTOKENR" shell ls -la "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/token/"
runtest "### MkToken " unix 1 "XrdSecsssENDORSEMENT=$EOSTOKENR" shell mkdir "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/token/forbidden"
runtest "### ConToken " unix 0 "XrdSecsssENDORSEMENT=$EOSTOKENW" shell eosxd get eos.reconnect "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/token"
runtest "### WhoToken " unix 0 "XrdSecsssENDORSEMENT=$EOSTOKENR" shell cat "/test-fusex/$EOS_TEST_INSTANCE/proc/whoami"
runtest "### MkToken " unix 0 "XrdSecsssENDORSEMENT=$EOSTOKENW" shell mkdir "/test-fusex/$EOS_TEST_INSTANCE/test/instancetest/fusex/token/allowed"
test -d /test-fusex/ && umount -fl /test-fusex/
test -d /test-fusex/ && rmdir /test-fusex/
test -e /etc/eos/fuse.sss.keytab && unlink /etc/eos/fuse.sss.keytab
fi
################################################################################
# eos rclone test
################################################################################
# ------------------------------------------------------------------------------
categorie="rclone"
# ------------------------------------------------------------------------------
runtest "### rclone " unix 0 "" eos_rclone "/var/tmp/eos-instance-test/" "$EOS_TEST_INSTANCE/test/instancetest/rclone/"
################################################################################
# eos squashfs tests
################################################################################
# ------------------------------------------------------------------------------
categorie="squashfs"
# ------------------------------------------------------------------------------
export X509_USER_PROXY=/tmp/invalid
export KRB5CCNAME=/tmp/invalid
test -d /eos/ && umount -fl /eos/
test -d /eos/ || mkdir /eos/
eosxd -ofsname=localhost.localdomain:/eos /eos/
ls -la /eos/
if [ -e "/eos/$EOS_TEST_INSTANCE" ]; then
# simple sqash packages
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash"
runtest "### Recycle " unix 0 "" eos recycle config --add-bin /eos/$EOS_TEST_INSTANCE/test/instancetest/
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash"
runtest "### New SQFS " unix 0 "" eos squash new "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1"
runtest "### cp " unix 0 "" shell cp /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1
runtest "### Pack SQFS " unix 0 "" eos squash pack "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1"
runtest "### Pack SQFS " unix 1 "" eos squash pack "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1"
runtest "### Pack SQFS " unix 1 "" eos squash pack "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package2"
runtest "### info SQFS " unix 0 "" eos squash info "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1"
runtest "### rm label " unix 0 "" eos rm /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1
runtest "### label SQFS" unix 0 "" eos squash relabel /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1
runtest "### label SQFS" unix 1 "" eos squash relabel /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package2
runtest "### rm SQFS " unix 0 "" eos squash rm /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1
runtest "### stat SQFS " unix 1 "" eos stat /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/package1
runtest "### stat SQFS " unix 1 "" eos stat /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/.package1.sqsh
# squash releases
runtest "### New SQFSR " unix 0 "" eos squash new-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1"
runtest "### cp " unix 0 "" shell cp /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1/next
runtest "### Pack SQFSR" unix 0 "" eos squash pack-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1"
runtest "### Delay " unix 0 "" delay 1
runtest "### New SQFSR " unix 0 "" eos squash new-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1 1.0.1"
runtest "### cp " unix 0 "" shell cp /etc/passwd /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1/next
runtest "### Pack SQFSR" unix 0 "" eos squash pack-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1"
runtest "### info SQFSR" unix 0 "" eos squash info-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1"
runtest "### info SQFSR" unix 1 "" eos squash info-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release2"
runtest "### trim SQFSR" unix 0 "" eos squash trim-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1 1 1 "
runtest "### trim SQFSR" unix 1 "" eos squash trim-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1 0 0 "
runtest "### rm SQFSR" unix 0 "" eos squash rm-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1"
runtest "### rm SQFSR" unix 1 "" eos squash rm-release "/eos/$EOS_TEST_INSTANCE/test/instancetest/squash/release1"
runtest "### Rm " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/squash/
fi
test -d /eos/ && umount -fl /eos/
test -d /eos/ && rmdir /eos/
test -e /etc/eos/fuse.sss.keytab.save && mv -f /etc/eos/fuse.sss.keytab.save /etc/eos/fuse.sss.keytab
################################################################################
# Third party copy tests
################################################################################
# ------------------------------------------------------------------------------
categorie="tpc"
# ------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc"
runtest "### Upload " unix 0 "" upload "$TESTSYSFILE1K" "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.1"
if [ ${XRD_VERS_MAJOR} -eq 5 ]; then
runtest "### TPC 1 " unix 0 "" tpc1 "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.2"
elif [ ${XRD_VERS_MAJOR} -eq 4 ]; then
runtest "### TPC 1 " unix 0 "" tpc1 "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.2"
else
runtest "### TPC 1 " unix 0 "" tpc2 "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.2"
fi
runtest "### TPC 2 " unix 0 "" tpc2 "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.1" "/eos/$EOS_TEST_INSTANCE/test/instancetest/tpc/file.tpc.3"
runtest "### Rm " unix 0 "" eos rm -r /eos/$EOS_TEST_INSTANCE/test/instancetest/tpc
################################################################################
# Versioning tests
################################################################################
# ------------------------------------------------------------------------------
categorie="versioning"
# ------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning"
runtest "### Chmod " unix 0 "" eos chmod "777" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning"
runtest "### Mkdir " unix 0 "EOSROLE='-r 99 99'" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.bla"
runtest "### Attr Ls " unix 0 "EOSROLE='-r 99 99'" eos attr ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.bla | wc -l | grep -w 1"
runtest "### Rmdir " unix 0 "EOSROLE='-r 99 99'" eos rmdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.bla"
runtest "### Attr Set " unix 0 "" eos attr set sys.versioning=3 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
usleep 1100000 # force the first file to fall in a different tv_sec interval
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd | wc -l | grep -w 3"
runtest "### File Vers." unix 0 "EOSROLE='-r 99 99'" eos file version /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd 99
runtest "### File Vers." unix 0 "EOSROLE='-r 99 99'" eos file version /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd 99
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd | wc -l | grep -w 5"
runtest "### File Vers." unix 0 "EOSROLE='-r 99 99'" eos file purge /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd 4
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd | wc -l | grep -w 5"
runtest "### File Vers." unix 0 "EOSROLE='-r 99 99'" eos file purge /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd -1
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd | wc -l | grep -w 4"
runtest "### File Vers." unix 0 "EOSROLE='-r 99 99'" eos file purge /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd 0
runtest "### Stat " unix 1 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd"
runtest "### Rm " unix 0 "EOSROLE='-r 99 99'" eos rm "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Stat " unix 1 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
usleep 1100000 # force the first file to fall in a different tv_sec interval
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/passwd"
runtest "### Old find Purge" unix 0 "EOSROLE='-r 99 99'" eos oldfind --purge -1 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
# @note check whether --purge change(d) the state
runtest "### Find Purge" unix 0 "EOSROLE='-r 99 99'" eos find --purge -1 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd | wc -l | grep -w 3"
runtest "### Old find Purge" unix 0 "EOSROLE='-r 99 99'" eos oldfind --purge 1 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
# @note check whether --purge change(d) the state
runtest "### Find Purge" unix 0 "EOSROLE='-r 99 99'" eos find --purge 1 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd | wc -l | grep -w 2"
runtest "### Old find Purge" unix 0 "EOSROLE='-r 99 99'" eos oldfind --purge 0 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
# @note check whether --purge change(d) the state
runtest "### Find Purge" unix 0 "EOSROLE='-r 99 99'" eos find --purge 0 /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/
runtest "### Stat " unix 1 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/.sys.v#.passwd"
# Versioning test when acls control the permission for the user on the folder and
# implicitly also for the creation of the versions directory.
runtest "### Mkdir " unix 0 "EOSROLE='-r 99 99'" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/"
runtest "### Chmod " unix 0 "" eos chmod "2550" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/"
runtest "### Attr Set " unix 0 "" eos attr set sys.acl="u:99:rwx" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/file.dat"
runtest "### Upload " unix 0 "EOSROLE='-r 99 99'" eos cp "/etc/passwd" "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/file.dat"
runtest "### Ls " unix 0 "EOSROLE='-r 99 99'" eos ls "/eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/.sys.v#.file.dat | wc -l | grep -w 1"
runtest "### Cleanup" unix 2 "" eos rm "-r /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning/acl_versions/"
runtest "### Cleanup" unix 2 "" eos rm "-r /eos/$EOS_TEST_INSTANCE/test/instancetest/versioning"
################################################################################
# HTTP tests
################################################################################
# ------------------------------------------------------------------------------
categorie="http"
# ------------------------------------------------------------------------------
cacert="/etc/grid-security/certificates/rootCA.pem"
capath="$(dirname "${cacert}")"
cert="/root/.globus/usercert.pem"
key="/root/.globus/userkey.pem"
# ------------------------------------------------------------------------------
HTTPDIR=eos/$EOS_TEST_INSTANCE/test/instancetest/http.dir
runtest "### Mkdir " unix 0 "" eos mkdir $HTTPDIR
runtest "### Chmod " unix 0 "" eos chmod 777 $HTTPDIR
runtest "### Http PUT " unix 0 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --upload-file $TESTSYSFILE50M https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m
runtest "### Http GET " unix 0 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### Chmod " unix 0 "" eos chmod 644 $HTTPDIR
runtest "### Http PUT " unix 1 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --upload-file $TESTSYSFILE50M https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m
runtest "### Http GET " unix 1 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### Chmod " unix 0 "" eos chmod 777 $HTTPDIR
# --------------------------
# Range requests
# --------------------------
runtest "### Http GET " unix 0 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --range 0-499 https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### Http GET " unix 0 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --range 0-499,500-999 https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### Http GET " unix 0 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --range 0-499,1000-1499 https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### Http GET " unix 0 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --range 50000000- https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### Http GET " unix 1 "" curl -v --capath "${capath}" --cert "${cert}" --cacert "${cacert}" --key "${key}" --location --fail --silent --range 51200000-512000000 https://$EOS_TEST_FULL_REDIRECTOR:${EOS_HTTPS_PORT}/$HTTPDIR/file.50m --output $EOS_TEST_TESTSYS/dumpit
runtest "### HttpXUpload " unix 0 "" eos attr set sys.forced.checksum=adler $HTTPDIR
runtest "### HttpXUpload " unix 0 "" shell eos-http-upload-test rangeupload multipartfile /$HTTPDIR/
runtest "### Cleanup " unix 0 "" eos rm "-r" "/$HTTPDIR"
################################################################################
# WebDAV tests
################################################################################
# # ------------------------------------------------------------------------------
# categorie="dav"
# # ------------------------------------------------------------------------------
# DAVDIR=eos/$EOS_TEST_INSTANCE/test/instancetest/dav.dir
# runtest "### Mkdir " unix 0 "" eos mkdir /$DAVDIR
# runtest "### Chmod " unix 0 "" eos chmod 777 /$DAVDIR
# runtest "### Upload " unix 0 "" upload "$TESTSYSFILE50M" "/$DAVDIR/file.50m"
#
# bundle="$(dirname ${cert})/userbundle.p12"
# # generate user bundle as cadaver seems to have replacee cert and key options in favor of client-cert
# openssl pkcs12 -export -out "${bundle}" -inkey "${key}" -in "${cert}" -passout pass:
#
# # dirty hack to get cadaver https to work:
# # - passing the hostname -f to the command fails
# # - interactively opening a connection to the same address works?!?!
# echo "set client-cert ${bundle}" > $EOS_TEST_TESTSYS/.cadaverrc
# echo "open https://$(hostname -f):${EOS_HTTPS_PORT}/${DAVDIR}" >> $EOS_TEST_TESTSYS/.cadaverrc
# runtest "### WebDAV Ls " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< ls"
# runtest "### WebDAV Ls " unix 0 "" tgrep "404" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"ls foo\""
# # open the connection to $DAVDIR/foo
# runtest "### WebDAV Ls " unix 0 "" tgrep "404" "cadaver --rcfile=<(sed '$ s/$/\/foo/' $EOS_TEST_TESTSYS/.cadaverrc) <<< ls"
# runtest "### WebDAV Mkdir " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"mkdir sub.dir\""
# runtest "### WebDAV Ls " unix 0 "" tgrep "sub.dir" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< ls"
# runtest "### WebDAV Mkdir " unix 0 "" tgrep "409" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"mkdir foo/bar/sub.dir\""
#
# # Disable overwrite
# runtest "### WebDAV Copy " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"copy file.50m file.50m.copy\""
# runtest "### WebDAV Copy " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"copy file.50m file.50m.copy\""
# runtest "### WebDAV Copy " unix 0 "" tgrep "403" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"copy file.50m file.50m\""
# runtest "### WebDAV Copy " unix 0 "" tgrep "409" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"copy file.50m foo/bar/file.50m\""
# runtest "### WebDAV Copy " unix 0 "" tgrep "412" "cadaver --rcfile=<(sed '$a unset overwrite' $EOS_TEST_TESTSYS/.cadaverrc) <<< \"copy file.50m file.50m.copy\""
# runtest "### WebDAV Move " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"move file.50m file.50m.copy\""
# runtest "### WebDAV Copy " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"copy file.50m.copy file.50m\""
# runtest "### WebDAV Move " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"move file.50m file.50m.copy\""
# runtest "### WebDAV Move " unix 0 "" tgrep "403" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"move file.50m file.50m\""
# runtest "### WebDAV Move " unix 0 "" tgrep "409" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"move file.50m foo/bar/file.50m\""
# runtest "### WebDAV Copy " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"copy file.50m.copy file.50m\""
# runtest "### WebDAV Move " unix 0 "" tgrep "412" "cadaver --rcfile=<(sed '$aunset overwrite' $EOS_TEST_TESTSYS/.cadaverrc) <<< \"move file.50m.copy file.50m\""
# runtest "### WebDAV Rm " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"rm file.50m\""
# runtest "### WebDAV Rm " unix 0 "" tgrep "succeeded" "cadaver --rcfile=$EOS_TEST_TESTSYS/.cadaverrc <<< \"rmcol sub.dir\""
# runtest "### Cleanup " unix 0 "" eos rm "-r" "/$DAVDIR"
################################################################################
# Amazon S3 tests
################################################################################
# ------------------------------------------------------------------------------
categorie="s3"
# ------------------------------------------------------------------------------
export S3_ACCESS_KEY_ID="s3user"
export S3_SECRET_ACCESS_KEY="0123456789"
export S3_HOSTNAME="$(hostname -f)"
#----------------------------------------------------------------------------
# Prepare the setup for S3 tests
#----------------------------------------------------------------------------
runtest "### Prepare user " unix 0 "" shell adduser -M s3user
runtest "### Prepare dir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/s3.dir"
runtest "### Prepare mod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/s3.dir"
runtest "### S3 Attr " unix 0 "" eos attr set sys.s3.bucket.s3user="test" /eos/$EOS_TEST_INSTANCE/proc
runtest "### S3 Attr " unix 0 "" eos attr set sys.s3.id.s3user="0123456789" /eos/$EOS_TEST_INSTANCE/proc
runtest "### S3 Attr " unix 0 "" eos attr set sys.s3.path.test="/eos/$EOS_TEST_INSTANCE/test/instancetest/s3.dir" /eos/$EOS_TEST_INSTANCE/proc
# ------------------------------------------------------------------------------
runtest "### S3 List " unix 0 "" shell davix-ls --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test/
runtest "### S3 Upload " unix 0 "" shell davix-put --s3accesskey s3user --s3secretkey 0123456789 --s3alternate $TESTSYSFILE50M s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test/file.50m
runtest "### S3 List " unix 0 "" shell davix-ls --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test
runtest "### S3 Download " unix 0 "" shell davix-get --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test/file.50m file.50m
runtest "### S3 Rm " unix 0 "" shell davix-rm --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test/file.50m
runtest "### S3 List " unix 0 "" shell davix-ls --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test/
runtest "### S3 Download " unix 1 "" shell davix-get --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/test/file.50m
runtest "### S3 List " unix 1 "" shell davix-ls --s3accesskey s3user --s3secretkey 0123456789 --s3alternate s3://${EOS_TEST_REDIRECTOR}:${EOS_HTTPS_PORT}/otherdir/
#----------------------------------------------------------------------------
# Clean up the files created in S3 tests
#----------------------------------------------------------------------------
runtest "### Cleanup " unix 0 "" shell userdel s3user
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/s3.dir"
runtest "### Cleanup " unix 2 "" shell rm -f file.50m
################################################################################
# Owncloud tests
################################################################################
# ------------------------------------------------------------------------------
categorie="owncloud"
# ------------------------------------------------------------------------------
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc"
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc"
runtest "### Attr Set " unix 0 "" eos attr set default=replica "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc"
# upload with chunking
runtest "### OcChunk " unix 0 "" shell eos-oc-test chunkedupload chunked /eos/$EOS_TEST_INSTANCE/test/instancetest/oc/
# check it exists
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc/chunked"
runtest "### OcChunk " unix 1 "" shell eos-oc-test chunkedupload chunked
# upload again
runtest "### OcChunk " unix 0 "" shell eos-oc-test chunkedupload chunked /eos/$EOS_TEST_INSTANCE/test/instancetest/oc/
# check that there is no version
runtest "### Stat " unix 1 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc/.sys.v#.chunked/"
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc/chunked"
# enable versioning
runtest "### Attr Set " unix 0 "" eos attr set sys.versioning=2 /eos/$EOS_TEST_INSTANCE/test/instancetest/oc/
runtest "### OcChunk " unix 0 "" shell eos-oc-test chunkedupload chunked /eos/$EOS_TEST_INSTANCE/test/instancetest/oc/
runtest "### OcChunk " unix 0 "" shell eos-oc-test chunkedupload chunked /eos/$EOS_TEST_INSTANCE/test/instancetest/oc/
# check that versions are kept as expected
runtest "### Stat " unix 0 "" meta stat "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc/.sys.v#.chunked/"
runtest "### Old Find " unix 0 "" eos oldfind "-f --count /eos/$EOS_TEST_INSTANCE/test/instancetest/oc | grep nfiles=3"
runtest "### Find " unix 0 "" eos find "-f --count /eos/$EOS_TEST_INSTANCE/test/instancetest/oc | grep nfiles=3"
#----------------------------------------------------------------------------
# Clean up the files created in owncloud tests
#----------------------------------------------------------------------------
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/oc"
################################################################################
# GRPC tests
################################################################################
# ------------------------------------------------------------------------------
categorie="grpc"
# ------------------------------------------------------------------------------
runtest "### eos-grpc " unix 0 "" eos_grpc "/eos/$EOS_TEST_INSTANCE/test/instancetest/grpc.dir/"
################################################################################
# Token tests
################################################################################
# ------------------------------------------------------------------------------
categorie="token"
# ------------------------------------------------------------------------------
runtest "### eos-token " unix 0 "" eos_grpc "/eos/$EOS_TEST_INSTANCE/test/instancetest/token.dir/"
################################################################################
# RAIN-LIKE LAYOUT TESTS FOR WR/RD AND RECOVERY
# !!!RUN ONLY IF AT LEAST 6 FSTs PRESENT!!!
################################################################################
# ------------------------------------------------------------------------------
categorie="rain"
# ------------------------------------------------------------------------------
NUM_FST=$(command eos -b $EOSROLE root://$EOS_TEST_REDIRECTOR fs ls | awk '{ if (($6 ~ /booted/) || ($7 ~ /booted/)) c++} END {print c}')
if [ $NUM_FST -ge 6 ]; then
# Create temporary RAIN test file outside EOS
export EOS_TEST_RAIN_TMP=/tmp/rain_test
mkdir -p $EOS_TEST_RAIN_TMP
# Create the RAIDDP directory and set the proper attributes
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Attr " unix 0 "" eos attr set sys.forced.checksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blockchecksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blocksize=1M "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Attr " unix 0 "" eos attr set sys.forced.layout=raiddp "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Attr " unix 0 "" eos attr set sys.forced.nstripes=6 "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
# Create the RAID6 directory and set the proper attributes
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Attr " unix 0 "" eos attr set sys.forced.checksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blockchecksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blocksize=1M "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Attr " unix 0 "" eos attr set sys.forced.layout=raid6 "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Attr " unix 0 "" eos attr set sys.forced.nstripes=6 "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
# Qrain test (4 parity stripes )
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### Attr " unix 0 "" eos attr set sys.forced.checksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blockchecksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blocksize=1M "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### Attr " unix 0 "" eos attr set sys.forced.layout=qrain "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### Attr " unix 0 "" eos attr set sys.forced.nstripes=6 "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
runtest "### RaiddpTest " unix 0 "" eos_rain "raiddp" "$EOS_TEST_RAIN_DIR" "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp" "$EOS_TEST_RAIN_TMP"
# Sleep two seconds between the tests as disabling/enabling a FST is not that fast
runtest "### Delay " unix 0 "" delay 2
runtest "### Raid6Test " unix 0 "" eos_rain "raid6" "$EOS_TEST_RAIN_DIR" "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6" "$EOS_TEST_RAIN_TMP"
runtest "### Delay " unix 0 "" delay 2
runtest "### QrainTest " unix 0 "" eos_rain "qrain" "$EOS_TEST_RAIN_DIR" "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain" "$EOS_TEST_RAIN_TMP"
runtest "### Delay " unix 0 "" delay 2
# Run the eos-io-test for sequential and non-streaming IO against the RAIN
# directories
runtest "### EosIoRaiddp " unix 0 "" eos_io "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp" "$EOS_TEST_RAIN_DIR"
runtest "### EosIoRaid6 " unix 0 "" eos_io "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6" "$EOS_TEST_RAIN_DIR"
runtest "### EosIoQrain " unix 0 "" eos_io "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain" "$EOS_TEST_RAIN_DIR"
# Run xrdcpnonstreaming test to make sure the final file checksum which
# requires re-reading the entire file for computation is correct
TESTFILE_NONSTREAMING=$EOS_TEST_TESTSYS/cp_non_streaming.dat
dd if=/dev/urandom of=$TESTFILE_NONSTREAMING bs=1M count=40 > /dev/null 2>&1
CKS_NONSTREAMING=`eos-checksum crc32c $TESTFILE_NONSTREAMING | awk '{print $4}' | sed s/crc32c=//`
runtest "### NStreamDp " unix 0 "" cp_nonstreaming $TESTFILE_NONSTREAMING "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp/eos_non_stream.dat"
eos fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp/eos_non_stream.dat"
runtest "### XsRaiddp " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp/eos_non_stream.dat | jq -r '.checksumvalue' | grep $CKS_NONSTREAMING"
runtest "### NStream6 " unix 0 "" cp_nonstreaming $TESTFILE_NONSTREAMING "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6/eos_non_stream.dat"
runtest "### XsRaid6 " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6/eos_non_stream.dat | jq -r '.checksumvalue' | grep $CKS_NONSTREAMING"
runtest "### NStreamQ " unix 0 "" cp_nonstreaming $TESTFILE_NONSTREAMING "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain/eos_non_stream.dat"
runtest "### XsQrain " unix 0 "" eosj fileinfo "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain/eos_non_stream.dat | jq -r '.checksumvalue' | grep $CKS_NONSTREAMING"
# Run simple test to check the RAIN PIO mode which is by default enabled when doing eoscp
runtest "### eoscp pio " unix 0 "" shell eoscp "root://$EOS_TEST_REDIRECTOR//eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp/eos_non_stream.dat" "$EOS_TEST_RAIN_TMP/pio_raiddp_check.dat"
runtest "### eoscp pio xs " unix 0 "" shell eos-checksum crc32 "$EOS_TEST_RAIN_TMP/pio_raiddp_check.dat" | grep $CKS_NONSTREAMING
runtest "### eoscp pio " unix 0 "" shell eoscp "root://$EOS_TEST_REDIRECTOR//eos/$EOS_TEST_INSTANCE/test/instancetest/raid6/eos_non_stream.dat" "$EOS_TEST_RAIN_TMP/pio_raid6_check.dat"
runtest "### eoscp pio xs " unix 0 "" shell eos-checksum crc32 "$EOS_TEST_RAIN_TMP/pio_raid6_check.dat" | grep $CKS_NONSTREAMING
runtest "### eoscp pio " unix 0 "" shell eoscp "root://$EOS_TEST_REDIRECTOR//eos/$EOS_TEST_INSTANCE/test/instancetest/qrain/eos_non_stream.dat" "$EOS_TEST_RAIN_TMP/pio_qrain_check.dat"
runtest "### eoscp pio xs " unix 0 "" shell eos-checksum crc32 "$EOS_TEST_RAIN_TMP/pio_qrain_check.dat" | grep $CKS_NONSTREAMING
# Clean up the files used for the RAIN test
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/raiddp"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/raid6"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest/qrain"
rm -rf $EOS_TEST_RAIN_TMP
else
echo "Can not run RAIN test - not enough FSTs!"
fi
#-------------------------------------------------------------------------------
# Create PLAIN directory and set the attributes for the eoscp-rain-test
# Add a file used for testing - this test can be done with just one FST
#-------------------------------------------------------------------------------
runtest "### Mkdir " unix 0 "" eos mkdir "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir"
runtest "### Chmod " unix 0 "" eos chmod 777 "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir"
runtest "### Attr " unix 0 "" eos attr set sys.forced.checksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blockchecksum=crc32c "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir"
runtest "### Attr " unix 0 "" eos attr set sys.forced.blocksize=1M "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir"
runtest "### Attr " unix 0 "" eos attr set sys.forced.layout=plain "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir"
runtest "### Upload " unix 0 "" upload "$EOS_TEST_RAIN_DIR/file3.rain" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir/file.dat"
runtest "### EoscpRaiddp " unix 0 "" eoscp_rain "raiddp" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir/file.dat"
runtest "### EoscpRaid6 " unix 0 "" eoscp_rain "reeds" "/eos/$EOS_TEST_INSTANCE/test/instancetest/eoscp_rain_dir/file.dat"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/eoscp_rain_dir"
################################################################################
# OTHER TESTS
################################################################################
runtest "### Ls max input " unix 1 "" eos ls /file1/file2/file3/file4/file5/file6/file7/file8/file9/file10/file11/file12/file13/file14/file15/file16/file17/file18/file19/file20/file21/file22/file23/file24/file25/file26/file27/file28/file29/file30/file31/file32/file33/file34/file35/file36/file37/file38/file39/file40/file41/file42/file43/file44/file45/file46/file47/file48/file49/file50/file51/file52/file53/file54/file55/file56/file57/file58/file59/file60/file61/file62/file63/file64/file65/file66/file67/file68/file69/file70/file71/file72/file73/file74/file75/file76/file77/file78/file79/file80/file81/file82/file83/file84/file85/file86/file87/file88/file89/file90/file91/file92/file93/file94/file95/file96/file97/file98/file99/file100/file101/file102/file103/file104/file105/file106/file107/file108/file109/file110/file111/file112/file113/file114/file115/file116/file117/file118/file119/file120/file121/file122/file123/file124/file125/file126/file127/file128/file129/file130/file131/file132/file133/file134/file135/file136/file137/file138/file139/file140/file141/file142/file143/file144/file145/file146/file147/file148/file149/file150/file151/file152/file153/file154/file155/file156/file157/file158/file159/file160/file161/file162/file163/file164/file165/file166/file167/file168/file169/file170/file171/file172/file173/file174/file175/file176/file177/file178/file179/file180/file181/file182/file183/file184/file185/file186/file187/file188/file189/file190/file191/file192/file193/file194/file195/file196/file197/file198/file199/file200/file201/file202/file203/file204/file205/file206/file207/file208/file209/file210/file211/file212/file213/file214/file215/file216/file217/file218/file219/file220/file221/file222/file223/file224/file225/file226/file227/file228/file229/file230/file231/file232/file233/file234/file235/file236/file237/file238/file239/file240/file241/file242/file243/file244/file245/file246/file247/file248/file249/file250/file251/file252/file253/file254/file255/file256/file257/file258/file259/file260/file261/file262/file263/file264/file265/file266/file267/file268/file269/file270/file271/file272/file273/file274/file275/file276/file277/file278/file279/file280/file281/file282/file283/file284/file285/file286/file287/file288/file289/file290/file291/file292/file293/file294/file295/file296/file297/file298/file299/file300
################################################################################
# HEALTH
################################################################################
runtest "### Health " unix 0 "" eos health "-m | grep \"default\.0\""
################################################################################
# FINAL CLEANUP
################################################################################
# ------------------------------------------------------------------------------
categorie="clean"
# ------------------------------------------------------------------------------
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/stress"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/instancetest"
runtest "### Cleanup " unix 2 "" eos rm "-r" "/eos/$EOS_TEST_INSTANCE/test/rain"
################################################################################
# show test summary
testout
unlink $EOSTESTPID
exit;
################################################################################
) | tee -a $EOSALLCERTLOG &
trap 'kill_processes' TERM
trap 'kill_processes' QUIT
trap 'kill_processes' INT
sleep 1
testpid=`cat $EOSTESTPID 2>/dev/null`;
for wait in `seq 1 $EOS_TEST_TESTTIMESLICE`; do
kill -0 $testpid >& /dev/null
if [ $? -eq 0 ]; then
sleep 1;
else
break;
fi
done
kill -0 $testpid >& /dev/null
if [ $? -eq 0 ]; then
touch $TIMEOUTFILE
kill_child_processes $testpid;
fi
[ -e "$TIMEOUTFILE" ] && ( echo >> $EOSALLCERTLOG; echo "error: timeout after $EOS_TEST_TESTTIMESLICE seconds" >> $EOSALLCERTLOG; touch $FAILFILE; echo "error: timeout after $EOS_TEST_TESTTIMESLICE seconds";)
unlink $TIMEOUTFILE >& /dev/null
################################################################################
echo "#--------------------------------------------------------------"
echo "# Log of the test results : $EOSALLCERTLOG"
echo "# Log with individual test output : $EOSCERTLOG"
echo "#--------------------------------------------------------------"
################################################################################
mailnotify
################################################################################