Re: [PATCH] test: allow user to choose which gdb to run tests with

2017-02-05 Thread Tomi Ollila
On Wed, Jan 11 2017, Mikhail  wrote:

> On 17:56 08-Jan 2017 David Bremner wrote:
>> Tomi Ollila  writes:
>> 
>> > The variable used for selecting gdb is TEST_GDB, consistent with
>> > TEST_CC and TEST_EMACS{,CLIENT}.
>> 
>> pushed this patch to master.
>> 
>
> Hello, updated FreeBSD tests patch in the attachment.

Suggested changes inline.


> From 6fb51f79192f0d1ad443aff276b7c2b9295d9c55 Mon Sep 17 00:00:00 2001
> From: Mikhail 
> Date: Thu, 22 Dec 2016 12:19:39 +0300
> Subject: [PATCH] tests: add compatibility layer
>
> Make test-lib-common.sh load test-lib-<$PLATFORM>.sh to create
> additional shim for platform specifics.
>
> Use test-lib-FREEBSD.sh to call GNU utilities instead of native ones.
> ---
>  configure| 3 +++
>  test/README  | 6 ++
>  test/test-lib-FREEBSD.sh | 7 +++
>  test/test-lib-common.sh  | 5 +
>  4 files changed, 21 insertions(+)
>  create mode 100644 test/test-lib-FREEBSD.sh
>
> diff --git a/configure b/configure
> index fa77eb8f..eb452a12 100755
> --- a/configure
> +++ b/configure
> @@ -1186,6 +1186,9 @@ NOTMUCH_PYTHON=${python}
>  # Are the ruby development files (and ruby) available? If not skip
>  # building/testing ruby bindings.
>  NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
> +
> +# Platform we are run on
> +PLATFORM=${platform}
>  EOF
>  
>  # Finally, after everything configured, inform the user how to continue.
> diff --git a/test/README b/test/README
> index 104a120e..354a32f9 100644
> --- a/test/README
> +++ b/test/README
> @@ -33,6 +33,12 @@ chosen directory to your PATH before running the tests.
>  
>  e.g. env PATH=/opt/gnu/bin:$PATH make test
>  
> +For FreeBSD you will need to install coreutils, which provides GNU
> +versions of basic utils like 'date' or 'wc'. Also you will need to
> +install latest gdb from ports or packages and provide path to it in
> +TEST_GDB variable before executing the tests, native FreeBSD gdb will
> +not work.
> +

For FreeBSD you need to install latest gdb from ports or packages and
provide path to it in TEST_GDB environment variable before executing the
tests, native FreeBSD gdb does not not work.
If you install coreutils, which provides GNU versions of basic utils like
'date' and 'base64' on FreeBSD, the test suite will use these instead of
the native ones. This provides robustness against portability issues with
these system tools. Most often the tests are written, reviewed and tested
on Linux system so such portability issues arise from time to time.

>  Running Tests
>  -
>  The easiest way to run tests is to say "make test", (or simply run the
> diff --git a/test/test-lib-FREEBSD.sh b/test/test-lib-FREEBSD.sh
> new file mode 100644
> index ..09242362
> --- /dev/null
> +++ b/test/test-lib-FREEBSD.sh
> @@ -0,0 +1,7 @@
> +# Use GNU Coreutils instead of a native BSD utils
> +
> +date () { gdate "$@"; }
> +base64 () { gbase64 "$@"; }
> +wc () { gwc "$@"; }
> +sed () { gsed "$@"; }
> +sha256sum () { gsha256sum "$@"; }

if command -v gdate >/dev/null
then
date () { gdate "$@"; }
base64 () { gbase64 "$@"; }
wc () { gwc "$@"; }
sed () { gsed "$@"; }
sha256sum () { gsha256sum "$@"; }
fi

> diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
> index 03ef1d2d..1c8d7f6e 100644
> --- a/test/test-lib-common.sh
> +++ b/test/test-lib-common.sh
> @@ -66,6 +66,11 @@ export LD_LIBRARY_PATH
>  # configure output
>  . $notmuch_path/sh.config || exit 1
>  
> +# load OS specifics
> +if [ -e ./test-lib-$PLATFORM.sh ]; then
> + . ./test-lib-$PLATFORM.sh

. ./test-lib-$PLATFORM.sh || exit 1

> +fi
> +
>  if test -n "$valgrind"
>  then
>   make_symlink () {
> -- 
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: allow user to choose which gdb to run tests with

2017-01-11 Thread Mikhail
On 17:56 08-Jan 2017 David Bremner wrote:
> Tomi Ollila  writes:
> 
> > The variable used for selecting gdb is TEST_GDB, consistent with
> > TEST_CC and TEST_EMACS{,CLIENT}.
> 
> pushed this patch to master.
> 

Hello, updated FreeBSD tests patch in the attachment.
>From 6fb51f79192f0d1ad443aff276b7c2b9295d9c55 Mon Sep 17 00:00:00 2001
From: Mikhail 
Date: Thu, 22 Dec 2016 12:19:39 +0300
Subject: [PATCH] tests: add compatibility layer

Make test-lib-common.sh load test-lib-<$PLATFORM>.sh to create
additional shim for platform specifics.

Use test-lib-FREEBSD.sh to call GNU utilities instead of native ones.
---
 configure| 3 +++
 test/README  | 6 ++
 test/test-lib-FREEBSD.sh | 7 +++
 test/test-lib-common.sh  | 5 +
 4 files changed, 21 insertions(+)
 create mode 100644 test/test-lib-FREEBSD.sh

diff --git a/configure b/configure
index fa77eb8f..eb452a12 100755
--- a/configure
+++ b/configure
@@ -1186,6 +1186,9 @@ NOTMUCH_PYTHON=${python}
 # Are the ruby development files (and ruby) available? If not skip
 # building/testing ruby bindings.
 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
+
+# Platform we are run on
+PLATFORM=${platform}
 EOF
 
 # Finally, after everything configured, inform the user how to continue.
diff --git a/test/README b/test/README
index 104a120e..354a32f9 100644
--- a/test/README
+++ b/test/README
@@ -33,6 +33,12 @@ chosen directory to your PATH before running the tests.
 
 e.g. env PATH=/opt/gnu/bin:$PATH make test
 
+For FreeBSD you will need to install coreutils, which provides GNU
+versions of basic utils like 'date' or 'wc'. Also you will need to
+install latest gdb from ports or packages and provide path to it in
+TEST_GDB variable before executing the tests, native FreeBSD gdb will
+not work.
+
 Running Tests
 -
 The easiest way to run tests is to say "make test", (or simply run the
diff --git a/test/test-lib-FREEBSD.sh b/test/test-lib-FREEBSD.sh
new file mode 100644
index ..09242362
--- /dev/null
+++ b/test/test-lib-FREEBSD.sh
@@ -0,0 +1,7 @@
+# Use GNU Coreutils instead of a native BSD utils
+
+date () { gdate "$@"; }
+base64 () { gbase64 "$@"; }
+wc () { gwc "$@"; }
+sed () { gsed "$@"; }
+sha256sum () { gsha256sum "$@"; }
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index 03ef1d2d..1c8d7f6e 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -66,6 +66,11 @@ export LD_LIBRARY_PATH
 # configure output
 . $notmuch_path/sh.config || exit 1
 
+# load OS specifics
+if [ -e ./test-lib-$PLATFORM.sh ]; then
+   . ./test-lib-$PLATFORM.sh
+fi
+
 if test -n "$valgrind"
 then
make_symlink () {
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: allow user to choose which gdb to run tests with

2017-01-08 Thread David Bremner
Tomi Ollila  writes:

> The variable used for selecting gdb is TEST_GDB, consistent with
> TEST_CC and TEST_EMACS{,CLIENT}.

pushed this patch to master.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch