unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* T070 tests portability
@ 2016-01-05 10:55 J Farkas
  2016-01-05 20:58 ` Tomi Ollila
  0 siblings, 1 reply; 6+ messages in thread
From: J Farkas @ 2016-01-05 10:55 UTC (permalink / raw)
  To: notmuch

I'm in the process of writing insert tests, but it looks like my
environment is somewhat older than what the current tests are running
on.  The following two trivial changes for the original tests make those
pass cleanly:

The wc I have from GNU textutils 2.0.22 seems to produce extra
whitespace that needs to be cleaned:

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index e7ec6a6..5864b9b 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -62,3 +62,3 @@ test_begin_subtest "Insert duplicate message"
 notmuch insert +duptag -unread < "$gen_msg_filename"
-output=$(notmuch search --output=files "subject:insert-subject" | wc -l)
+output=$(notmuch search --output=files "subject:insert-subject" | echo $(wc -l))
 test_expect_equal "$output" 2

And without the following cast, gdb 7.4 complains about the return type.

    index-file-XAPIAN_EXCEPTION.gdb:7: Error in sourced command file:
    Return value type not available for selected stack frame.
    Please use an explicit cast of the value to return.

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index e7ec6a6..5864b9b 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -196,3 +196,3 @@ break notmuch_database_add_message
 commands
-return NOTMUCH_STATUS_$code
+return (int)NOTMUCH_STATUS_$code
 continue

Does any of the above look reasonable to reduce the false positives?
With the above, the T070 tests all pass on my system.

Janos

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: T070 tests portability
  2016-01-05 10:55 T070 tests portability J Farkas
@ 2016-01-05 20:58 ` Tomi Ollila
  2016-01-05 21:41   ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Tomi Ollila @ 2016-01-05 20:58 UTC (permalink / raw)
  To: J Farkas, notmuch

On Tue, Jan 05 2016, J Farkas <jf.hyqohaczlksw4tx6ae@l2015aftruuq.dns007.net> wrote:

> I'm in the process of writing insert tests, but it looks like my
> environment is somewhat older than what the current tests are running
> on.  The following two trivial changes for the original tests make those
> pass cleanly:
>
> The wc I have from GNU textutils 2.0.22 seems to produce extra
> whitespace that needs to be cleaned:
>
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index e7ec6a6..5864b9b 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -62,3 +62,3 @@ test_begin_subtest "Insert duplicate message"
>  notmuch insert +duptag -unread < "$gen_msg_filename"
> -output=$(notmuch search --output=files "subject:insert-subject" | wc -l)
> +output=$(notmuch search --output=files "subject:insert-subject" | echo $(wc -l))

For this we have found solution earlier, unfortunately this did not get it:

 output=$((`notmuch search --output=files "subject:insert-subject" | wc -l`))

$ fgrep '$((`' test/*.sh
test/T060-count.sh:    "$((`notmuch search --output=messages '*' | wc -l`))" \
test/T060-count.sh:    "$((`notmuch search --output=messages '*' | wc-l`))" \
test/T060-count.sh:    "$((`notmuch search --output=threads '*' | wc -l`))" \
test/T060-count.sh:    "$((`notmuch search '*' | wc -l`))" \
test/T060-count.sh:    "$((`notmuch search --output=files '*' | wc -l`))" \

i.e. arithmetic evaluation with just the number removes surrounding whitespace.

>  test_expect_equal "$output" 2
>
> And without the following cast, gdb 7.4 complains about the return type.
>
>     index-file-XAPIAN_EXCEPTION.gdb:7: Error in sourced command file:
>     Return value type not available for selected stack frame.
>     Please use an explicit cast of the value to return.
>
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index e7ec6a6..5864b9b 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -196,3 +196,3 @@ break notmuch_database_add_message
>  commands
> -return NOTMUCH_STATUS_$code
> +return (int)NOTMUCH_STATUS_$code
>  continue

The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html
talks something about gdb not knowing the return type if function
was compiled without debug info... well, is this is the reason,
perhaps we should allow testing w/o debug info compiled in.

> Does any of the above look reasonable to reduce the false positives?
> With the above, the T070 tests all pass on my system.

1st is to be changed to be consistent w/ other code, second may be good.


> Janos


Tomi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: T070 tests portability
  2016-01-05 20:58 ` Tomi Ollila
@ 2016-01-05 21:41   ` David Bremner
  2016-01-06 13:51     ` J Farkas
  0 siblings, 1 reply; 6+ messages in thread
From: David Bremner @ 2016-01-05 21:41 UTC (permalink / raw)
  To: Tomi Ollila, J Farkas, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html
> talks something about gdb not knowing the return type if function
> was compiled without debug info... well, is this is the reason,
> perhaps we should allow testing w/o debug info compiled in.

The test suite overall assumes debug info is present; T000-basic tests
for this.

d

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: T070 tests portability
  2016-01-05 21:41   ` David Bremner
@ 2016-01-06 13:51     ` J Farkas
  2016-01-07 21:50       ` Tomi Ollila
  0 siblings, 1 reply; 6+ messages in thread
From: J Farkas @ 2016-01-06 13:51 UTC (permalink / raw)
  To: David Bremner; +Cc: Tomi Ollila, notmuch

On 2016-01-05 at 17:41:06, David Bremner wrote:
> Tomi Ollila <tomi.ollila@iki.fi> writes:
> 
> > The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html
> > talks something about gdb not knowing the return type if function
> > was compiled without debug info... well, is this is the reason,
> > perhaps we should allow testing w/o debug info compiled in.
> 
> The test suite overall assumes debug info is present; T000-basic tests
> for this.

I'm not missing the debug infos (well, except for the thread library if I
understand correctly - and that affects a lot of other tests, but not this).
Perhaps it the version of gdb, but not any compilation flags that can be
changed for the notmuch tree.

Without the changes, I'm getting these two kind of errors (and as you can see,
the test for the debugging symbols passes too).

$ ./T000-basic.sh

T000-basic: Testing the test framework itself.
 PASS   success is reported like this
...
 PASS   PATH is set to build directory
 PASS   notmuch is compiled with debugging symbols
$ ./T070-insert.sh

T070-insert: Testing "notmuch insert"
 PASS   Insert zero-length file
...
 FAIL   Insert duplicate message
        --- T070-insert.6.expected      2016-01-06 13:31:01.644676102 +0000
        +++ T070-insert.6.output        2016-01-06 13:31:01.648675891 +0000
        @@ -1 +1 @@
        -2
        +      2
 PASS   Duplicate message does not change tags
 PASS   Insert message, add tag
...
 PASS   Tags starting with '-' in new.tags are forbidden
 PASS   Invalid tags set exit code
 FAIL   error exit when add_message returns OUT_OF_MEMORY
        --- T070-insert.26.expected     2016-01-06 13:31:06.940397013 +0000
        +++ T070-insert.26.output       2016-01-06 13:31:06.940397013 +0000
        @@ -1 +1 @@
        -1
        +255
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
index-file-OUT_OF_MEMORY.gdb:7: Error in sourced command file:
Return value type not available for selected stack frame.
Please use an explicit cast of the value to return.
 FAIL   success exit with --keep when add_message returns OUT_OF_MEMORY
...

(The above is then repeated for all gdb using `insert` tests.)

János

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: T070 tests portability
  2016-01-06 13:51     ` J Farkas
@ 2016-01-07 21:50       ` Tomi Ollila
  2016-01-08 19:23         ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Tomi Ollila @ 2016-01-07 21:50 UTC (permalink / raw)
  To: J Farkas, David Bremner; +Cc: notmuch

On Wed, Jan 06 2016, J Farkas <jf.hyqohaczlksw4tx6ae@l2015aftruuq.dns007.net> wrote:

> On 2016-01-05 at 17:41:06, David Bremner wrote:
>> Tomi Ollila <tomi.ollila@iki.fi> writes:
>> 
>> > The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html
>> > talks something about gdb not knowing the return type if function
>> > was compiled without debug info... well, is this is the reason,
>> > perhaps we should allow testing w/o debug info compiled in.
>> 
>> The test suite overall assumes debug info is present; T000-basic tests
>> for this.
>
> I'm not missing the debug infos (well, except for the thread library if I
> understand correctly - and that affects a lot of other tests, but not this).
> Perhaps it the version of gdb, but not any compilation flags that can be
> changed for the notmuch tree.
>
> Without the changes, I'm getting these two kind of errors (and as you can
> see, the test for the debugging symbols passes too).

ack... keep reading...

>
> $ ./T000-basic.sh
>
> T000-basic: Testing the test framework itself.
>  PASS   success is reported like this
> ...
>  PASS   PATH is set to build directory
>  PASS   notmuch is compiled with debugging symbols
> $ ./T070-insert.sh
>
> T070-insert: Testing "notmuch insert"
>  PASS   Insert zero-length file
> ...
>  FAIL   Insert duplicate message
>         --- T070-insert.6.expected      2016-01-06 13:31:01.644676102 +0000
>         +++ T070-insert.6.output        2016-01-06 13:31:01.648675891 +0000
>         @@ -1 +1 @@
>         -2
>         +      2

This is trivial to fix w/ the same

output=$((`notmuch search --output=files "subject:insert-subject" | wc -l`))

construct that is used in T060-count.sh

A separate patch doing just this would be appreciated.

>  PASS   Duplicate message does not change tags
>  PASS   Insert message, add tag
> ...
>  PASS   Tags starting with '-' in new.tags are forbidden
>  PASS   Invalid tags set exit code
>  FAIL   error exit when add_message returns OUT_OF_MEMORY
>         --- T070-insert.26.expected     2016-01-06 13:31:06.940397013 +0000
>         +++ T070-insert.26.output       2016-01-06 13:31:06.940397013 +0000
>         @@ -1 +1 @@
>         -1
>         +255
> warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
> index-file-OUT_OF_MEMORY.gdb:7: Error in sourced command file:
> Return value type not available for selected stack frame.
> Please use an explicit cast of the value to return.
>  FAIL   success exit with --keep when add_message returns OUT_OF_MEMORY

Your setup is interesting -- you have GNU textutils 2.0.22, released
2002-07-20 (i.e. 13.5 years ago) and then gdb 7.4. I just run this
test file on Scientific Linux 6.2 (gcc 4.4.6 and gdb 7.2), and the
tests passed without problems.

Apart from a few special cases, no typecasts should be added lightly
to the code -- be it at innocent-looking as it can be. Those impedes
the possibility for compiler (etc.) to do type checking.

So, in this case, if you're the only one seeing this problem I'd suggest
you tolerate the problem (by using private patch) (you could also dig
deeper if interested). If this "problem" is (were!) more widespread,
*and* unfixable in reasonable manner this thing like this typecast
could be applied -- which would also mean this test system would
be a bit less robust as it is now...(*)


Tomi

(*) imo these are hard facts, but someone(tm) may consider these as mere
opinions...


> ...
>
> (The above is then repeated for all gdb using `insert` tests.)
>
> János

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: T070 tests portability
  2016-01-07 21:50       ` Tomi Ollila
@ 2016-01-08 19:23         ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2016-01-08 19:23 UTC (permalink / raw)
  To: Tomi Ollila, J Farkas; +Cc: notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> So, in this case, if you're the only one seeing this problem I'd suggest
> you tolerate the problem (by using private patch) (you could also dig
> deeper if interested). If this "problem" is (were!) more widespread,
> *and* unfixable in reasonable manner this thing like this typecast
> could be applied -- which would also mean this test system would
> be a bit less robust as it is now...(*)

I'm a bit undecided about this. But one (not completely trivial but
probably a good idea) would be to rewrite these tests to use the python
extensions to gdb. These have shown themselves to be more robust and
portable between different gdb versions. We already use these extensions
(in T380-atomicity.py) so it wouldn't be adding a new dependency.

d

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-08 19:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-05 10:55 T070 tests portability J Farkas
2016-01-05 20:58 ` Tomi Ollila
2016-01-05 21:41   ` David Bremner
2016-01-06 13:51     ` J Farkas
2016-01-07 21:50       ` Tomi Ollila
2016-01-08 19:23         ` 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).