1 Return-Path: <tomi.ollila@iki.fi>
\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 11E17431FC4
\r
6 for <notmuch@notmuchmail.org>; Sat, 21 Mar 2015 01:51:50 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 0fgIPzNlY3rg for <notmuch@notmuchmail.org>;
\r
16 Sat, 21 Mar 2015 01:51:46 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id ADEDD431FC2
\r
19 for <notmuch@notmuchmail.org>; Sat, 21 Mar 2015 01:51:46 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id EE6FE10004A;
\r
22 Sat, 21 Mar 2015 10:51:21 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
25 Subject: Re: [Patch v4 2/9] test: add support for compiling and running C
\r
27 In-Reply-To: <1426352554-4383-3-git-send-email-david@tethera.net>
\r
28 References: <1426352554-4383-1-git-send-email-david@tethera.net>
\r
29 <1426352554-4383-3-git-send-email-david@tethera.net>
\r
30 User-Agent: Notmuch/0.19+53~gb45d2f9 (http://notmuchmail.org) Emacs/24.3.1
\r
31 (x86_64-unknown-linux-gnu)
\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
33 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
34 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
35 Date: Sat, 21 Mar 2015 10:51:21 +0200
\r
36 Message-ID: <m28ueq7mye.fsf@guru.guru-group.fi>
\r
38 Content-Type: text/plain
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Sat, 21 Mar 2015 08:51:50 -0000
\r
53 On Sat, Mar 14 2015, David Bremner <david@tethera.net> wrote:
\r
55 > This is to limit the copy-pasta involved in running C tests. I decided
\r
57 Wat kind of spaghetti have you been eating... ;D
\r
59 > to keep things simple and not try to provide an actual C skeleton.
\r
61 > The setting of LD_LIBRARY_PATH is to force using the built libnotmuch
\r
62 > rather than any potential system one.
\r
64 > test/README | 5 +++++
\r
65 > test/test-lib.sh | 15 +++++++++++++++
\r
66 > 2 files changed, 20 insertions(+)
\r
68 > diff --git a/test/README b/test/README
\r
69 > index 81a1c82..5b40474 100644
\r
72 > @@ -84,6 +84,11 @@ the tests in one of the following ways.
\r
73 > TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs
\r
74 > make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient
\r
76 > +Some tests may require a c compiler. You can choose the name and flags similarly
\r
77 > +to with emacs, e.g.
\r
79 > + make test TEST_CC=gcc TEST_CFLAGS="-g -O2"
\r
84 > diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
85 > index 133fbe4..c7af003 100644
\r
86 > --- a/test/test-lib.sh
\r
87 > +++ b/test/test-lib.sh
\r
88 > @@ -73,6 +73,8 @@ if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \
\r
90 > TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}
\r
91 > TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}
\r
92 > +TEST_CC=${TEST_CC:-cc}
\r
93 > +TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"}
\r
95 > # Protect ourselves from common misconfiguration to export
\r
96 > # CDPATH into the environment
\r
97 > @@ -1161,6 +1163,19 @@ test_python() {
\r
103 for consistency test_C () {
\r
105 > + test_file="test${test_count}.c"
\r
106 > + exec_file=${test_file%%.c}
\r
108 These could be other way around, if not, exec_file=${test_file%.c} (i.e.
\r
109 only one % is enough).
\r
111 > + cat > ${test_file}
\r
112 > + export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib
\r
113 > + ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch
\r
114 > + echo "== stdout ==" > OUTPUT.stdout
\r
115 > + echo "== stderr ==" > OUTPUT.stderr
\r
116 > + ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
\r
117 > + cat OUTPUT.stdout OUTPUT.stderr | sed "s,$(pwd),CWD," > OUTPUT
\r
119 sed "s,${PWD},CWD," OUTPUT.stdout OUTPUT.stderr > OUTPUT
\r