contrib/ksmtpproxy: Fix typo
[navymail.git] / t / t0002-fs.sh
blobfcd91f616da76467a6da4381d984d666f07cac3b
1 #!/bin/sh
2 # Copyright (C) 2011 Kirill Smelkov <kirr@navytux.spb.ru>
4 test_description='Test filesystem interface'
5 . ./test-lib.sh
8 D="$TEST_DIRECTORY/t0001"
10 # XXX partially dup from t0001-importexport.sh
11 test_expect_success 'import test mail' '
12 navymail import sup-talk $D/sup-talk.mbox,1-2 &&
13 navymail import sup-talk $D/sup-talk.mbox,3-4 &&
14 navymail import sup-talk $D/sup-talk.mbox,5-17 &&
15 navymail import sup-talk2 $D/sup-talk.mbox,1-17 &&
16 navymail import x/zzz $D/sup-talk.mbox,1-2 &&
17 navymail import x/yyy $D/sup-talk.mbox,3-4 &&
18 navymail import x/y/qqq $D/sup-talk.mbox,5-17 &&
19 navymail import x/y/ddd $D/sup-talk.mbox,17-1
22 navymail_mountpath=
23 navymail_mount() {
24 trap 'code=$?; navymail_umount; (exit $code); die' EXIT
25 navymail_mountpath="$(pwd)/$1"
26 navymail mount "$navymail_mountpath"
29 navymail_umount() {
30 test -n "$navymail_mountpath" || return
32 fusermount -u "$navymail_mountpath"
33 navymail_mountpath=
37 test_expect_success 'mount it' '
38 mkdir fs &&
39 >expect &&
40 ls -F fs >actual &&
41 test_cmp expect actual &&
42 navymail_mount fs
45 test_expect_success 'basic filesystem layout' '
46 echo "mail/" >expect &&
47 ls -F fs >actual &&
48 test_cmp expect actual &&
49 cat >expect <<EOF &&
50 sup-talk
51 sup-talk2
53 EOF
54 ls -F fs/mail >actual &&
55 test_cmp expect actual &&
56 cat >expect <<EOF &&
58 yyy
59 zzz
60 EOF
61 ls -F fs/mail/x >actual &&
62 test_cmp expect actual &&
63 cat >expect <<EOF &&
64 ddd
65 qqq
66 EOF
67 ls -F fs/mail/x/y >actual &&
68 test_cmp expect actual
71 test_expect_success 'read file content' '
72 cat fs/mail/sup-talk >read1 &&
73 cat fs/mail/sup-talk >read2 &&
74 cat fs/mail/sup-talk >read3 &&
75 test_cmp read1 read2 &&
76 test_cmp read2 read3 &&
77 navymail export --original-order sup-talk >sup-talk.mbox &&
78 cat fs/mail/sup-talk >sup-talk.read &&
79 test_cmp sup-talk.mbox sup-talk.read &&
80 test_cmp sup-talk.read read1 &&
81 test_cmp fs/mail/sup-talk2 $D/sup-talk.mbox,1-17 &&
82 test_cmp fs/mail/x/zzz $D/sup-talk.mbox,1-2 &&
83 test_cmp fs/mail/x/yyy $D/sup-talk.mbox,3-4 &&
84 test_cmp fs/mail/x/y/qqq $D/sup-talk.mbox,5-17 &&
85 test_cmp fs/mail/x/y/ddd $D/sup-talk.mbox,17-1
88 cat >expect <<EOF
89 Date: Wed, 31 Oct 2007 09:42:58 +0100
90 Date: Mon, 29 Oct 2007 16:40:37 -0500
91 Date: Mon, 29 Oct 2007 14:43:07 -0700
92 Message-ID: <1193694144-sup-4506@south>
93 Subject: [ANN] Sup 0.2 released
94 Received: from localhost.localdomain
95 Sender: sup-talk-bounces@rubyforge.org
96 - Add custom code to handle certain types of messages or to handle
97 Date: Mon, 29 Oct 2007 18:55:59 -0700
98 Date: Tue, 30 Oct 2007 15:55:18 +0000
99 rrrr
100 Date: Tue, 30 Oct 2007 15:55:18 +0000
101 from /Users/brendano/sw/sup/lib/sup/index.rb:323:in \`load_entry_for_id'
104 # tests already-seen msg lookup in navymailfs_read
105 test_expect_success 'read file content seeky' '
106 $TEST_DIRECTORY/xdd \
107 53843,38 \
108 115,38 \
109 5118,38 \
110 5156,40 \
111 5086,32 \
112 6084,37 \
113 7053,39 \
114 8017,67 \
115 8862,38 \
116 23731,38 \
117 4994,1 \
118 8709,1 \
119 13374,1 \
120 15883,1 \
121 15926,1 \
122 23731,38 \
123 12221,80 \
124 <fs/mail/sup-talk >actual &&
125 test_cmp expect actual
130 navymail_umount
131 test_done