Bug 197599 - devel/librest: does not pass the tests
Summary: devel/librest: does not pass the tests
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords: patch
Depends on:
Blocks: 197530
  Show dependency treegraph
 
Reported: 2015-02-13 20:09 UTC by Thierry Thomas
Modified: 2015-02-24 21:12 UTC (History)
2 users (show)

See Also:
cmt: maintainer-feedback+


Attachments
Patch to add the regression-test target. (781 bytes, patch)
2015-02-13 20:09 UTC, Thierry Thomas
no flags Details | Diff
Results of the tests (1.49 KB, text/x-log)
2015-02-13 20:10 UTC, Thierry Thomas
no flags Details
test-suite.log (518 bytes, text/x-log)
2015-02-17 23:23 UTC, Carlos J Puga Medina
no flags Details
fix coredump in oauth, enable regression tests (2.62 KB, patch)
2015-02-24 00:31 UTC, Christoph Moench-Tegeder
cmt: maintainer-approval+
Details | Diff
Results of the tests with the fix (722 bytes, patch)
2015-02-24 21:08 UTC, Thierry Thomas
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Thomas freebsd_committer freebsd_triage 2015-02-13 20:09:21 UTC
Created attachment 152945 [details]
Patch to add the regression-test target.

I'm working on a new port (Corebird), using librest, and it segfaults, probably caused by a problem in librest
(See bug report at https://github.com/baedert/corebird/issues/310 ).

To investigate the problem, I added a regression-test target in the port (see attached patch), and running it produces several errors:

$ make regression-test

gmake[1]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake  proxy proxy-continuous threaded oauth oauth-async oauth2 flickr lastfm xml custom-serialize
gmake[2]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake[2]: 'proxy' is up to date.
gmake[2]: 'proxy-continuous' is up to date.
gmake[2]: 'threaded' is up to date.
gmake[2]: 'oauth' is up to date.
gmake[2]: 'oauth-async' is up to date.
gmake[2]: 'oauth2' is up to date.
gmake[2]: 'flickr' is up to date.
gmake[2]: 'lastfm' is up to date.
gmake[2]: 'xml' is up to date.
gmake[2]: 'custom-serialize' is up to date.
gmake[2]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake  check-TESTS
gmake[2]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake[3]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
PASS: proxy
PASS: proxy-continuous
FAIL: threaded
Segmentation fault (core dumped)
FAIL: oauth
Segmentation fault (core dumped)
FAIL: oauth-async
PASS: oauth2
PASS: flickr
PASS: lastfm
Trace/BPT trap (core dumped)
XFAIL: xml
Segmentation fault (core dumped)
FAIL: custom-serialize
gmake[4]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake[4]: Nothing to be done for 'all'.
gmake[4]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
============================================================================
Testsuite summary for rest 0.7.92
============================================================================
# TOTAL: 10
# PASS:  5
# SKIP:  0
# XFAIL: 1
# FAIL:  4
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
============================================================================
Makefile:769: recipe for target 'test-suite.log' failed
gmake[3]: *** [test-suite.log] Error 1
gmake[3]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
Makefile:875: recipe for target 'check-TESTS' failed
gmake[2]: *** [check-TESTS] Error 2
gmake[2]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
Makefile:1011: recipe for target 'check-am' failed
gmake[1]: *** [check-am] Error 2
gmake[1]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
*** Error code 2

The file test-suite.log is also attached.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-02-13 20:09:21 UTC
Maintainer CC'd
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2015-02-13 20:10:44 UTC
Created attachment 152946 [details]
Results of the tests
Comment 3 Carlos J Puga Medina 2015-02-16 01:26:46 UTC
Thierry, 

The problem seems related with this bug reported on Debian [1]. 

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765107
Comment 4 Carlos J Puga Medina 2015-02-17 23:23:34 UTC
Created attachment 153126 [details]
test-suite.log

After applied the patch included at [1], it passed the tests.
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2015-02-18 22:25:56 UTC
(In reply to Carlos Jacobo Puga Medina from comment #4)

I've just applied this patch:
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=25;filename=02_thread-tests-sleep-for-server-to-start.patch;att=1;bug=765107

and it still fails on oauth and oauth-async:

gmake  check-TESTS
gmake[2]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake[3]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
PASS: proxy
PASS: proxy-continuous
PASS: threaded
Segmentation fault (core dumped)
FAIL: oauth
Segmentation fault (core dumped)
FAIL: oauth-async
PASS: oauth2
PASS: flickr
PASS: lastfm
Trace/BPT trap (core dumped)
XFAIL: xml
PASS: custom-serialize
gmake[4]: Entering directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
gmake[4]: Nothing to be done for 'all'.
gmake[4]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
============================================================================
Testsuite summary for rest 0.7.92
============================================================================
# TOTAL: 10
# PASS:  7
# SKIP:  0
# XFAIL: 1
# FAIL:  2
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
============================================================================
Makefile:769: recipe for target 'test-suite.log' failed
gmake[3]: *** [test-suite.log] Error 1
gmake[3]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
Makefile:875: recipe for target 'check-TESTS' failed
gmake[2]: *** [check-TESTS] Error 2
gmake[2]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
Makefile:1011: recipe for target 'check-am' failed
gmake[1]: *** [check-am] Error 2
gmake[1]: Leaving directory '/usr/ports/devel/librest/work/rest-0.7.92/tests'
*** Error code 2

Unfortunately, oauth is the function used by Corebird.

Note: I'm testing on 10.1-STABLE / amd64.
Comment 6 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2015-02-24 00:26:42 UTC
The "oauth" test dumps core like this:

(gdb) bt
#0  0x0000000801931a90 in g_string_append_uri_escaped ()
   from /usr/local/lib/libglib-2.0.so.0
#1  0x0000000800831911 in sign_hmac (proxy=0x80642c0b0, call=0x80923a0b0, 
    oauth_params=0x809148de0) at oauth-proxy-call.c:149
#2  0x0000000800831476 in _prepare (call=0x80923a0b0, error=0x7fffffffd870)
    at oauth-proxy-call.c:292
#3  0x000000080082aee7 in prepare_message (call=0x80923a0b0, 
    error_out=0x7fffffffd970) at rest-proxy-call.c:830

and:
149         g_string_append_uri_escaped (text, url_str, NULL, FALSE);
(gdb) print url_str
$1 = 0x664e580 <error: Cannot access memory at address 0x664e580>

Lo and behold, there was a warning on the assignment to just that url_str:
oauth-proxy-call.c:130:11: warning: incompatible integer to pointer conversion
      assigning to 'const char *' from 'int' [-Wint-conversion]
  url_str = rest_proxy_call_get_url (call);

which explains the garbage address in url_str.
And for real, upstream fixed that bug without realising it's impact:
https://git.gnome.org/browse/librest/commit/?id=b50ace7738ea03817acdad87fb2b338a86018329
Comment 7 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2015-02-24 00:31:52 UTC
Created attachment 153405 [details]
fix coredump in oauth, enable regression tests

svn info:

M       Makefile
A       files
A       files/patch-rest_oauth-proxy-call.c
A       files/patch-tests_custom-serialize.c
A       files/patch-tests_threaded.c

Committer: please note added files.

This patch enables the regression-tests, fixes the race conditions (no functionality impact) in two tests (as proposed by reporter) and the crash in the oauth functions (patch obtained from https://git.gnome.org/browse/librest/commit/?id=b50ace7738ea03817acdad87fb2b338a86018329). I'm incrementing PORTREVISION (code change).
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2015-02-24 21:08:37 UTC
Created attachment 153473 [details]
Results of the tests with the fix

With this patch, there is still a problem:

Trace/BPT trap (core dumped)
XFAIL: xml

But anyway, oauth is fixed, and that was the blocking case for Corebird.
Comment 9 Thierry Thomas freebsd_committer freebsd_triage 2015-02-24 21:11:45 UTC
Committed, thanks!
Comment 10 commit-hook freebsd_committer freebsd_triage 2015-02-24 21:12:36 UTC
A commit references this bug:

Author: thierry
Date: Tue Feb 24 21:11:43 UTC 2015
New revision: 379839
URL: https://svnweb.freebsd.org/changeset/ports/379839

Log:
  - Add a regression-test target

  - Fix an error for Oauth and bump PORTREVISION.

  PR:		ports/197599
  Submitted by:	cmt (at) burggraben.net (maintainer)
  Obtained from:	upstream

Changes:
  head/devel/librest/Makefile
  head/devel/librest/files/
  head/devel/librest/files/patch-rest_oauth-proxy-call.c
  head/devel/librest/files/patch-tests_custom-serialize.c
  head/devel/librest/files/patch-tests_threaded.c