Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f1 / b6a90b9aa602914864118cebe6fbe3fb6d88fa
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 887C5431FC0\r
6         for <notmuch@notmuchmail.org>; Sat,  8 Mar 2014 13:21:31 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 0HE53Oay1AlG for <notmuch@notmuchmail.org>;\r
16         Sat,  8 Mar 2014 13:21:26 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id B5107431FD0\r
21         for <notmuch@notmuchmail.org>; Sat,  8 Mar 2014 13:20:47 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tethera.net>)\r
24         id 1WMOfn-00059g-6A; Sat, 08 Mar 2014 17:20:47 -0400\r
25 Received: (nullmailer pid 28552 invoked by uid 1000); Sat, 08 Mar 2014\r
26         21:20:03 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [Patch v3 13/15] devel: add script to generate test databases\r
30 Date: Sat,  8 Mar 2014 17:19:43 -0400\r
31 Message-Id: <1394313585-28422-14-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.5.3\r
33 In-Reply-To: <1394313585-28422-1-git-send-email-david@tethera.net>\r
34 References: <1394313585-28422-1-git-send-email-david@tethera.net>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Sat, 08 Mar 2014 21:21:31 -0000\r
48 \r
49 From: Jani Nikula <jani@nikula.org>\r
50 \r
51 Add script to generate notmuch test databases using specified versions\r
52 of notmuch. This is useful for generating material for database\r
53 upgrade tests.\r
54 \r
55 This reuses the test infrastructure to have a sandbox environment for\r
56 notmuch new etc.\r
57 ---\r
58  devel/gen-testdb.sh | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++\r
59  1 file changed, 131 insertions(+)\r
60  create mode 100755 devel/gen-testdb.sh\r
61 \r
62 diff --git a/devel/gen-testdb.sh b/devel/gen-testdb.sh\r
63 new file mode 100755\r
64 index 0000000..621b31e\r
65 --- /dev/null\r
66 +++ b/devel/gen-testdb.sh\r
67 @@ -0,0 +1,131 @@\r
68 +#!/usr/bin/env bash\r
69 +#\r
70 +# NAME\r
71 +#      gen-testdb.sh - generate test databases\r
72 +#\r
73 +# SYNOPSIS\r
74 +#      gen-testdb.sh -v NOTMUCH-VERSION [-c CORPUS-PATH] [-s TAR-SUFFIX]\r
75 +#\r
76 +# DESCRIPTION\r
77 +#      Generate a tarball containing the specified test corpus and\r
78 +#      the corresponding notmuch database, indexed using a specific\r
79 +#      version of notmuch, resulting in a specific version of the\r
80 +#      database.\r
81 +#\r
82 +#      The specific version of notmuch will be built on the fly.\r
83 +#      Therefore the script must be run within a git repository to be\r
84 +#      able to build the old versions of notmuch.\r
85 +#\r
86 +#      This script reuses the test infrastructure, and the script\r
87 +#      must be run from within the test directory.\r
88 +#\r
89 +#      The output tarballs, named database-<TAR-SUFFIX>.tar.gz, are\r
90 +#      placed in the test/test-databases directory.\r
91 +#\r
92 +# OPTIONS\r
93 +#      -v NOTMUCH-VERSION\r
94 +#              Notmuch version in terms of a git tag or commit to use\r
95 +#              for generating the database. Required.\r
96 +#\r
97 +#      -c CORPUS-PATH\r
98 +#              Path to a corpus to use for generating the\r
99 +#              database. Due to CWD changes within the test\r
100 +#              infrastructure, use absolute paths. Defaults to the\r
101 +#              test corpus.\r
102 +#\r
103 +#      -s TAR-SUFFIX\r
104 +#              Suffix for the tarball basename. Empty by default.\r
105 +#\r
106 +# EXAMPLE\r
107 +#\r
108 +#      Generate a database indexed with notmuch 0.17. Use the default\r
109 +#      test corpus. Name the tarball database-v1.tar.gz to reflect\r
110 +#      the fact that notmuch 0.17 used database version 1.\r
111 +#\r
112 +#      $ cd test\r
113 +#      $ ../devel/gen-testdb.sh -v 0.17 -s v1\r
114 +#\r
115 +# CAVEATS\r
116 +#      Test infrastructure options won't work.\r
117 +#\r
118 +#      Any existing databases with the same name will be overwritten.\r
119 +#\r
120 +#      It may not be possible to build old versions of notmuch with\r
121 +#      the set of dependencies that satisfy building the current\r
122 +#      version of notmuch.\r
123 +#\r
124 +# AUTHOR\r
125 +#      Jani Nikula <jani@nikula.org>\r
126 +#\r
127 +# LICENSE\r
128 +#      Same as notmuch test infrastructure (GPLv2+).\r
129 +#\r
130 +\r
131 +test_description="database generation abusing test infrastructure"\r
132 +\r
133 +# immediate exit on subtest failure; see test_failure_ in test-lib.sh\r
134 +immediate=t\r
135 +\r
136 +VERSION=\r
137 +CORPUS=\r
138 +SUFFIX=\r
139 +\r
140 +while getopts v:c:s: opt; do\r
141 +    case "$opt" in\r
142 +       v) VERSION="$OPTARG";;\r
143 +       c) CORPUS="$OPTARG";;\r
144 +       s) SUFFIX="-$OPTARG";;\r
145 +    esac\r
146 +done\r
147 +shift `expr $OPTIND - 1`\r
148 +\r
149 +. ./test-lib.sh\r
150 +\r
151 +SHORT_CORPUS=$(basename ${CORPUS:-database})\r
152 +DBNAME=${SHORT_CORPUS}${SUFFIX}\r
153 +TARBALLNAME=${DBNAME}.tar.xz\r
154 +\r
155 +CORPUS=${CORPUS:-${TEST_DIRECTORY}/corpus}\r
156 +\r
157 +test_expect_code 0 "notmuch version specified on the command line" \\r
158 +    "test -n ${VERSION}"\r
159 +\r
160 +test_expect_code 0 "the specified version ${VERSION} refers to a commit" \\r
161 +    "git show ${VERSION} >/dev/null 2>&1"\r
162 +\r
163 +BUILD_DIR="notmuch-${VERSION}"\r
164 +test_expect_code 0 "generate snapshot of notmuch version ${VERSION}" \\r
165 +    "git -C $TEST_DIRECTORY/.. archive --prefix=${BUILD_DIR}/ --format=tar ${VERSION} | tar x"\r
166 +\r
167 +# force version string\r
168 +git describe --match '[0-9.]*' ${VERSION} > ${BUILD_DIR}/version\r
169 +\r
170 +test_expect_code 0 "configure and build notmuch version ${VERSION}" \\r
171 +    "make -C ${BUILD_DIR}"\r
172 +\r
173 +# use the newly built notmuch\r
174 +export PATH=./${BUILD_DIR}:$PATH\r
175 +\r
176 +test_begin_subtest "verify the newly built notmuch version"\r
177 +test_expect_equal "`notmuch --version`" "notmuch `cat ${BUILD_DIR}/version`"\r
178 +\r
179 +# replace the existing mails, if any, with the specified corpus\r
180 +rm -rf ${MAIL_DIR}\r
181 +cp -a ${CORPUS} ${MAIL_DIR}\r
182 +\r
183 +test_expect_code 0 "index the corpus" \\r
184 +    "notmuch new"\r
185 +\r
186 +# wrap the resulting mail store and database in a tarball\r
187 +\r
188 +cp -a ${MAIL_DIR} ${TMP_DIRECTORY}/${DBNAME}\r
189 +tar Jcf ${TMP_DIRECTORY}/${TARBALLNAME} -C ${TMP_DIRECTORY} ${DBNAME}\r
190 +mkdir -p  ${TEST_DIRECTORY}/test-databases\r
191 +cp -a ${TMP_DIRECTORY}/${TARBALLNAME} ${TEST_DIRECTORY}/test-databases\r
192 +test_expect_code 0 "create the output tarball ${TARBALLNAME}" \\r
193 +    "test -f ${TEST_DIRECTORY}/test-databases/${TARBALLNAME}"\r
194 +\r
195 +# generate a checksum file\r
196 +test_expect_code 0 "compute checksum" \\r
197 +    "(cd ${TEST_DIRECTORY}/test-databases/ && sha256sum ${TARBALLNAME} > ${TARBALLNAME}.sha256)"\r
198 +test_done\r
199 -- \r
200 1.8.5.3\r
201 \r