2006-02-09 06:46:49 +01:00
|
|
|
# Copyright (c) 2001-2004, Roger Dingledine
|
2008-02-07 06:31:47 +01:00
|
|
|
# Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
|
2017-03-15 21:13:17 +01:00
|
|
|
# Copyright (c) 2007-2017, The Tor Project, Inc.
|
2005-04-01 22:15:56 +02:00
|
|
|
# See LICENSE for licensing information
|
|
|
|
|
2013-02-07 22:23:48 +01:00
|
|
|
ACLOCAL_AMFLAGS = -I m4
|
|
|
|
|
2012-08-02 15:31:43 +02:00
|
|
|
noinst_LIBRARIES=
|
|
|
|
EXTRA_DIST=
|
|
|
|
noinst_HEADERS=
|
|
|
|
bin_PROGRAMS=
|
2016-12-14 01:15:26 +01:00
|
|
|
EXTRA_PROGRAMS=
|
2012-08-02 15:31:43 +02:00
|
|
|
CLEANFILES=
|
|
|
|
TESTS=
|
|
|
|
noinst_PROGRAMS=
|
|
|
|
DISTCLEANFILES=
|
|
|
|
bin_SCRIPTS=
|
2012-08-27 16:00:22 +02:00
|
|
|
AM_CPPFLAGS=
|
2017-04-18 17:54:59 +02:00
|
|
|
AM_CFLAGS=@TOR_SYSTEMD_CFLAGS@ @CFLAGS_BUGTRAP@ @TOR_LZMA_CFLAGS@ @TOR_ZSTD_CFLAGS@
|
2016-04-13 00:59:40 +02:00
|
|
|
SHELL=@SHELL@
|
2015-09-25 16:39:11 +02:00
|
|
|
|
|
|
|
if COVERAGE_ENABLED
|
2016-04-05 17:47:37 +02:00
|
|
|
TESTING_TOR_BINARY=$(top_builddir)/src/or/tor-cov$(EXEEXT)
|
2015-09-25 16:39:11 +02:00
|
|
|
else
|
2016-04-05 17:47:37 +02:00
|
|
|
TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT)
|
2015-09-25 16:39:11 +02:00
|
|
|
endif
|
|
|
|
|
2012-08-02 15:31:43 +02:00
|
|
|
include src/include.am
|
|
|
|
include doc/include.am
|
|
|
|
include contrib/include.am
|
2002-06-29 01:26:42 +02:00
|
|
|
|
2012-08-02 15:31:43 +02:00
|
|
|
EXTRA_DIST+= \
|
2010-11-11 20:22:48 +01:00
|
|
|
ChangeLog \
|
|
|
|
INSTALL \
|
|
|
|
LICENSE \
|
2011-08-01 18:36:59 +02:00
|
|
|
Makefile.nmake \
|
2010-11-11 20:22:48 +01:00
|
|
|
README \
|
2016-12-19 19:03:39 +01:00
|
|
|
ReleaseNotes \
|
|
|
|
scripts/maint/checkSpace.pl
|
2002-07-22 06:07:34 +02:00
|
|
|
|
2016-10-03 19:58:09 +02:00
|
|
|
## This tells etags how to find mockable function definitions.
|
|
|
|
AM_ETAGSFLAGS=--regex='{c}/MOCK_IMPL([^,]+,\W*\([a-zA-Z0-9_]+\)\W*,/\1/s'
|
|
|
|
|
2013-07-09 18:37:11 +02:00
|
|
|
if COVERAGE_ENABLED
|
|
|
|
TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
|
2016-02-05 14:40:07 +01:00
|
|
|
if DISABLE_ASSERTS_IN_UNIT_TESTS
|
|
|
|
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE -DDISABLE_ASSERTS_IN_UNIT_TESTS
|
|
|
|
else
|
2015-03-20 13:12:09 +01:00
|
|
|
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE
|
2016-02-05 14:40:07 +01:00
|
|
|
endif
|
2015-09-08 14:27:59 +02:00
|
|
|
TEST_NETWORK_FLAGS=--coverage --hs-multi-client 1
|
2013-07-09 18:37:11 +02:00
|
|
|
else
|
|
|
|
TEST_CFLAGS=
|
2015-03-20 13:12:09 +01:00
|
|
|
TEST_CPPFLAGS=-DTOR_UNIT_TESTS
|
2015-09-08 14:27:59 +02:00
|
|
|
TEST_NETWORK_FLAGS=--hs-multi-client 1
|
2013-07-09 18:37:11 +02:00
|
|
|
endif
|
2017-02-27 15:46:16 +01:00
|
|
|
TEST_NETWORK_WARNING_FLAGS=--quiet --only-warnings
|
2013-07-09 18:37:11 +02:00
|
|
|
|
2016-12-19 21:17:42 +01:00
|
|
|
if LIBFUZZER_ENABLED
|
2017-01-09 16:44:55 +01:00
|
|
|
TEST_CFLAGS += -fsanitize-coverage=trace-pc-guard,trace-cmp,trace-div
|
|
|
|
# not "edge"
|
2016-12-19 21:17:42 +01:00
|
|
|
endif
|
|
|
|
|
2015-09-08 14:27:59 +02:00
|
|
|
TEST_NETWORK_ALL_LOG_DIR=$(top_builddir)/test_network_log
|
|
|
|
TEST_NETWORK_ALL_DRIVER_FLAGS=--color-tests yes
|
|
|
|
|
2003-10-22 06:33:11 +02:00
|
|
|
#install-data-local:
|
|
|
|
# $(INSTALL) -m 755 -d $(LOCALSTATEDIR)/lib/tor
|
2004-03-02 20:09:30 +01:00
|
|
|
|
2012-06-16 18:38:14 +02:00
|
|
|
# Allows to override rpmbuild with rpmbuild-md5 from fedora-packager so that
|
|
|
|
# building for EL5 won't fail on https://bugzilla.redhat.com/show_bug.cgi?id=490613
|
|
|
|
RPMBUILD ?= rpmbuild
|
|
|
|
|
2012-06-15 23:59:35 +02:00
|
|
|
# Use automake's dist-gzip target to build the tarball
|
|
|
|
dist-rpm: dist-gzip
|
|
|
|
TIMESTAMP=$$(date +"%Y-%m-%d_%H.%M.%S"); \
|
|
|
|
RPM_BUILD_DIR=$$(mktemp -d "/tmp/tor-rpm-build-$$TIMESTAMP-XXXX"); \
|
|
|
|
mkdir -p "$$RPM_BUILD_DIR"/{BUILD,RPMS,SOURCES/"tor-$(VERSION)",SPECS,SRPMS}; \
|
|
|
|
cp -fa "$(distdir).tar.gz" "$$RPM_BUILD_DIR"/SOURCES/; \
|
2012-06-16 18:38:14 +02:00
|
|
|
LIBS=-lrt $(RPMBUILD) -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; \
|
2012-06-15 23:59:35 +02:00
|
|
|
cp -fa "$$RPM_BUILD_DIR"/SRPMS/* .; \
|
|
|
|
cp -fa "$$RPM_BUILD_DIR"/RPMS/* .; \
|
|
|
|
rm -rf "$$RPM_BUILD_DIR"; \
|
|
|
|
echo "RPM build finished"; \
|
|
|
|
#end of dist-rpm
|
2004-05-07 19:03:52 +02:00
|
|
|
|
|
|
|
doxygen:
|
2004-11-04 16:17:22 +01:00
|
|
|
doxygen && cd doc/doxygen/latex && make
|
2004-11-09 21:04:00 +01:00
|
|
|
|
2009-09-22 19:57:00 +02:00
|
|
|
test: all
|
2015-02-17 15:36:10 +01:00
|
|
|
$(top_builddir)/src/test/test
|
2006-10-08 05:17:24 +02:00
|
|
|
|
2016-12-15 13:06:01 +01:00
|
|
|
check-local: check-spaces
|
|
|
|
|
2015-08-03 19:03:58 +02:00
|
|
|
need-chutney-path:
|
|
|
|
@if test ! -d "$$CHUTNEY_PATH"; then \
|
2015-08-27 02:31:35 +02:00
|
|
|
echo '$$CHUTNEY_PATH was not set.'; \
|
|
|
|
if test -d $(top_srcdir)/../chutney -a -x $(top_srcdir)/../chutney/chutney; then \
|
|
|
|
echo "Assuming test-network.sh will find" $(top_srcdir)/../chutney; \
|
|
|
|
else \
|
|
|
|
echo; \
|
|
|
|
echo "To run these tests, git clone https://git.torproject.org/chutney.git ; export CHUTNEY_PATH=\`pwd\`/chutney"; \
|
|
|
|
exit 1; \
|
|
|
|
fi \
|
2015-08-03 19:03:58 +02:00
|
|
|
fi
|
|
|
|
|
2013-06-05 15:48:57 +02:00
|
|
|
# Note that test-network requires a copy of Chutney in $CHUTNEY_PATH.
|
|
|
|
# Chutney can be cloned from https://git.torproject.org/chutney.git .
|
2016-04-05 17:47:37 +02:00
|
|
|
test-network: need-chutney-path $(TESTING_TOR_BINARY) src/tools/tor-gencert
|
2015-08-03 19:23:58 +02:00
|
|
|
$(top_srcdir)/src/test/test-network.sh $(TEST_NETWORK_FLAGS)
|
2013-06-05 15:48:57 +02:00
|
|
|
|
2015-09-08 14:27:59 +02:00
|
|
|
# Run all available tests using automake's test-driver
|
|
|
|
# only run IPv6 tests if we can ping6 ::1 (localhost)
|
|
|
|
# some IPv6 tests will fail without an IPv6 DNS server (see #16971 and #17011)
|
|
|
|
# only run mixed tests if we have a tor-stable binary
|
2016-08-31 07:22:34 +02:00
|
|
|
# Try both the BSD and the Linux ping6 syntax, because they're incompatible
|
2016-04-05 17:47:37 +02:00
|
|
|
test-network-all: need-chutney-path test-driver $(TESTING_TOR_BINARY) src/tools/tor-gencert
|
2015-09-08 14:27:59 +02:00
|
|
|
mkdir -p $(TEST_NETWORK_ALL_LOG_DIR)
|
|
|
|
@flavors="$(TEST_CHUTNEY_FLAVORS)"; \
|
2016-08-31 07:22:34 +02:00
|
|
|
if ping6 -q -c 1 -o ::1 >/dev/null 2>&1 || ping6 -q -c 1 -W 1 ::1 >/dev/null 2>&1; then \
|
2015-09-08 14:27:59 +02:00
|
|
|
echo "ping6 ::1 succeeded, running IPv6 flavors: $(TEST_CHUTNEY_FLAVORS_IPV6)."; \
|
|
|
|
flavors="$$flavors $(TEST_CHUTNEY_FLAVORS_IPV6)"; \
|
|
|
|
else \
|
|
|
|
echo "ping6 ::1 failed, skipping IPv6 flavors: $(TEST_CHUTNEY_FLAVORS_IPV6)."; \
|
|
|
|
skip_flavors="$$skip_flavors $(TEST_CHUTNEY_FLAVORS_IPV6)"; \
|
|
|
|
fi; \
|
|
|
|
if command -v tor-stable >/dev/null 2>&1; then \
|
|
|
|
echo "tor-stable found, running mixed flavors: $(TEST_CHUTNEY_FLAVORS_MIXED)."; \
|
|
|
|
flavors="$$flavors $(TEST_CHUTNEY_FLAVORS_MIXED)"; \
|
|
|
|
else \
|
|
|
|
echo "tor-stable not found, skipping mixed flavors: $(TEST_CHUTNEY_FLAVORS_MIXED)."; \
|
|
|
|
skip_flavors="$$skip_flavors $(TEST_CHUTNEY_FLAVORS_MIXED)"; \
|
|
|
|
fi; \
|
|
|
|
for f in $$skip_flavors; do \
|
|
|
|
echo "SKIP: $$f"; \
|
|
|
|
done; \
|
|
|
|
for f in $$flavors; do \
|
2016-06-16 14:16:57 +02:00
|
|
|
$(SHELL) $(top_srcdir)/test-driver --test-name $$f --log-file $(TEST_NETWORK_ALL_LOG_DIR)/$$f.log --trs-file $(TEST_NETWORK_ALL_LOG_DIR)/$$f.trs $(TEST_NETWORK_ALL_DRIVER_FLAGS) $(top_srcdir)/src/test/test-network.sh --flavor $$f $(TEST_NETWORK_FLAGS); \
|
2017-02-27 15:46:16 +01:00
|
|
|
$(top_srcdir)/src/test/test-network.sh $(TEST_NETWORK_WARNING_FLAGS); \
|
2015-09-08 19:06:01 +02:00
|
|
|
done; \
|
|
|
|
echo "Log and result files are available in $(TEST_NETWORK_ALL_LOG_DIR)."; \
|
|
|
|
! grep -q FAIL test_network_log/*.trs
|
2015-09-08 14:27:59 +02:00
|
|
|
|
2015-08-03 19:03:58 +02:00
|
|
|
need-stem-path:
|
|
|
|
@if test ! -d "$$STEM_SOURCE_DIR"; then \
|
2015-01-05 17:52:36 +01:00
|
|
|
echo '$$STEM_SOURCE_DIR was not set.'; echo; \
|
|
|
|
echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \
|
2015-08-03 19:03:58 +02:00
|
|
|
exit 1; \
|
2015-01-05 17:52:36 +01:00
|
|
|
fi
|
|
|
|
|
2016-04-05 17:47:37 +02:00
|
|
|
test-stem: need-stem-path $(TESTING_TOR_BINARY)
|
|
|
|
@$(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor "$(TESTING_TOR_BINARY)" --all --log notice --target RUN_ALL;
|
2015-08-03 19:03:58 +02:00
|
|
|
|
2016-04-05 17:47:37 +02:00
|
|
|
test-stem-full: need-stem-path $(TESTING_TOR_BINARY)
|
|
|
|
@$(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor "$(TESTING_TOR_BINARY)" --all --log notice --target RUN_ALL,ONLINE -v;
|
2015-08-03 19:03:58 +02:00
|
|
|
|
|
|
|
test-full: need-stem-path need-chutney-path check test-network test-stem
|
|
|
|
|
|
|
|
test-full-online: need-stem-path need-chutney-path check test-network test-stem-full
|
2015-01-05 17:52:36 +01:00
|
|
|
|
2013-07-16 07:33:39 +02:00
|
|
|
reset-gcov:
|
2015-02-17 15:36:10 +01:00
|
|
|
rm -f $(top_builddir)/src/*/*.gcda $(top_builddir)/src/*/*/*.gcda
|
2013-07-16 07:33:39 +02:00
|
|
|
|
2015-02-17 15:36:10 +01:00
|
|
|
HTML_COVER_DIR=$(top_builddir)/coverage_html
|
2014-07-09 10:37:32 +02:00
|
|
|
coverage-html: all
|
2015-03-05 15:48:47 +01:00
|
|
|
if COVERAGE_ENABLED
|
2014-07-16 12:01:18 +02:00
|
|
|
test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
|
2015-02-17 15:36:10 +01:00
|
|
|
test -d "$(HTML_COVER_DIR)" || $(MKDIR_P) "$(HTML_COVER_DIR)"
|
|
|
|
lcov --rc lcov_branch_coverage=1 --directory $(top_builddir)/src --zerocounters
|
2014-07-16 12:01:18 +02:00
|
|
|
$(MAKE) reset-gcov
|
|
|
|
$(MAKE) check
|
2015-02-17 15:36:10 +01:00
|
|
|
lcov --capture --rc lcov_branch_coverage=1 --no-external --directory $(top_builddir) --base-directory $(top_srcdir) --output-file "$(HTML_COVER_DIR)/lcov.tmp"
|
2014-07-09 10:37:32 +02:00
|
|
|
lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
|
|
|
|
genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
|
2015-03-05 15:48:47 +01:00
|
|
|
else
|
|
|
|
@printf "Not configured with --enable-coverage, run ./configure --enable-coverage\n"
|
|
|
|
endif
|
2014-07-09 10:37:32 +02:00
|
|
|
|
2015-03-20 13:12:09 +01:00
|
|
|
coverage-html-full: all
|
|
|
|
test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
|
|
|
|
test -d "$(HTML_COVER_DIR)" || mkdir -p "$(HTML_COVER_DIR)"
|
|
|
|
lcov --rc lcov_branch_coverage=1 --directory ./src --zerocounters
|
|
|
|
$(MAKE) reset-gcov
|
|
|
|
$(MAKE) check
|
|
|
|
$(MAKE) test-stem-full
|
2015-03-22 04:22:04 +01:00
|
|
|
CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh
|
|
|
|
CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh --flavor hs
|
2015-03-20 13:12:09 +01:00
|
|
|
lcov --capture --rc lcov_branch_coverage=1 --no-external --directory . --output-file "$(HTML_COVER_DIR)/lcov.tmp"
|
|
|
|
lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
|
|
|
|
genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
|
|
|
|
|
2009-10-17 15:12:40 +02:00
|
|
|
# Avoid strlcpy.c, strlcat.c, aes.c, OpenBSD_malloc_Linux.c, sha256.c,
|
2016-07-03 19:42:36 +02:00
|
|
|
# tinytest*.[ch]
|
2004-11-09 21:04:00 +01:00
|
|
|
check-spaces:
|
2016-12-15 13:02:42 +01:00
|
|
|
if USE_PERL
|
|
|
|
$(PERL) $(top_srcdir)/scripts/maint/checkSpace.pl -C \
|
2015-02-17 15:36:10 +01:00
|
|
|
$(top_srcdir)/src/common/*.[ch] \
|
|
|
|
$(top_srcdir)/src/or/*.[ch] \
|
|
|
|
$(top_srcdir)/src/test/*.[ch] \
|
2016-12-14 23:11:26 +01:00
|
|
|
$(top_srcdir)/src/test/*/*.[ch] \
|
2015-08-20 20:33:38 +02:00
|
|
|
$(top_srcdir)/src/tools/*.[ch]
|
2016-12-15 13:02:42 +01:00
|
|
|
endif
|
2004-11-09 21:04:00 +01:00
|
|
|
|
2015-03-11 10:47:13 +01:00
|
|
|
check-docs: all
|
|
|
|
$(PERL) $(top_builddir)/scripts/maint/checkOptionDocs.pl
|
2006-12-20 18:05:48 +01:00
|
|
|
|
2006-09-30 00:33:28 +02:00
|
|
|
check-logs:
|
2015-02-17 15:36:10 +01:00
|
|
|
$(top_srcdir)/scripts/maint/checkLogs.pl \
|
|
|
|
$(top_srcdir)/src/*/*.[ch] | sort -n
|
2006-10-08 05:17:24 +02:00
|
|
|
|
2015-03-06 11:56:57 +01:00
|
|
|
.PHONY: check-changes
|
|
|
|
check-changes:
|
|
|
|
@if test -d "$(top_srcdir)/changes"; then \
|
|
|
|
$(PYTHON) $(top_srcdir)/scripts/maint/lintChanges.py $(top_srcdir)/changes/*; \
|
|
|
|
fi
|
|
|
|
|
2015-03-12 09:28:41 +01:00
|
|
|
.PHONY: update-versions
|
|
|
|
update-versions:
|
|
|
|
$(PERL) $(top_builddir)/scripts/maint/updateVersions.pl
|
|
|
|
|
2011-11-25 05:53:18 +01:00
|
|
|
version:
|
|
|
|
@echo "Tor @VERSION@"
|
|
|
|
@if test -d "$(top_srcdir)/.git" && test -x "`which git 2>&1;true`"; then \
|
|
|
|
echo -n "git: " ;\
|
|
|
|
(cd "$(top_srcdir)" && git rev-parse --short=16 HEAD); \
|
|
|
|
fi
|
|
|
|
|
2013-07-09 18:37:11 +02:00
|
|
|
mostlyclean-local:
|
2015-02-17 15:36:10 +01:00
|
|
|
rm -f $(top_builddir)/src/*/*.gc{da,no} $(top_builddir)/src/*/*/*.gc{da,no}
|
|
|
|
rm -rf $(HTML_COVER_DIR)
|
|
|
|
rm -rf $(top_builddir)/doc/doxygen
|
2015-09-08 14:27:59 +02:00
|
|
|
rm -rf $(TEST_NETWORK_ALL_LOG_DIR)
|