[PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents
[notmuch-archives.git] / d7 / 91165cb919203cdae95b5b361651b72e48feab
1 Return-Path: <too@guru-group.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 arlo.cworth.org (Postfix) with ESMTP id 9750A6DE0217\r
6  for <notmuch@notmuchmail.org>; Wed, 25 May 2016 14:37:54 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.255\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.255 tagged_above=-999 required=5 tests=[AWL=0.264, \r
12  HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id TOP-BzexOjTf for <notmuch@notmuchmail.org>;\r
17  Wed, 25 May 2016 14:37:46 -0700 (PDT)\r
18 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
19  by arlo.cworth.org (Postfix) with ESMTP id 5FBAE6DE00EB\r
20  for <notmuch@notmuchmail.org>; Wed, 25 May 2016 14:37:46 -0700 (PDT)\r
21 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
22  id 6BDB71000C6; Thu, 26 May 2016 00:37:42 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: notmuch@notmuchmail.org\r
25 Cc: tomi.ollila@iki.fi\r
26 Subject: [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents\r
27 Date: Thu, 26 May 2016 00:37:40 +0300\r
28 Message-Id: <1464212261-26892-1-git-send-email-tomi.ollila@iki.fi>\r
29 X-Mailer: git-send-email 2.8.2\r
30 X-BeenThere: notmuch@notmuchmail.org\r
31 X-Mailman-Version: 2.1.20\r
32 Precedence: list\r
33 List-Id: "Use and development of the notmuch mail system."\r
34  <notmuch.notmuchmail.org>\r
35 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
36  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
37 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
38 List-Post: <mailto:notmuch@notmuchmail.org>\r
39 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
40 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
41  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
42 X-List-Received-Date: Wed, 25 May 2016 21:37:54 -0000\r
43 \r
44 Previously LD_LIBRARY_PATH was exported (and environment changed)\r
45 in the middle of test case execution, when a function setting it\r
46 was called.\r
47 \r
48 Previously the old contents of LD_LIBRARY_PATH was lost (if any)\r
49 when it was re-set and exported. In some systems the old contents of\r
50 LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.\r
51 ---\r
52 \r
53 This series (of 2 patches) has exactly same payload as the previous\r
54 version:\r
55         id:1460738800-9021-1-git-send-email-tomi.ollila@iki.fi\r
56 \r
57 commit messages are updated to be accurate (? :) this time.\r
58 \r
59  test/T360-symbol-hiding.sh | 5 ++---\r
60  test/test-lib-common.sh    | 5 +++++\r
61  test/test-lib.sh           | 3 ---\r
62  3 files changed, 7 insertions(+), 6 deletions(-)\r
63 \r
64 diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh\r
65 index 3f18ec1a34fc..9c10e8eda07f 100755\r
66 --- a/test/T360-symbol-hiding.sh\r
67 +++ b/test/T360-symbol-hiding.sh\r
68 @@ -13,9 +13,8 @@ test_description='exception symbol hiding'\r
69  \r
70  test_begin_subtest 'running test' run_test\r
71  mkdir -p ${PWD}/fakedb/.notmuch\r
72 -( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \\r
73 -                $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \\r
74 -                2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT\r
75 +$TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \\r
76 +       | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT\r
77  \r
78  cat <<EOF > EXPECTED\r
79  A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'\r
80 diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh\r
81 index ba4a8e112084..026440ccc057 100644\r
82 --- a/test/test-lib-common.sh\r
83 +++ b/test/test-lib-common.sh\r
84 @@ -52,6 +52,11 @@ restore_database () {\r
85  TEST_DIRECTORY=$(pwd -P)\r
86  notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`\r
87  \r
88 +# Prepend $TEST_DIRECTORY/../lib to LD_LIBRARY_PATH, to make tests work\r
89 +# on systems where ../notmuch depends on LD_LIBRARY_PATH.\r
90 +LD_LIBRARY_PATH=${TEST_DIRECTORY%/*}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\r
91 +export LD_LIBRARY_PATH\r
92 +\r
93  # configure output\r
94  . $notmuch_path/sh.config || exit 1\r
95  \r
96 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
97 index 62e123d65aba..a7e6397c324e 100644\r
98 --- a/test/test-lib.sh\r
99 +++ b/test/test-lib.sh\r
100 @@ -1171,7 +1171,6 @@ test_emacs () {\r
101  }\r
102  \r
103  test_python() {\r
104 -       export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib\r
105         export PYTHONPATH=$TEST_DIRECTORY/../bindings/python\r
106  \r
107         (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \\r
108 @@ -1179,7 +1178,6 @@ test_python() {\r
109  }\r
110  \r
111  test_ruby() {\r
112 -    export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib\r
113      MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT\r
114  }\r
115  \r
116 @@ -1187,7 +1185,6 @@ test_C () {\r
117      exec_file="test${test_count}"\r
118      test_file="${exec_file}.c"\r
119      cat > ${test_file}\r
120 -    export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib\r
121      ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc\r
122      echo "== stdout ==" > OUTPUT.stdout\r
123      echo "== stderr ==" > OUTPUT.stderr\r
124 -- \r
125 2.8.2\r
126 \r