Commit c22a0737 c22a0737039761f7f4ae222e27573bec0ac79f85 by Sergey Poznyakoff

testsuite: recreate missing maildir entries

Git does not keep empty subdirectories, so we need to recreate /cur and
/tmp subdirs in maildir mailboxes retrieved from the repo.

* bootstrap.conf: Recreate missing maildir parts.
* testsuite/testsuite.inc (MUT_MBCOPY): New macro.
* sieve/tests/ext.at: Use MUT_MBCOPY to copy mailboxes.
* sieve/tests/redirect.at: Likewise.
* sieve/tests/reject.at: Likewise.
* sieve/tests/testsuite.at: Likewise.
* testsuite/mbdel.at: Likewise.
* frm/tests/Makefile.am: Testsuite depends on
$(top_srcdir)/testsuite/testsuite.inc.
* libmailutils/tests/Makefile.am: Likewise.
* messages/tests/Makefile.am: Likewise.
* readmsg/tests/Makefile.am: Likewise.
* sieve/tests/Makefile.am: Likewise.
* testsuite/Makefile.am: Likewise.
1 parent 20300ee4
......@@ -89,3 +89,11 @@ if [ -r .bootstrap ]; then
echo "$0: Reading configuration file .bootstrap"
eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
fi
# Recreate missing maildir parts
for mbox in testsuite/maildir/*
do
test -d $mbox/new || mkdir $mbox/new
test -d $mbox/cur || mkdir $mbox/cur
test -d $mbox/tmp || mkdir $mbox/tmp
done
......
......@@ -44,7 +44,7 @@ TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
......
......@@ -73,7 +73,7 @@ TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
......
......@@ -44,7 +44,7 @@ TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
......
......@@ -46,7 +46,7 @@ TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
......
......@@ -67,7 +67,7 @@ TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
......
......@@ -30,8 +30,7 @@ if numaddr [[ "to", "cc" ]] :over 5
}
])
cp $abs_top_srcdir/testsuite/spool/bigto.mbox .
chmod +w bigto.mbox
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/bigto.mbox)
sieve MUT_SIEVE_CMDLINE dnl
--clearpath -L "${abs_top_builddir}/examples" -f ./bigto.mbox prog
......
......@@ -29,8 +29,7 @@ require "redirect";
redirect "gray@gnu.org";
])
cp $abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX .
chmod +w MUT_SIEVE_MAILBOX
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)
sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
sed 's/ $//' ./mta.diag
......
......@@ -46,8 +46,7 @@ s/^\( *[[0-9]][[0-9]]*: The original message was received at *\).*\( from .*\)/\
s/^\( *[[0-9]][[0-9]]*: Last-Attempt-Date:\).*/\1 (date)/
])
cp $abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX .
chmod +w MUT_SIEVE_MAILBOX
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)
sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
sed -f filter.sed ./mta.diag
......
......@@ -70,8 +70,7 @@ AT_CHECK([sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f $2 prog
m4_define([MUT_TESTCASE],[
AT_SETUP([$1])
AT_KEYWORDS([$2])
cp $abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX .
chmod +w MUT_SIEVE_MAILBOX
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)
MUT_SIEVE_RUN([$3], ./MUT_SIEVE_MAILBOX, m4_shift(m4_shift(m4_shift($@))))
AT_CLEANUP])
......
......@@ -68,7 +68,7 @@ TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
......
......@@ -28,32 +28,28 @@ AT_CLEANUP
dnl ------------------------------------------------------------
MBDEL_TEST([mbox],
[cp $abs_top_srcdir/testsuite/spool/mbox1 .
chmod +w mbox1
[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox1)
mbdel mbox:mbox1 || exit 2
test -f mbox1
],
[1])
MBDEL_TEST([mh],
[cp -r $abs_top_srcdir/testsuite/mh/mbox1 .
chmod -R +w mbox1
[MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1)
mbdel mh:mbox1 || exit 2
test -d mbox1
],
[1])
MBDEL_TEST([maildir],
[cp -r $abs_top_srcdir/testsuite/maildir/mbox1 .
chmod -R +w mbox1
[MUT_MBCOPY($abs_top_srcdir/testsuite/maildir/mbox1)
mbdel maildir:mbox1 || exit 2
test -d mbox1
],
[1])
MBDEL_TEST([mh with subdirs],
[cp -r $abs_top_srcdir/testsuite/mh/mbox1 .
chmod -R +w mbox1
[MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1)
mkdir mbox1/subfolder
mbdel mh:mbox1 || exit 2
test -d mbox1 && find mbox1
......@@ -65,8 +61,7 @@ mbox1/subfolder
])
MBDEL_TEST([maildir with subdirs],
[cp -r $abs_top_srcdir/testsuite/maildir/mbox1 .
chmod -R +w mbox1
[MUT_MBCOPY($abs_top_srcdir/testsuite/maildir/mbox1)
mkdir mbox1/subfolder
mbdel maildir:mbox1 || exit 2
test -d mbox1 && find mbox1
......
......@@ -43,3 +43,15 @@ _EOT
AT_CLEANUP
])
dnl ------------------------------------------------------------
dnl MUT_MBCOPY(SRC, DST) -- Copy mailbox SRC to DST.
dnl
dnl
m4_define([MUT_MBCOPY],[
m4_pushdef([__dst],[m4_if([$2],,[.],[$2])])
m4_pushdef([__basename],[m4_bregexp($1,[.*/\([^/]+\)$],\1)])
cp -r $1 __dst
chmod -R +w __dst/__basename
m4_popdef([__basename])
m4_popdef([__dst])
])
......