* [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents
@ 2016-05-25 21:37 Tomi Ollila
2016-05-25 21:37 ` [PATCH 2/2] test: test_python: set PYTHONPATH to the python execution environment Tomi Ollila
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tomi Ollila @ 2016-05-25 21:37 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
Previously LD_LIBRARY_PATH was exported (and environment changed)
in the middle of test case execution, when a function setting it
was called.
Previously the old contents of LD_LIBRARY_PATH was lost (if any)
when it was re-set and exported. In some systems the old contents of
LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.
---
This series (of 2 patches) has exactly same payload as the previous
version:
id:1460738800-9021-1-git-send-email-tomi.ollila@iki.fi
commit messages are updated to be accurate (? :) this time.
test/T360-symbol-hiding.sh | 5 ++---
test/test-lib-common.sh | 5 +++++
test/test-lib.sh | 3 ---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 3f18ec1a34fc..9c10e8eda07f 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -13,9 +13,8 @@ test_description='exception symbol hiding'
test_begin_subtest 'running test' run_test
mkdir -p ${PWD}/fakedb/.notmuch
-( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \
- $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \
- 2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT
+$TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
+ | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
cat <<EOF > EXPECTED
A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index ba4a8e112084..026440ccc057 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -52,6 +52,11 @@ restore_database () {
TEST_DIRECTORY=$(pwd -P)
notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
+# Prepend $TEST_DIRECTORY/../lib to LD_LIBRARY_PATH, to make tests work
+# on systems where ../notmuch depends on LD_LIBRARY_PATH.
+LD_LIBRARY_PATH=${TEST_DIRECTORY%/*}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH
+
# configure output
. $notmuch_path/sh.config || exit 1
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 62e123d65aba..a7e6397c324e 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1171,7 +1171,6 @@ test_emacs () {
}
test_python() {
- export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
(echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
@@ -1179,7 +1178,6 @@ test_python() {
}
test_ruby() {
- export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
}
@@ -1187,7 +1185,6 @@ test_C () {
exec_file="test${test_count}"
test_file="${exec_file}.c"
cat > ${test_file}
- export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib
${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
echo "== stdout ==" > OUTPUT.stdout
echo "== stderr ==" > OUTPUT.stderr
--
2.8.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] test: test_python: set PYTHONPATH to the python execution environment
2016-05-25 21:37 [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Tomi Ollila
@ 2016-05-25 21:37 ` Tomi Ollila
2016-05-26 16:03 ` [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Bijan Chokoufe Nejad
2016-06-11 16:25 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2016-05-25 21:37 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
Place PYTHONPATH to the environment when python is executed in a way
that current shell environment is not affected. This also allows adding
the old value of PYTHONPATH to the end of the new value (otherwise it
would have been appended again and again when test_python is called).
At the same time, use -B option to avoid writing .pyc files to
bindings/python/* (which are not cleared out by distclean).
Drop the (unused) prefix code which preserved the original stdout of the
python program and opened sys.stdout to OUTPUT. In place of that there
is now note how (debug) information can be printed to original stdout.
---
test/test-lib.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index a7e6397c324e..ec2da0b7151c 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1171,10 +1171,10 @@ test_emacs () {
}
test_python() {
- export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
-
- (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
- | $NOTMUCH_PYTHON -
+ # Note: if there is need to print debug information from python program,
+ # use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
+ PYTHONPATH="$TEST_DIRECTORY/../bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
+ $NOTMUCH_PYTHON -B - > OUTPUT
}
test_ruby() {
--
2.8.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents
2016-05-25 21:37 [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Tomi Ollila
2016-05-25 21:37 ` [PATCH 2/2] test: test_python: set PYTHONPATH to the python execution environment Tomi Ollila
@ 2016-05-26 16:03 ` Bijan Chokoufe Nejad
2016-06-11 16:25 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: Bijan Chokoufe Nejad @ 2016-05-26 16:03 UTC (permalink / raw)
To: Tomi Ollila; +Cc: notmuch
This could explain some of the problems I had to get the test suite running.
I would have never guessed that LD_LIBRARY_PATH gets overwritten by the test
suite.
On 16-05-26, Tomi Ollila wrote:
> Previously LD_LIBRARY_PATH was exported (and environment changed)
> in the middle of test case execution, when a function setting it
> was called.
>
> Previously the old contents of LD_LIBRARY_PATH was lost (if any)
> when it was re-set and exported. In some systems the old contents of
> LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.
> ---
>
> This series (of 2 patches) has exactly same payload as the previous
> version:
> id:1460738800-9021-1-git-send-email-tomi.ollila@iki.fi
>
> commit messages are updated to be accurate (? :) this time.
>
> test/T360-symbol-hiding.sh | 5 ++---
> test/test-lib-common.sh | 5 +++++
> test/test-lib.sh | 3 ---
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
> index 3f18ec1a34fc..9c10e8eda07f 100755
> --- a/test/T360-symbol-hiding.sh
> +++ b/test/T360-symbol-hiding.sh
> @@ -13,9 +13,8 @@ test_description='exception symbol hiding'
>
> test_begin_subtest 'running test' run_test
> mkdir -p ${PWD}/fakedb/.notmuch
> -( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \
> - $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \
> - 2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT
> +$TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
> + | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
>
> cat <<EOF > EXPECTED
> A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
> diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
> index ba4a8e112084..026440ccc057 100644
> --- a/test/test-lib-common.sh
> +++ b/test/test-lib-common.sh
> @@ -52,6 +52,11 @@ restore_database () {
> TEST_DIRECTORY=$(pwd -P)
> notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
>
> +# Prepend $TEST_DIRECTORY/../lib to LD_LIBRARY_PATH, to make tests work
> +# on systems where ../notmuch depends on LD_LIBRARY_PATH.
> +LD_LIBRARY_PATH=${TEST_DIRECTORY%/*}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
> +export LD_LIBRARY_PATH
> +
> # configure output
> . $notmuch_path/sh.config || exit 1
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 62e123d65aba..a7e6397c324e 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -1171,7 +1171,6 @@ test_emacs () {
> }
>
> test_python() {
> - export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
> export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
>
> (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
> @@ -1179,7 +1178,6 @@ test_python() {
> }
>
> test_ruby() {
> - export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
> MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
> }
>
> @@ -1187,7 +1185,6 @@ test_C () {
> exec_file="test${test_count}"
> test_file="${exec_file}.c"
> cat > ${test_file}
> - export LD_LIBRARY_PATH=${TEST_DIRECTORY}/../lib
> ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
> echo "== stdout ==" > OUTPUT.stdout
> echo "== stderr ==" > OUTPUT.stderr
> --
> 2.8.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents
2016-05-25 21:37 [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Tomi Ollila
2016-05-25 21:37 ` [PATCH 2/2] test: test_python: set PYTHONPATH to the python execution environment Tomi Ollila
2016-05-26 16:03 ` [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Bijan Chokoufe Nejad
@ 2016-06-11 16:25 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2016-06-11 16:25 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
Tomi Ollila <tomi.ollila@iki.fi> writes:
> Previously LD_LIBRARY_PATH was exported (and environment changed)
> in the middle of test case execution, when a function setting it
> was called.
Pushed the series
d
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-11 16:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-25 21:37 [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Tomi Ollila
2016-05-25 21:37 ` [PATCH 2/2] test: test_python: set PYTHONPATH to the python execution environment Tomi Ollila
2016-05-26 16:03 ` [PATCH 1/2] test: set LD_LIBRARY_PATH early and keep its old contents Bijan Chokoufe Nejad
2016-06-11 16:25 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).