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 ...@@ -89,3 +89,11 @@ if [ -r .bootstrap ]; then
89 echo "$0: Reading configuration file .bootstrap" 89 echo "$0: Reading configuration file .bootstrap"
90 eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*" 90 eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
91 fi 91 fi
92
93 # Recreate missing maildir parts
94 for mbox in testsuite/maildir/*
95 do
96 test -d $mbox/new || mkdir $mbox/new
97 test -d $mbox/cur || mkdir $mbox/cur
98 test -d $mbox/tmp || mkdir $mbox/tmp
99 done
......
...@@ -44,7 +44,7 @@ TESTSUITE = $(srcdir)/testsuite ...@@ -44,7 +44,7 @@ TESTSUITE = $(srcdir)/testsuite
44 M4=m4 44 M4=m4
45 45
46 AUTOTEST = $(AUTOM4TE) --language=autotest 46 AUTOTEST = $(AUTOM4TE) --language=autotest
47 $(TESTSUITE): package.m4 $(TESTSUITE_AT) 47 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
48 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp 48 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
49 $(AM_V_at)mv $@.tmp $@ 49 $(AM_V_at)mv $@.tmp $@
50 50
......
...@@ -73,7 +73,7 @@ TESTSUITE = $(srcdir)/testsuite ...@@ -73,7 +73,7 @@ TESTSUITE = $(srcdir)/testsuite
73 M4=m4 73 M4=m4
74 74
75 AUTOTEST = $(AUTOM4TE) --language=autotest 75 AUTOTEST = $(AUTOM4TE) --language=autotest
76 $(TESTSUITE): package.m4 $(TESTSUITE_AT) 76 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
77 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp 77 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
78 $(AM_V_at)mv $@.tmp $@ 78 $(AM_V_at)mv $@.tmp $@
79 79
......
...@@ -44,7 +44,7 @@ TESTSUITE = $(srcdir)/testsuite ...@@ -44,7 +44,7 @@ TESTSUITE = $(srcdir)/testsuite
44 M4=m4 44 M4=m4
45 45
46 AUTOTEST = $(AUTOM4TE) --language=autotest 46 AUTOTEST = $(AUTOM4TE) --language=autotest
47 $(TESTSUITE): package.m4 $(TESTSUITE_AT) 47 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
48 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp 48 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
49 $(AM_V_at)mv $@.tmp $@ 49 $(AM_V_at)mv $@.tmp $@
50 50
......
...@@ -46,7 +46,7 @@ TESTSUITE = $(srcdir)/testsuite ...@@ -46,7 +46,7 @@ TESTSUITE = $(srcdir)/testsuite
46 M4=m4 46 M4=m4
47 47
48 AUTOTEST = $(AUTOM4TE) --language=autotest 48 AUTOTEST = $(AUTOM4TE) --language=autotest
49 $(TESTSUITE): package.m4 $(TESTSUITE_AT) 49 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
50 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp 50 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
51 $(AM_V_at)mv $@.tmp $@ 51 $(AM_V_at)mv $@.tmp $@
52 52
......
...@@ -67,7 +67,7 @@ TESTSUITE = $(srcdir)/testsuite ...@@ -67,7 +67,7 @@ TESTSUITE = $(srcdir)/testsuite
67 M4=m4 67 M4=m4
68 68
69 AUTOTEST = $(AUTOM4TE) --language=autotest 69 AUTOTEST = $(AUTOM4TE) --language=autotest
70 $(TESTSUITE): package.m4 $(TESTSUITE_AT) 70 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
71 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp 71 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
72 $(AM_V_at)mv $@.tmp $@ 72 $(AM_V_at)mv $@.tmp $@
73 73
......
...@@ -30,8 +30,7 @@ if numaddr [[ "to", "cc" ]] :over 5 ...@@ -30,8 +30,7 @@ if numaddr [[ "to", "cc" ]] :over 5
30 } 30 }
31 ]) 31 ])
32 32
33 cp $abs_top_srcdir/testsuite/spool/bigto.mbox . 33 MUT_MBCOPY($abs_top_srcdir/testsuite/spool/bigto.mbox)
34 chmod +w bigto.mbox
35 34
36 sieve MUT_SIEVE_CMDLINE dnl 35 sieve MUT_SIEVE_CMDLINE dnl
37 --clearpath -L "${abs_top_builddir}/examples" -f ./bigto.mbox prog 36 --clearpath -L "${abs_top_builddir}/examples" -f ./bigto.mbox prog
......
...@@ -29,8 +29,7 @@ require "redirect"; ...@@ -29,8 +29,7 @@ require "redirect";
29 29
30 redirect "gray@gnu.org"; 30 redirect "gray@gnu.org";
31 ]) 31 ])
32 cp $abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX . 32 MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)
33 chmod +w MUT_SIEVE_MAILBOX
34 33
35 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1 34 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
36 sed 's/ $//' ./mta.diag 35 sed 's/ $//' ./mta.diag
......
...@@ -46,8 +46,7 @@ s/^\( *[[0-9]][[0-9]]*: The original message was received at *\).*\( from .*\)/\ ...@@ -46,8 +46,7 @@ s/^\( *[[0-9]][[0-9]]*: The original message was received at *\).*\( from .*\)/\
46 s/^\( *[[0-9]][[0-9]]*: Last-Attempt-Date:\).*/\1 (date)/ 46 s/^\( *[[0-9]][[0-9]]*: Last-Attempt-Date:\).*/\1 (date)/
47 ]) 47 ])
48 48
49 cp $abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX . 49 MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)
50 chmod +w MUT_SIEVE_MAILBOX
51 50
52 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1 51 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
53 sed -f filter.sed ./mta.diag 52 sed -f filter.sed ./mta.diag
......
...@@ -70,8 +70,7 @@ AT_CHECK([sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f $2 prog ...@@ -70,8 +70,7 @@ AT_CHECK([sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f $2 prog
70 m4_define([MUT_TESTCASE],[ 70 m4_define([MUT_TESTCASE],[
71 AT_SETUP([$1]) 71 AT_SETUP([$1])
72 AT_KEYWORDS([$2]) 72 AT_KEYWORDS([$2])
73 cp $abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX . 73 MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)
74 chmod +w MUT_SIEVE_MAILBOX
75 74
76 MUT_SIEVE_RUN([$3], ./MUT_SIEVE_MAILBOX, m4_shift(m4_shift(m4_shift($@)))) 75 MUT_SIEVE_RUN([$3], ./MUT_SIEVE_MAILBOX, m4_shift(m4_shift(m4_shift($@))))
77 AT_CLEANUP]) 76 AT_CLEANUP])
......
...@@ -68,7 +68,7 @@ TESTSUITE = $(srcdir)/testsuite ...@@ -68,7 +68,7 @@ TESTSUITE = $(srcdir)/testsuite
68 M4=m4 68 M4=m4
69 69
70 AUTOTEST = $(AUTOM4TE) --language=autotest 70 AUTOTEST = $(AUTOM4TE) --language=autotest
71 $(TESTSUITE): package.m4 $(TESTSUITE_AT) 71 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
72 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp 72 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
73 $(AM_V_at)mv $@.tmp $@ 73 $(AM_V_at)mv $@.tmp $@
74 74
......
...@@ -28,32 +28,28 @@ AT_CLEANUP ...@@ -28,32 +28,28 @@ AT_CLEANUP
28 28
29 dnl ------------------------------------------------------------ 29 dnl ------------------------------------------------------------
30 MBDEL_TEST([mbox], 30 MBDEL_TEST([mbox],
31 [cp $abs_top_srcdir/testsuite/spool/mbox1 . 31 [MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox1)
32 chmod +w mbox1
33 mbdel mbox:mbox1 || exit 2 32 mbdel mbox:mbox1 || exit 2
34 test -f mbox1 33 test -f mbox1
35 ], 34 ],
36 [1]) 35 [1])
37 36
38 MBDEL_TEST([mh], 37 MBDEL_TEST([mh],
39 [cp -r $abs_top_srcdir/testsuite/mh/mbox1 . 38 [MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1)
40 chmod -R +w mbox1
41 mbdel mh:mbox1 || exit 2 39 mbdel mh:mbox1 || exit 2
42 test -d mbox1 40 test -d mbox1
43 ], 41 ],
44 [1]) 42 [1])
45 43
46 MBDEL_TEST([maildir], 44 MBDEL_TEST([maildir],
47 [cp -r $abs_top_srcdir/testsuite/maildir/mbox1 . 45 [MUT_MBCOPY($abs_top_srcdir/testsuite/maildir/mbox1)
48 chmod -R +w mbox1
49 mbdel maildir:mbox1 || exit 2 46 mbdel maildir:mbox1 || exit 2
50 test -d mbox1 47 test -d mbox1
51 ], 48 ],
52 [1]) 49 [1])
53 50
54 MBDEL_TEST([mh with subdirs], 51 MBDEL_TEST([mh with subdirs],
55 [cp -r $abs_top_srcdir/testsuite/mh/mbox1 . 52 [MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1)
56 chmod -R +w mbox1
57 mkdir mbox1/subfolder 53 mkdir mbox1/subfolder
58 mbdel mh:mbox1 || exit 2 54 mbdel mh:mbox1 || exit 2
59 test -d mbox1 && find mbox1 55 test -d mbox1 && find mbox1
...@@ -65,8 +61,7 @@ mbox1/subfolder ...@@ -65,8 +61,7 @@ mbox1/subfolder
65 ]) 61 ])
66 62
67 MBDEL_TEST([maildir with subdirs], 63 MBDEL_TEST([maildir with subdirs],
68 [cp -r $abs_top_srcdir/testsuite/maildir/mbox1 . 64 [MUT_MBCOPY($abs_top_srcdir/testsuite/maildir/mbox1)
69 chmod -R +w mbox1
70 mkdir mbox1/subfolder 65 mkdir mbox1/subfolder
71 mbdel maildir:mbox1 || exit 2 66 mbdel maildir:mbox1 || exit 2
72 test -d mbox1 && find mbox1 67 test -d mbox1 && find mbox1
......
...@@ -43,3 +43,15 @@ _EOT ...@@ -43,3 +43,15 @@ _EOT
43 AT_CLEANUP 43 AT_CLEANUP
44 ]) 44 ])
45 45
46 dnl ------------------------------------------------------------
47 dnl MUT_MBCOPY(SRC, DST) -- Copy mailbox SRC to DST.
48 dnl
49 dnl
50 m4_define([MUT_MBCOPY],[
51 m4_pushdef([__dst],[m4_if([$2],,[.],[$2])])
52 m4_pushdef([__basename],[m4_bregexp($1,[.*/\([^/]+\)$],\1)])
53 cp -r $1 __dst
54 chmod -R +w __dst/__basename
55 m4_popdef([__basename])
56 m4_popdef([__dst])
57 ])
......