From 5c95762ec6c8e43fe7bc5582fd43585076214ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Thu, 24 Sep 2015 22:32:51 +0000 Subject: [PATCH 1/5] Skip tests if backtrace support not compiled-in FreeBSD needs -lexecinfo to fully support backtrace reporting. --- src/test/test_bt.sh | 1 + src/test/test_bt_cl.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/test_bt.sh b/src/test/test_bt.sh index 56e6cc40f8..f55f451f92 100755 --- a/src/test/test_bt.sh +++ b/src/test/test_bt.sh @@ -3,6 +3,7 @@ exitcode=0 +"${builddir:-.}/src/test/test-bt-cl" backtraces || exit 77 "${builddir:-.}/src/test/test-bt-cl" assert | "${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/bt_test.py" || exitcode=1 "${builddir:-.}/src/test/test-bt-cl" crash | "${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/bt_test.py" || exitcode=1 diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c index 01c621eb0e..dabaee6e0a 100644 --- a/src/test/test_bt_cl.c +++ b/src/test/test_bt_cl.c @@ -84,15 +84,24 @@ main(int argc, char **argv) if (argc < 2) { puts("I take an argument. It should be \"assert\" or \"crash\" or " - "\"none\""); + "\"backtraces\" or \"none\""); return 1; } + +#if !(defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \ + defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)) + puts("Backtrace reporting is not supported on this platform"); + return 77; +#endif + if (!strcmp(argv[1], "assert")) { crashtype = 1; } else if (!strcmp(argv[1], "crash")) { crashtype = 0; } else if (!strcmp(argv[1], "none")) { crashtype = -1; + } else if (!strcmp(argv[1], "backtraces")) { + return 0; } else { puts("Argument should be \"assert\" or \"crash\" or \"none\""); return 1; From 00e15ba4772bb11c00e88f9e263966c856f1f275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Fri, 25 Sep 2015 00:59:59 +0000 Subject: [PATCH 2/5] FreeBSD needs -lexecinfo to get backtrace() --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index b190522cc1..24de46ec2f 100644 --- a/configure.ac +++ b/configure.ac @@ -360,6 +360,7 @@ AC_SEARCH_LIBS(socket, [socket network]) AC_SEARCH_LIBS(gethostbyname, [nsl]) AC_SEARCH_LIBS(dlopen, [dl]) AC_SEARCH_LIBS(inet_aton, [resolv]) +AC_SEARCH_LIBS(backtrace, [execinfo]) saved_LIBS="$LIBS" AC_SEARCH_LIBS([clock_gettime], [rt]) if test "$LIBS" != "$saved_LIBS"; then From 546d70dc7c5c2fd6687d3aaa0ff3c52c6c7dc4de Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 29 Sep 2015 10:08:02 +0200 Subject: [PATCH 3/5] Add changes file for bug17151 --- changes/bug17151 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changes/bug17151 diff --git a/changes/bug17151 b/changes/bug17151 new file mode 100644 index 0000000000..0993b90eac --- /dev/null +++ b/changes/bug17151 @@ -0,0 +1,7 @@ + o Minor bugfixes (portability): + - Use libexecinfo on FreeBSD, to enable backtrace support. Fixes part of + bug 17151; bugfix on 0.2.5.2-alpha. Patch from Marcin Cieślak. + + o Minor bugfixes (testing): + - Skip backtrace tests when backtrace support is not compiled in. Fixes + part of bug 17151; bugfix on 0.2.7.1-alpha. Patch from Marcin Cieślak. From f75325c132847883a7ddc5f0f6e55847edc68507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Fri, 25 Sep 2015 14:16:40 +0000 Subject: [PATCH 4/5] No spaces around = in variable assignment BSD make takes spaces around = literally and produces a "TESTING_TOR_BINARY " variable with a trailing space, which leads to test_keygen.sh failure. Fixes 17154 --- src/or/include.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/include.am b/src/or/include.am index 7b12b56eb1..d0e955f495 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -123,9 +123,9 @@ src_or_tor_cov_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \ src/common/libor-event-testing.a src/trunnel/libor-trunnel-testing.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ -export TESTING_TOR_BINARY = $(top_builddir)/src/or/tor-cov +export TESTING_TOR_BINARY=$(top_builddir)/src/or/tor-cov else -export TESTING_TOR_BINARY = $(top_builddir)/src/or/tor +export TESTING_TOR_BINARY=$(top_builddir)/src/or/tor endif ORHEADERS = \ From 216a9f7aecb19d717bed20557c2fd7d39333dba0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 29 Sep 2015 10:10:52 +0200 Subject: [PATCH 5/5] Changes file for bug17154 --- changes/bug17154 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changes/bug17154 diff --git a/changes/bug17154 b/changes/bug17154 new file mode 100644 index 0000000000..6ad7b74468 --- /dev/null +++ b/changes/bug17154 @@ -0,0 +1,3 @@ + o Minor bugfixes (testing): + - Fix breakage when running 'make check' with BSD make. Fixes bug + 17154; bugfix on 0.2.7.3-rc. Patch by Marcin Cieślak.