Opened 4 years ago

Closed 4 years ago

#17151 closed defect (fixed)

FreeBSD: fix test_bt failures

Reported by: saper Owned by:
Priority: Medium Milestone: Tor: 0.2.7.x-final
Component: Core Tor/Tor Version: Tor: 0.2.7.2-alpha
Severity: Keywords: build
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Backtrace analysis is not supported on FreeBSD unless linked with -lexecinfo

The test should be skipped if the functionality has not been detected by autoconf.

Child Tickets

Attachments (2)

0001-Skip-tests-if-backtrace-support-not-compiled-in.patch (1.8 KB) - added by saper 4 years ago.
Patch to skip the test if no backtrace compiled-in
0001-FreeBSD-needs-lexecinfo-to-get-backtrace.patch (711 bytes) - added by saper 4 years ago.
configure.ac: check if you need -lexecinfo to get backtrace()

Download all attachments as: .zip

Change History (10)

Changed 4 years ago by saper

Patch to skip the test if no backtrace compiled-in

comment:1 Changed 4 years ago by saper

While it it easy to add

AC_SEARCH_LIBS(backtrace, [execinfo])

to configure.ac, the tests still do not pass - the reason is probably compiler optimization
(tried with gcc5, clang3.4.1)

comment:2 Changed 4 years ago by saper

assert backtrace seems to be correct:

 ./src/test/test-bt-cl assert
Sep 25 00:02:12.516 [err] void tor_assertion_failed_(const char *, unsigned int, const char *, const char *): Bug: src/test/test_bt_cl.c:42: crash: Assertion 1 == 0 failed; aborting. (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug: Assertion 1 == 0 failed in crash at src/test/test_bt_cl.c:42. Stack trace: (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c5e8 <log_backtrace+0x48> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x1039a07 <tor_assertion_failed_+0x97> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c2fd <crash+0x6d> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c32f <oh_what+0x1f> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c37f <a_tangled_web+0x1f> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c3cf <we_weave+0x1f> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c512 <main+0x112> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)
Sep 25 00:02:12.517 [err] Bug:     0x102c1a1 <_start+0x1a1> at /home/saper/sw/tor/src/test/test-bt-cl (on Tor 0.2.7.3-rc 06cc9a9a2db2c32f)

But "crash" backtrace is truncated

============================================================ T= 1443139367
Tor  died: Caught signal 11
0x102c9dd <clean_up_backtrace_handler+0x8d> at /home/saper/sw/tor/src/test/test-bt-cl
0x8016a8997 <pthread_sigmask+0x497> at /lib/libthr.so.3
0x102c2b0 <crash+0x20> at /home/saper/sw/tor/src/test/test-bt-cl

Last edited 4 years ago by saper (previous) (diff)

Changed 4 years ago by saper

configure.ac: check if you need -lexecinfo to get backtrace()

comment:3 Changed 4 years ago by saper

It works ok for me if tor is compiled against libexecinfo-1.1 library from FreeBSD ports (http://www.freebsdsoftware.org/devel/libexecinfo.html) and not the NetBSD libexecinfo contained in the base system.

So with those two patches the support is enabled, I think that the Tor project needs not to worry about incompatibility of those libraries.

Last edited 4 years ago by saper (previous) (diff)

comment:4 Changed 4 years ago by saper

comment:5 Changed 4 years ago by nickm

Milestone: Tor: 0.2.???Tor: 0.2.7.x-final

comment:6 Changed 4 years ago by nickm

Status: newneeds_review

comment:7 Changed 4 years ago by nickm

These look correct! Merging.

comment:8 Changed 4 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged into maint-0.2.7

Note: See TracTickets for help on using tickets.