Blame tests/p_lftp/20_lftp_ftp.sh

root 6daf8d
#!/bin/sh
root d9b376
# Author: Piyush Kumar <piykumar@gmail.com>
root d9b376
# Author: Munish Kumar <munishktotech@gmail.com>
root d9b376
# Author: Ayush Gupta <ayush.001@gmail.com>
root d9b376
# Author: Konark Modi <modi.konark@gmail.com>
Christoph Galuschka 4380e7
#	  Christoph Galuschka <christoph.galuschka@chello.at>
root 6daf8d
Christoph Galuschka 4380e7
t_Log "Running $0 - installing vsFTPd for local lftp test."
Christoph Galuschka 4380e7
t_InstallPackage vsftpd 
Christoph Galuschka 4380e7
t_ServiceControl vsftpd restart
Christoph Galuschka 4380e7
Christoph Galuschka 4380e7
# Destination File
Christoph Galuschka 4380e7
TESTFILE=/tmp/t_functional-lftp-test.txt
Christoph Galuschka 4380e7
Christoph Galuschka 4380e7
# Source File on FTP server
Christoph Galuschka 4380e7
SOURCE=/var/ftp/
Christoph Galuschka 4380e7
FILE=lftp-test.txt
Christoph Galuschka 4380e7
cat > $SOURCE$FILE << EOF
Christoph Galuschka 4380e7
t_functional
Christoph Galuschka 4380e7
EOF
Christoph Galuschka 4380e7
URL="ftp://127.0.0.1/"
root 6daf8d
Christoph Galuschka 4380e7
t_Log "Running $0 - lftp test with local FTP server."
root 6daf8d
Christoph Galuschka 4380e7
lftp -e 'set net:timeout 10; get '${FILE}' -o '$TESTFILE' ; bye' $URL > /dev/null 2>&1
Christoph Galuschka 4380e7
if [ -f $TESTFILE ]
root 6daf8d
  then
Christoph Galuschka 4380e7
  grep -q 't_functional' $TESTFILE
root 6daf8d
  ret_val=$?
root 6daf8d
  else
root 6daf8d
  t_Log "FTP test for lftp failed"
root 6daf8d
  ret_val=$?
root 6daf8d
fi
Christoph Galuschka 4380e7
Christoph Galuschka 4380e7
# clean up
Christoph Galuschka 4380e7
rm -f $TESTFILE
Christoph Galuschka 4380e7
rm -f $SOURCE$FILE
Christoph Galuschka 4380e7
t_ServiceControl vsftpd stop
Christoph Galuschka 4380e7
root 6daf8d
t_CheckExitStatus $ret_val