[PATCH] test: set LD_LIBRARY_PATH early and keep its old contents
authorTomi Ollila <tomi.ollila@iki.fi>
Fri, 15 Apr 2016 16:46:40 +0000 (19:46 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:38 +0000 (16:21 -0700)
62/9262c1c8431ee769c7ee555cc850f780ed6669 [new file with mode: 0644]

diff --git a/62/9262c1c8431ee769c7ee555cc850f780ed6669 b/62/9262c1c8431ee769c7ee555cc850f780ed6669
new file mode 100644 (file)
index 0000000..d4b2a88
--- /dev/null
@@ -0,0 +1,132 @@
+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 326E06DE00F5\r
+ for <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 09:46:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.281\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.281 tagged_above=-999 required=5 tests=[AWL=0.290, \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 rUIQcvd8e_2d for <notmuch@notmuchmail.org>;\r
+ Fri, 15 Apr 2016 09:46: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 303E06DE00EB\r
+ for <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 09:46:46 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id ACF5F10019D; Fri, 15 Apr 2016 19:46: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] test: set LD_LIBRARY_PATH early and keep its old contents\r
+Date: Fri, 15 Apr 2016 19:46:40 +0300\r
+Message-Id: <1460738800-9021-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.6.4\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: Fri, 15 Apr 2016 16:46:54 -0000\r
+\r
+Previously LD_LIBRARY_PATH was set in the middle of test case\r
+execution, when a function setting it was called.\r
+\r
+Previously the old contents of LD_LIBRARY_PATH was lost (if any)\r
+when it was re-set. In some systems the old contents of\r
+LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.\r
+---\r
+\r
+These changes scratch the particular itch I have with these when\r
+running this on Scientific Linux 6.2. Before this I got quite a\r
+few lines of noise, and notmuch printing empty strings breaking\r
+the test suite even more. Now I get\r
+\r
+Notmuch test suite complete.\r
+765/768 tests passed.\r
+1 broken test failed as expected.\r
+2 tests failed.\r
+\r
+Which is pretty good. Those 2 failing tests (and some skipped)\r
+is just "normal" in this system.\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 0cdd36a74655..f5eca50066bc 100644\r
+--- a/test/test-lib-common.sh\r
++++ b/test/test-lib-common.sh\r
+@@ -58,6 +58,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 235149b7b837..e8003237b24d 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -1175,7 +1175,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
+@@ -1183,7 +1182,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
+@@ -1191,7 +1189,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.6.4\r
+\r