1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 0ED7A429E30
\r
6 for <notmuch@notmuchmail.org>; Tue, 24 Mar 2015 06:26:39 -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=unavailable
\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 oTb0PwuplNqA for <notmuch@notmuchmail.org>;
\r
16 Tue, 24 Mar 2015 06:26:38 -0700 (PDT)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D5157429E29
\r
22 for <notmuch@notmuchmail.org>; Tue, 24 Mar 2015 06:26:13 -0700 (PDT)
\r
23 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
24 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
25 id 1YaOpn-0000sj-JP; Tue, 24 Mar 2015 13:25:31 +0000
\r
26 Received: (nullmailer pid 2678 invoked by uid 1000); Tue, 24 Mar 2015
\r
28 From: David Bremner <david@tethera.net>
\r
29 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
30 Subject: [Patch v5 2/8] test: add support for compiling and running C snippets
\r
31 Date: Tue, 24 Mar 2015 09:24:05 -0400
\r
32 Message-Id: <1427203451-1540-3-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 2.1.4
\r
34 In-Reply-To: <1427203451-1540-1-git-send-email-david@tethera.net>
\r
35 References: <1426352554-4383-10-git-send-email-david@tethera.net>
\r
36 <1427203451-1540-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Tue, 24 Mar 2015 13:26:40 -0000
\r
51 This is to limit the copy-pasta involved in running C tests. I decided
\r
52 to keep things simple and not try to provide an actual C skeleton.
\r
54 The setting of LD_LIBRARY_PATH is to force using the built libnotmuch
\r
55 rather than any potential system one.
\r
57 test/README | 5 +++++
\r
58 test/test-lib.sh | 15 +++++++++++++++
\r
59 2 files changed, 20 insertions(+)
\r
61 diff --git a/test/README b/test/README
\r
62 index 81a1c82..5b40474 100644
\r
65 @@ -84,6 +84,11 @@ the tests in one of the following ways.
\r
66 TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs
\r
67 make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient
\r
69 +Some tests may require a c compiler. You can choose the name and flags similarly
\r
70 +to with emacs, e.g.
\r
72 + make test TEST_CC=gcc TEST_CFLAGS="-g -O2"
\r
77 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
78 index 133fbe4..fdb84ea 100644
\r
79 --- a/test/test-lib.sh
\r
80 +++ b/test/test-lib.sh
\r
81 @@ -73,6 +73,8 @@ if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \
\r
83 TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}
\r
84 TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}
\r
85 +TEST_CC=${TEST_CC:-cc}
\r
86 +TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"}
\r
88 # Protect ourselves from common misconfiguration to export
\r
89 # CDPATH into the environment
\r
90 @@ -1161,6 +1163,19 @@ test_python() {
\r
95 + exec_file="test${test_count}"
\r
96 + test_file="${exec_file}.c"
\r
97 + cat > ${test_file}
\r
98 + export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib
\r
99 + ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
\r
100 + echo "== stdout ==" > OUTPUT.stdout
\r
101 + echo "== stderr ==" > OUTPUT.stderr
\r
102 + ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
\r
103 + sed "s,$(pwd),CWD," OUTPUT.stdout OUTPUT.stderr > OUTPUT
\r
107 # Creates a script that counts how much time it is executed and calls
\r
108 # notmuch. $notmuch_counter_command is set to the path to the
\r
109 # generated script. Use notmuch_counter_value() function to get the
\r