1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/tests.sh

1131 lines
30 KiB
Bash
Raw Normal View History

2011-03-12 03:39:59 +01:00
#!/bin/sh
2011-03-12 03:44:40 +01:00
# $Id: tests.sh,v 1.79 2008/08/27 15:18:12 gilles Exp gilles $
2011-03-12 03:39:59 +01:00
#### Shell pragmas
2011-03-12 03:43:43 +01:00
exec 3>&2 #
#set -x # debug mode. See what is running
set -e # exit on first failure
2011-03-12 03:39:59 +01:00
#### functions definitions
echo3() {
2011-03-12 03:44:36 +01:00
#echo '#####################################################' >&3
echo "$*" >&3
2011-03-12 03:39:59 +01:00
}
run_test() {
2011-03-12 03:44:36 +01:00
echo3 "#### $test_count $1"
$1
if test x"$?" = x"0"; then
echo "$1 passed"
else
echo "$1 failed" >&2
fi
2011-03-12 03:39:59 +01:00
}
run_tests() {
2011-03-12 03:44:36 +01:00
for t in "$@"; do
test_count=`expr 1 + $test_count`
run_test "$t"
sleep 1
done
2011-03-12 03:39:59 +01:00
}
#### Variable definitions
test_count=0
##### The tests functions
perl_syntax() {
2011-03-12 03:44:36 +01:00
perl -c ./imapsync
2011-03-12 03:39:59 +01:00
}
no_args() {
2011-03-12 03:44:36 +01:00
./imapsync
2011-03-12 03:39:59 +01:00
}
2011-03-12 03:44:29 +01:00
# list of accounts on plume :
2011-03-12 03:39:59 +01:00
2011-03-12 03:44:29 +01:00
# toto@est.belle # used on first_sync()
# bad_login()
# bad_host()
# titi@est.belle # used on first_sync()
# bad_host()
# locallocal()
# tata@est.belle # used on locallocal()
2011-03-12 03:44:30 +01:00
# tata titi on most ll_*() tests
2011-03-12 03:44:29 +01:00
# tutu@est.belle # not used
# tete@est.belle # used on big size tests
# big_transfert()
# big_transfert_sizes_only()
# dprof()
2011-03-12 03:39:59 +01:00
2011-03-12 03:43:48 +01:00
sendtestmessage() {
2011-03-12 03:44:35 +01:00
email=${1:-"tata@est.belle"}
2011-03-12 03:43:48 +01:00
rand=`pwgen 16 1`
mess='test:'$rand
2011-03-12 03:44:35 +01:00
cmd="echo $mess""| mail -s ""$mess"" $email"
2011-03-12 03:43:48 +01:00
echo $cmd
2011-03-12 03:44:29 +01:00
eval "$cmd"
2011-03-12 03:43:48 +01:00
}
2011-03-12 03:44:29 +01:00
2011-03-12 03:44:35 +01:00
zzzz() {
2011-03-12 03:44:36 +01:00
$CMD_PERL -V
2011-03-12 03:44:35 +01:00
}
option_version() {
2011-03-12 03:44:36 +01:00
$CMD_PERL ./imapsync --version
2011-03-12 03:44:35 +01:00
}
option_tests() {
2011-03-12 03:44:36 +01:00
$CMD_PERL ./imapsync --tests
2011-03-12 03:44:35 +01:00
}
first_sync_dry() {
2011-03-12 03:44:36 +01:00
$CMD_PERL ./imapsync \
--host1 localhost --user1 toto@est.belle \
--passfile1 /var/tmp/secret1 \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--noauthmd5 --dry
2011-03-12 03:44:35 +01:00
}
2011-03-12 03:44:29 +01:00
first_sync() {
2011-03-12 03:44:36 +01:00
$CMD_PERL ./imapsync \
--host1 localhost --user1 toto@est.belle \
--passfile1 /var/tmp/secret1 \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--noauthmd5
2011-03-12 03:39:59 +01:00
}
2011-03-12 03:44:29 +01:00
locallocal() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
sendtestmessage
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi
else
:
fi
2011-03-12 03:44:12 +01:00
}
2011-03-12 03:44:40 +01:00
ll_timeout() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX --timeout 1
else
:
fi
}
ll_timeout_ssl() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX --timeout 5 --ssl1 --ssl2
else
:
fi
}
2011-03-12 03:44:12 +01:00
2011-03-12 03:44:29 +01:00
ll_folder() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.yop --folder INBOX.Trash
else
:
fi
2011-03-12 03:39:59 +01:00
}
2011-03-12 03:44:37 +01:00
ll_oneemail() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.oneemail
else
:
fi
}
2011-03-12 03:44:30 +01:00
ll_folderrec() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folderrec INBOX.yop
else
:
fi
2011-03-12 03:44:30 +01:00
}
2011-03-12 03:43:43 +01:00
2011-03-12 03:44:29 +01:00
ll_buffersize() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--buffersize 8
else
:
fi
2011-03-12 03:44:15 +01:00
}
2011-03-12 03:44:29 +01:00
ll_justfolders() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfolders
else
:
fi
2011-03-12 03:44:08 +01:00
}
2011-03-12 03:43:48 +01:00
2011-03-12 03:44:29 +01:00
ll_prefix12() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.qqq \
--prefix1 INBOX.\
--prefix2 INBOX.
else
:
fi
2011-03-12 03:44:19 +01:00
}
2011-03-12 03:44:29 +01:00
ll_internaldate() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
sendtestmessage
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX \
--syncinternaldates
else
:
fi
2011-03-12 03:43:48 +01:00
}
2011-03-12 03:43:47 +01:00
2011-03-12 03:44:39 +01:00
ll_idatefromheader() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
sendtestmessage
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.oneemail \
--idatefromheader --debug --dry
else
:
fi
}
2011-03-12 03:43:47 +01:00
2011-03-12 03:44:29 +01:00
ll_folder_rev() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 titi@est.belle \
--passfile1 /var/tmp/secret.titi \
--host2 localhost --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--folder INBOX.yop
else
:
fi
2011-03-12 03:43:43 +01:00
}
2011-03-12 03:39:59 +01:00
2011-03-12 03:44:29 +01:00
ll_subscribed()
2011-03-12 03:43:48 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--subscribed
else
:
fi
2011-03-12 03:43:49 +01:00
}
2011-03-12 03:43:48 +01:00
2011-03-12 03:39:59 +01:00
2011-03-12 03:44:29 +01:00
ll_subscribe()
2011-03-12 03:43:49 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--subscribed --subscribe
else
:
fi
2011-03-12 03:43:48 +01:00
}
2011-03-12 03:43:47 +01:00
2011-03-12 03:44:29 +01:00
ll_justconnect()
2011-03-12 03:44:20 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host2 localhost \
--host1 localhost \
--justconnect
else
:
fi
2011-03-12 03:44:20 +01:00
}
2011-03-12 03:44:29 +01:00
ll_justfoldersizes()
2011-03-12 03:43:50 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes
else
:
fi
2011-03-12 03:43:50 +01:00
}
2011-03-12 03:44:20 +01:00
2011-03-12 03:44:29 +01:00
ll_authmd5()
2011-03-12 03:43:50 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes --authmd5
else
:
fi
2011-03-12 03:43:50 +01:00
}
2011-03-12 03:44:29 +01:00
ll_noauthmd5()
2011-03-12 03:43:53 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes --noauthmd5
else
:
fi
2011-03-12 03:43:53 +01:00
}
2011-03-12 03:43:50 +01:00
2011-03-12 03:44:29 +01:00
ll_maxage()
2011-03-12 03:43:50 +01:00
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--maxage 1
else
:
fi
2011-03-12 03:43:50 +01:00
}
2011-03-12 03:43:54 +01:00
2011-03-12 03:44:29 +01:00
ll_maxsize()
2011-03-12 03:43:50 +01:00
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--maxsize 10
else
:
fi
2011-03-12 03:43:50 +01:00
}
2011-03-12 03:43:47 +01:00
2011-03-12 03:44:29 +01:00
ll_skipsize()
2011-03-12 03:43:54 +01:00
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--skipsize --folder INBOX.yop.yap
else
:
fi
2011-03-12 03:43:54 +01:00
}
2011-03-12 03:44:29 +01:00
ll_skipheader()
2011-03-12 03:43:54 +01:00
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--skipheader 'X-.*' --folder INBOX.yop.yap
else
:
fi
2011-03-12 03:43:54 +01:00
}
2011-03-12 03:44:29 +01:00
ll_include()
2011-03-12 03:43:51 +01:00
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--include '^INBOX.yop'
else
:
fi
2011-03-12 03:43:51 +01:00
}
2011-03-12 03:44:36 +01:00
ll_exclude()
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--exclude '^INBOX.yop'
else
:
fi
2011-03-12 03:44:36 +01:00
}
2011-03-12 03:44:29 +01:00
ll_regextrans2()
2011-03-12 03:43:55 +01:00
{
2011-03-12 03:44:36 +01:00
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--regextrans2 's/yop/yopX/'
else
:
fi
2011-03-12 03:43:55 +01:00
}
2011-03-12 03:44:29 +01:00
ll_sep2()
2011-03-12 03:44:06 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.yop.yap \
--sep2 '\\' --dry
else
:
fi
2011-03-12 03:44:06 +01:00
}
2011-03-12 03:44:29 +01:00
ll_bad_login()
2011-03-12 03:43:53 +01:00
{
2011-03-12 03:44:36 +01:00
! $CMD_PERL ./imapsync \
--host1 localhost --user1 toto@est.belle \
--passfile1 /var/tmp/secret1 \
--host2 localhost --user2 notiti@est.belle \
--passfile2 /var/tmp/secret2
2011-03-12 03:43:53 +01:00
}
2011-03-12 03:44:29 +01:00
ll_bad_host()
2011-03-12 03:43:53 +01:00
{
2011-03-12 03:44:36 +01:00
! $CMD_PERL ./imapsync \
--host1 badhost --user1 toto@est.belle \
--passfile1 /var/tmp/secret1 \
--host2 badhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret2
2011-03-12 03:43:53 +01:00
}
2011-03-12 03:44:35 +01:00
ll_bad_host_ssl()
{
2011-03-12 03:44:36 +01:00
! $CMD_PERL ./imapsync \
--host1 badhost --user1 toto@est.belle \
--passfile1 /var/tmp/secret1 \
--host2 badhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret2 \
2011-03-12 03:44:35 +01:00
--ssl1 --ssl2
}
2011-03-12 03:43:56 +01:00
2011-03-12 03:44:29 +01:00
ll_justfoldersizes()
2011-03-12 03:43:56 +01:00
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes
else
:
fi
2011-03-12 03:44:29 +01:00
}
2011-03-12 03:43:56 +01:00
2011-03-12 03:44:29 +01:00
ll_useheader()
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.yop.yap \
--useheader 'Message-ID' \
--dry --debug
echo 'rm /home/vmail/tata/.yop.yap/cur/*'
else
:
fi
2011-03-12 03:43:56 +01:00
}
2011-03-12 03:44:29 +01:00
ll_regexmess()
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
2011-03-12 03:44:39 +01:00
rm -f /home/vmail/titi/.yop.yap/cur/*
2011-03-12 03:44:36 +01:00
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.yop.yap \
--regexmess 's/\157/O/g' \
--regexmess 's/p/Z/g' \
2011-03-12 03:44:39 +01:00
--debug
file=`ls -t /home/vmail/titi/.yop.yap/cur/* | tail -1`
diff /var/tmp/imapsync/tests/ll_regexmess/dest_01 $file
#echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
2011-03-12 03:44:36 +01:00
else
:
fi
}
ll_regexmess_scwchu()
{
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.scwchu \
--regexmess 's{\A(.*?(?! ^$))^Date:(.*?)$}{$1Date:$2\nReceived: From; $2}gxms' \
--skipsize --skipheader 'Received: From;' \
--debug
echo 'rm /home/vmail/titi/.scwchu/cur/*'
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_flags()
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.yop.yap \
--dry --debug
echo 'rm /home/vmail/titi/.yop.yap/cur/*'
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_regex_flag()
{
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.yop.yap \
--dry --debug --regexflag 's/\\Answered/\\AnXweXed/g'
echo 'rm /home/vmail/titi/.yop.yap/cur/*'
else
:
fi
2011-03-12 03:44:29 +01:00
}
2011-03-12 03:44:40 +01:00
ssl_justconnect() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost \
--host2 localhost \
--ssl1 --ssl2 \
--justconnect
else
:
fi
}
2011-03-12 03:44:29 +01:00
ll_ssl() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
2011-03-12 03:44:29 +01:00
--host1 localhost --user1 tata@est.belle \
2011-03-12 03:44:36 +01:00
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--ssl1 --ssl2
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_authmech_PLAIN() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes --nofoldersizes \
--authmech1 PLAIN --authmech2 PLAIN
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_authuser() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes --nofoldersizes \
--authuser2 titi@est.belle
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_authmech_LOGIN() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes --nofoldersizes \
--authmech1 LOGIN --authmech2 LOGIN
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_authmech_CRAMMD5() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--justfoldersizes --nofoldersizes \
--authmech1 CRAM-MD5 --authmech2 CRAM-MD5
else
:
fi
2011-03-12 03:44:29 +01:00
}
ll_delete2() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
2011-03-12 03:44:29 +01:00
--folder INBOX \
2011-03-12 03:44:36 +01:00
--delete2 --expunge2
else
:
fi
2011-03-12 03:44:29 +01:00
}
2011-03-12 03:44:30 +01:00
ll_bigmail() {
2011-03-12 03:44:36 +01:00
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 localhost --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--host2 localhost --user2 titi@est.belle \
--passfile2 /var/tmp/secret.titi \
--folder INBOX.bigmail
echo 'rm /home/vmail/titi/.bigmail/cur/*'
else
:
fi
2011-03-12 03:44:30 +01:00
}
2011-03-12 03:44:40 +01:00
2011-03-12 03:44:35 +01:00
msw() {
2011-03-12 03:44:36 +01:00
sendtestmessage toto@est.belle
scp imapsync Admin@192.168.68.77:'C:/msys/1.0/home/Admin/imapsync/imapsync'
ssh Admin@192.168.68.77 'C:/msys/1.0/home/Admin/imapsync/test.bat'
2011-03-12 03:44:35 +01:00
}
2011-03-12 03:44:39 +01:00
2011-03-12 03:44:40 +01:00
gmail() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
$CMD_PERL ./imapsync \
--host1 imap.gmail.com \
--ssl1 \
--user1 gilles.lamiral@gmail.com \
--passfile1 /var/tmp/secret.gilles_gmail \
--host2 localhost \
--ssl2 \
--user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--useheader 'Message-Id' --skipsize \
--regextrans2 's/\[Gmail\]/Gmail/' \
#--dry # --debug --debugimap # --authmech1 LOGIN
else
:
fi
}
2011-03-12 03:44:29 +01:00
##########################
# specific tests
##########################
2011-03-12 03:43:55 +01:00
big_transfert()
{
date1=`date`
2011-03-12 03:44:36 +01:00
{ $CMD_PERL ./imapsync \
--host1 louloutte --user1 gilles \
--passfile1 /var/tmp/secret \
--host2 plume --user2 tete@est.belle \
--passfile2 /var/tmp/secret.tete \
--subscribed --foldersizes --noauthmd5 \
2011-03-12 03:44:15 +01:00
--fast --folder INBOX.Backup \
2011-03-12 03:44:36 +01:00
--useheader Message-ID --useheader Received || \
2011-03-12 03:44:01 +01:00
true
}
date2=`date`
echo3 "[$date1] [$date2]"
}
big_transfert_sizes_only()
{
date1=`date`
2011-03-12 03:44:36 +01:00
{ $CMD_PERL ./imapsync \
--host1 louloutte --user1 gilles \
--passfile1 /var/tmp/secret \
--host2 plume --user2 tete@est.belle \
--passfile2 /var/tmp/secret.tete \
--subscribed --noauthmd5 \
--justfoldersizes || \
2011-03-12 03:43:55 +01:00
true
}
date2=`date`
2011-03-12 03:44:01 +01:00
echo3 "[$date1] [$date2]"
2011-03-12 03:43:55 +01:00
}
2011-03-12 03:43:51 +01:00
2011-03-12 03:44:01 +01:00
2011-03-12 03:44:06 +01:00
dprof()
2011-03-12 03:44:01 +01:00
{
date1=`date`
{ perl -d:DProf ./imapsync \
2011-03-12 03:44:36 +01:00
--host1 louloutte --user1 gilles \
--passfile1 /var/tmp/secret \
--host2 plume --user2 tete@est.belle \
--passfile2 /var/tmp/secret.tete \
--subscribed --foldersizes --noauthmd5 \
2011-03-12 03:44:06 +01:00
--folder INBOX.Trash || \
2011-03-12 03:44:01 +01:00
true
}
date2=`date`
echo3 "[$date1] [$date2]"
dprofpp tmon.out
}
2011-03-12 03:44:06 +01:00
essnet_justconnect()
{
./imapsync \
2011-03-12 03:44:36 +01:00
--host1 mail2.softwareuno.com \
--user1 gilles@mail2.softwareuno.com \
--passfile1 /var/tmp/secret.prw \
--host2 mail.softwareuno.com \
--user2 gilles@softwareuno.com \
--passfile2 /var/tmp/secret.prw \
--dry --noauthmd5 --sep1 / --foldersizes --justconnect
2011-03-12 03:44:06 +01:00
}
essnet_mail2_mail()
{
./imapsync \
2011-03-12 03:44:36 +01:00
--host1 mail2.softwareuno.com \
--user1 gilles@mail2.softwareuno.com \
--passfile1 /var/tmp/secret.prw \
--host2 mail.softwareuno.com \
--user2 gilles@softwareuno.com \
--passfile2 /var/tmp/secret.prw \
--noauthmd5 --sep1 / --foldersizes \
2011-03-12 03:44:11 +01:00
--prefix2 "INBOX/" --regextrans2 's<>INBOX/INBOX<4F>INBOX<4F>'
2011-03-12 03:44:06 +01:00
}
essnet_mail2_mail_t123()
{
for user1 in test1 test2 test3; do
2011-03-12 03:44:36 +01:00
./imapsync \
--host1 mail2.softwareuno.com \
--user1 ${user1}@mail2.softwareuno.com \
--passfile1 /var/tmp/secret.prw \
--host2 mail.softwareuno.com \
--user2 gilles@softwareuno.com \
--passfile2 /var/tmp/secret.prw \
--noauthmd5 --sep1 / --foldersizes \
--prefix2 "INBOX/" --regextrans2 's<>INBOX/INBOX<4F>INBOX<4F>' \
2011-03-12 03:44:23 +01:00
--debug \
2011-03-12 03:44:36 +01:00
|| true
2011-03-12 03:44:06 +01:00
done
}
essnet_plume2()
{
./imapsync \
2011-03-12 03:44:36 +01:00
--host1 mail2.softwareuno.com \
--user1 gilles@mail2.softwareuno.com \
--passfile1 /var/tmp/secret.prw \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
2011-03-12 03:44:11 +01:00
--noauthmd5 --sep1 / --foldersizes \
2011-03-12 03:44:14 +01:00
--prefix2 INBOX. --regextrans2 's<>INBOX.INBOX<4F>INBOX<4F>'
2011-03-12 03:44:06 +01:00
}
2011-03-12 03:44:17 +01:00
dynamicquest_1()
{
perl -I bugs/lib ./imapsync \
2011-03-12 03:44:36 +01:00
--host1 69.38.48.81 \
--user1 testuser1@dq.com \
--passfile1 /var/tmp/secret.dynamicquest \
--host2 69.38.48.81 \
--user2 testuser2@dq.com \
--passfile2 /var/tmp/secret.dynamicquest \
--noauthmd5 --sep1 "/" --sep2 "/" \
--justconnect --dry
2011-03-12 03:44:17 +01:00
}
dynamicquest_2()
{
perl -I bugs/lib ./imapsync \
2011-03-12 03:44:36 +01:00
--host1 mail.dynamicquest.com \
--user1 gomez \
--passfile1 /var/tmp/secret.dynamicquestgomez \
--host2 69.38.48.81 \
--user2 testuser2@dq.com \
--passfile2 /var/tmp/secret.dynamicquest \
--noauthmd5 \
--justconnect --dry
2011-03-12 03:44:17 +01:00
}
dynamicquest_3()
{
perl -I bugs/lib ./imapsync \
2011-03-12 03:44:36 +01:00
--host1 loul \
--user1 tata \
--passfile1 /var/tmp/secret.tata \
--host2 69.38.48.81 \
--user2 testuser2@dq.com \
--passfile2 /var/tmp/secret.dynamicquest \
--noauthmd5 --sep2 "/" --debug --debugimap
2011-03-12 03:44:17 +01:00
}
2011-03-12 03:44:34 +01:00
mailenable() {
2011-03-12 03:44:36 +01:00
./imapsync \
--user1 imapsync@damashekconsulting.com \
--host1 imap.damashekconsulting.com \
--passfile1 /var/tmp/secret.damashek \
--sep1 "." --prefix1 "" \
--host2 localhost --user2 toto@est.belle \
--passfile2 /var/tmp/secret1 \
--noauthmd5
2011-03-12 03:44:34 +01:00
}
ariasolutions() {
2011-03-12 03:44:36 +01:00
./imapsync \
--host1 209.17.174.20 \
--user1 chrisw@canadapack.com \
--passfile1 /var/tmp/secret.ariasolutions \
--host2 209.17.174.20 \
--user2 chrisw@canadapack.com \
--passfile2 /var/tmp/secret.ariasolutions \
--dry --noauthmd5 --justfoldersizes
./imapsync \
--host1 209.17.174.20 \
--user1 test@domain.local \
--passfile1 /var/tmp/secret.ariasolutions \
--host2 209.17.174.20 \
--user2 test@domain.local \
--passfile2 /var/tmp/secret.ariasolutions \
--dry --noauthmd5 --ssl1
2011-03-12 03:44:34 +01:00
# hang after auth failure
2011-03-12 03:44:36 +01:00
./imapsync \
--host1 209.17.174.20 \
--user1 test@domain.local \
--passfile1 /var/tmp/secret.ariasolutions \
--host2 209.17.174.20 \
--user2 test@domain.local \
--passfile2 /var/tmp/secret.ariasolutions \
--dry --debug --debugimap
2011-03-12 03:44:34 +01:00
}
2011-03-12 03:44:35 +01:00
ariasolutions2() {
2011-03-12 03:44:36 +01:00
./imapsync \
--host1 209.17.174.12 \
--user1 chrisw@basebuilding.net \
--passfile1 /var/tmp/secret.ariasolutions2 \
--host2 209.17.174.20 \
--user2 chrisw@basebuilding.net\
--passfile2 /var/tmp/secret.ariasolutions2 \
--noauthmd5 --syncinternaldates
# --dry --debug --debugimap
2011-03-12 03:44:35 +01:00
2011-03-12 03:44:40 +01:00
}
genomics() {
# Blocked, timeout ignored
./imapsync \
--host1 mail.genomics.org.cn --user1 lamiral --passfile1 /var/tmp/secret.genomics \
--host2 szmail.genomics.cn --user2 lamiral --passfile2 /var/tmp/secret.genomics \
--sep1 . --prefix1 'INBOX.' --folder INBOX --useheader 'Message-Id' --expunge --skipsize \
--timeout 7 --debug --debugimap
2011-03-12 03:44:35 +01:00
}
2011-03-12 03:44:29 +01:00
##########################
##########################
2011-03-12 03:44:17 +01:00
2011-03-12 03:44:23 +01:00
2011-03-12 03:39:59 +01:00
# mandatory tests
run_tests perl_syntax
# All tests
2011-03-12 03:43:56 +01:00
# lp : louloutte -> plume
# pl : plume -> louloutte
2011-03-12 03:39:59 +01:00
test $# -eq 0 && run_tests \
2011-03-12 03:44:36 +01:00
no_args \
2011-03-12 03:44:35 +01:00
option_version \
2011-03-12 03:44:36 +01:00
option_tests \
first_sync \
locallocal \
2011-03-12 03:44:40 +01:00
ll_timeout \
2011-03-12 03:44:36 +01:00
ll_folder \
ll_buffersize \
ll_justfolders \
ll_prefix12 \
ll_internaldate \
2011-03-12 03:44:39 +01:00
ll_idatefromheader \
2011-03-12 03:44:36 +01:00
ll_folder_rev \
ll_subscribed \
ll_subscribe \
ll_justconnect \
ll_justfoldersizes \
ll_authmd5 \
ll_noauthmd5 \
ll_maxage \
ll_maxsize \
ll_skipsize \
ll_skipheader \
ll_include \
ll_exclude \
ll_regextrans2 \
ll_sep2 \
ll_bad_login \
ll_bad_host \
ll_bad_host_ssl \
ll_justfoldersizes \
ll_useheader \
ll_regexmess \
ll_regexmess_scwchu \
ll_flags \
ll_regex_flag \
ll_ssl \
ll_authmech_PLAIN \
ll_authmech_LOGIN \
ll_authmech_CRAMMD5 \
ll_authuser \
ll_delete2 \
ll_folderrec \
ll_bigmail \
2011-03-12 03:44:40 +01:00
gmail \
ssl_justconnect \
2011-03-12 03:44:37 +01:00
# msw
2011-03-12 03:44:15 +01:00
2011-03-12 03:44:11 +01:00
2011-03-12 03:39:59 +01:00
# selective tests
2011-03-12 03:44:35 +01:00
test $# -gt 0 && run_tests "$@"
2011-03-12 03:39:59 +01:00
# If there, all is good
echo3 ALL $test_count TESTS SUCCESSFUL