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 541B4429E34
\r
6 for <notmuch@notmuchmail.org>; Fri, 27 Mar 2015 15:14:40 -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 7-O1+Nd+aMQf for <notmuch@notmuchmail.org>;
\r
16 Fri, 27 Mar 2015 15:14:39 -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 915E1429E30
\r
22 for <notmuch@notmuchmail.org>; Fri, 27 Mar 2015 15:14:39 -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 1YbcVn-0000FW-IF; Fri, 27 Mar 2015 22:13:55 +0000
\r
26 Received: (nullmailer pid 1809 invoked by uid 1000); Fri, 27 Mar 2015
\r
28 From: David Bremner <david@tethera.net>
\r
29 To: notmuch@notmuchmail.org
\r
30 Subject: [Patch v6 2/8] test: add support for compiling and running C snippets
\r
31 Date: Fri, 27 Mar 2015 23:11:54 +0100
\r
32 Message-Id: <1427494320-1483-3-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 2.1.4
\r
34 In-Reply-To: <1427494320-1483-1-git-send-email-david@tethera.net>
\r
35 References: <1427494320-1483-1-git-send-email-david@tethera.net>
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Fri, 27 Mar 2015 22:14:40 -0000
\r
50 This is to limit the copy-pasta involved in running C tests. I decided
\r
51 to keep things simple and not try to provide an actual C skeleton.
\r
53 The setting of LD_LIBRARY_PATH is to force using the built libnotmuch
\r
54 rather than any potential system one.
\r
56 test/README | 5 +++++
\r
57 test/test-lib.sh | 15 +++++++++++++++
\r
58 2 files changed, 20 insertions(+)
\r
60 diff --git a/test/README b/test/README
\r
61 index 81a1c82..5b40474 100644
\r
64 @@ -84,6 +84,11 @@ the tests in one of the following ways.
\r
65 TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs
\r
66 make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient
\r
68 +Some tests may require a c compiler. You can choose the name and flags similarly
\r
69 +to with emacs, e.g.
\r
71 + make test TEST_CC=gcc TEST_CFLAGS="-g -O2"
\r
76 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
77 index 133fbe4..486d1c4 100644
\r
78 --- a/test/test-lib.sh
\r
79 +++ b/test/test-lib.sh
\r
80 @@ -73,6 +73,8 @@ if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \
\r
82 TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}
\r
83 TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}
\r
84 +TEST_CC=${TEST_CC:-cc}
\r
85 +TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"}
\r
87 # Protect ourselves from common misconfiguration to export
\r
88 # CDPATH into the environment
\r
89 @@ -1161,6 +1163,19 @@ test_python() {
\r
94 + exec_file="test${test_count}"
\r
95 + test_file="${exec_file}.c"
\r
96 + cat > ${test_file}
\r
97 + export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib
\r
98 + ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
\r
99 + echo "== stdout ==" > OUTPUT.stdout
\r
100 + echo "== stderr ==" > OUTPUT.stderr
\r
101 + ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
\r
102 + sed "s,${PWD},CWD,g" OUTPUT.stdout OUTPUT.stderr > OUTPUT
\r
106 # Creates a script that counts how much time it is executed and calls
\r
107 # notmuch. $notmuch_counter_command is set to the path to the
\r
108 # generated script. Use notmuch_counter_value() function to get the
\r