[PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents
authorTomi Ollila <tomi.ollila@iki.fi>
Wed, 25 May 2016 21:37:40 +0000 (00:37 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:53 +0000 (16:21 -0700)
d7/91165cb919203cdae95b5b361651b72e48feab [new file with mode: 0644]

diff --git a/d7/91165cb919203cdae95b5b361651b72e48feab b/d7/91165cb919203cdae95b5b361651b72e48feab
new file mode 100644 (file)
index 0000000..7ba8dda
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 9750A6DE0217\r
+ for <notmuch@notmuchmail.org>; Wed, 25 May 2016 14:37:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.255\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.255 tagged_above=-999 required=5 tests=[AWL=0.264, \r
+ HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id TOP-BzexOjTf for <notmuch@notmuchmail.org>;\r
+ Wed, 25 May 2016 14:37:46 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 5FBAE6DE00EB\r
+ for <notmuch@notmuchmail.org>; Wed, 25 May 2016 14:37:46 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 6BDB71000C6; Thu, 26 May 2016 00:37:42 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Cc: tomi.ollila@iki.fi\r
+Subject: [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents\r
+Date: Thu, 26 May 2016 00:37:40 +0300\r
+Message-Id: <1464212261-26892-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.8.2\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 25 May 2016 21:37:54 -0000\r
+\r
+Previously LD_LIBRARY_PATH was exported (and environment changed)\r
+in the middle of test case execution, when a function setting it\r
+was called.\r
+\r
+Previously the old contents of LD_LIBRARY_PATH was lost (if any)\r
+when it was re-set and exported. In some systems the old contents of\r
+LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.\r
+---\r
+\r
+This series (of 2 patches) has exactly same payload as the previous\r
+version:\r
+       id:1460738800-9021-1-git-send-email-tomi.ollila@iki.fi\r
+\r
+commit messages are updated to be accurate (? :) this time.\r
+\r
+ test/T360-symbol-hiding.sh | 5 ++---\r
+ test/test-lib-common.sh    | 5 +++++\r
+ test/test-lib.sh           | 3 ---\r
+ 3 files changed, 7 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh\r
+index 3f18ec1a34fc..9c10e8eda07f 100755\r
+--- a/test/T360-symbol-hiding.sh\r
++++ b/test/T360-symbol-hiding.sh\r
+@@ -13,9 +13,8 @@ test_description='exception symbol hiding'\r
\r
+ test_begin_subtest 'running test' run_test\r
+ mkdir -p ${PWD}/fakedb/.notmuch\r
+-( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \\r
+-               $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \\r
+-               2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT\r
++$TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \\r
++      | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT\r
\r
+ cat <<EOF > EXPECTED\r
+ A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'\r
+diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh\r
+index ba4a8e112084..026440ccc057 100644\r
+--- a/test/test-lib-common.sh\r
++++ b/test/test-lib-common.sh\r
+@@ -52,6 +52,11 @@ restore_database () {\r
+ TEST_DIRECTORY=$(pwd -P)\r
+ notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`\r
\r
++# Prepend $TEST_DIRECTORY/../lib to LD_LIBRARY_PATH, to make tests work\r
++# on systems where ../notmuch depends on LD_LIBRARY_PATH.\r
++LD_LIBRARY_PATH=${TEST_DIRECTORY%/*}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\r
++export LD_LIBRARY_PATH\r
++\r
+ # configure output\r
+ . $notmuch_path/sh.config || exit 1\r
\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 62e123d65aba..a7e6397c324e 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -1171,7 +1171,6 @@ test_emacs () {\r
+ }\r
\r
+ test_python() {\r
+-      export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib\r
+       export PYTHONPATH=$TEST_DIRECTORY/../bindings/python\r
\r
+       (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \\r
+@@ -1179,7 +1178,6 @@ test_python() {\r
+ }\r
\r
+ test_ruby() {\r
+-    export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib\r
+     MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT\r
+ }\r
\r
+@@ -1187,7 +1185,6 @@ test_C () {\r
+     exec_file="test${test_count}"\r
+     test_file="${exec_file}.c"\r
+     cat > ${test_file}\r
+-    export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib\r
+     ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc\r
+     echo "== stdout ==" > OUTPUT.stdout\r
+     echo "== stderr ==" > OUTPUT.stderr\r
+-- \r
+2.8.2\r
+\r