diff options
Diffstat (limited to 'src/test')
145 files changed, 276 insertions, 158 deletions
diff --git a/src/test/bench.c b/src/test/bench.c index 959d4374b1..06c616c3b0 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/bt_test.py b/src/test/bt_test.py index f8894aac0b..f9ca79efde 100755 --- a/src/test/bt_test.py +++ b/src/test/bt_test.py @@ -1,4 +1,4 @@ -# Copyright 2013-2018, The Tor Project, Inc +# Copyright 2013-2019, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/ed25519_exts_ref.py b/src/test/ed25519_exts_ref.py index a9090c9ed2..75562184b5 100644 --- a/src/test/ed25519_exts_ref.py +++ b/src/test/ed25519_exts_ref.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2014-2018, The Tor Project, Inc +# Copyright 2014-2019, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/fakechans.h b/src/test/fakechans.h index 0770be8e04..4006e1bec4 100644 --- a/src/test/fakechans.h +++ b/src/test/fakechans.h @@ -1,4 +1,4 @@ - /* Copyright (c) 2014-2018, The Tor Project, Inc. */ + /* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_FAKECHANS_H diff --git a/src/test/fuzz/dict/http b/src/test/fuzz/dict/http index 63627ac380..aa3dec990d 100644 --- a/src/test/fuzz/dict/http +++ b/src/test/fuzz/dict/http @@ -4,7 +4,7 @@ # # Extracted from directory_handle_command() in the tor source code # -# Copyright (c) 2016-2018, The Tor Project, Inc. +# Copyright (c) 2016-2019, The Tor Project, Inc. # See LICENSE for licensing information # # Usage: diff --git a/src/test/fuzz/fuzz_consensus.c b/src/test/fuzz/fuzz_consensus.c index b56702a650..5947a3f48c 100644 --- a/src/test/fuzz/fuzz_consensus.c +++ b/src/test/fuzz/fuzz_consensus.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define SIGCOMMON_PRIVATE #include "core/or/or.h" diff --git a/src/test/fuzz/fuzz_descriptor.c b/src/test/fuzz/fuzz_descriptor.c index 3420113717..58ee3dbc35 100644 --- a/src/test/fuzz/fuzz_descriptor.c +++ b/src/test/fuzz/fuzz_descriptor.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define SIGCOMMON_PRIVATE #include "core/or/or.h" diff --git a/src/test/fuzz/fuzz_diff.c b/src/test/fuzz/fuzz_diff.c index 1079856fdb..1bc60e50ee 100644 --- a/src/test/fuzz/fuzz_diff.c +++ b/src/test/fuzz/fuzz_diff.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONSDIFF_PRIVATE diff --git a/src/test/fuzz/fuzz_diff_apply.c b/src/test/fuzz/fuzz_diff_apply.c index 165d0e6126..9bd3cb0bf8 100644 --- a/src/test/fuzz/fuzz_diff_apply.c +++ b/src/test/fuzz/fuzz_diff_apply.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONSDIFF_PRIVATE diff --git a/src/test/fuzz/fuzz_extrainfo.c b/src/test/fuzz/fuzz_extrainfo.c index da0fe80838..f18bd68d65 100644 --- a/src/test/fuzz/fuzz_extrainfo.c +++ b/src/test/fuzz/fuzz_extrainfo.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define SIGCOMMON_PRIVATE #include "core/or/or.h" diff --git a/src/test/fuzz/fuzz_hsdescv2.c b/src/test/fuzz/fuzz_hsdescv2.c index 667b58b3aa..34639b237c 100644 --- a/src/test/fuzz/fuzz_hsdescv2.c +++ b/src/test/fuzz/fuzz_hsdescv2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" #include "feature/dirparse/unparseable.h" diff --git a/src/test/fuzz/fuzz_hsdescv3.c b/src/test/fuzz/fuzz_hsdescv3.c index d5ddcc2e27..2cbd655898 100644 --- a/src/test/fuzz/fuzz_hsdescv3.c +++ b/src/test/fuzz/fuzz_hsdescv3.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define HS_DESCRIPTOR_PRIVATE diff --git a/src/test/fuzz/fuzz_http.c b/src/test/fuzz/fuzz_http.c index 06483282bc..2798c47d23 100644 --- a/src/test/fuzz/fuzz_http.c +++ b/src/test/fuzz/fuzz_http.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/fuzz/fuzz_http_connect.c b/src/test/fuzz/fuzz_http_connect.c index ca007a2c7f..a60fc36804 100644 --- a/src/test/fuzz/fuzz_http_connect.c +++ b/src/test/fuzz/fuzz_http_connect.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/fuzz/fuzz_iptsv2.c b/src/test/fuzz/fuzz_iptsv2.c index 265677eebe..76fa3c164e 100644 --- a/src/test/fuzz/fuzz_iptsv2.c +++ b/src/test/fuzz/fuzz_iptsv2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/fuzz/fuzz_microdesc.c b/src/test/fuzz/fuzz_microdesc.c index ab54cf2a34..28fdc5e24d 100644 --- a/src/test/fuzz/fuzz_microdesc.c +++ b/src/test/fuzz/fuzz_microdesc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/fuzz/fuzz_socks.c b/src/test/fuzz/fuzz_socks.c index 14c25304b1..06cb08391e 100644 --- a/src/test/fuzz/fuzz_socks.c +++ b/src/test/fuzz/fuzz_socks.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/fuzz/fuzz_vrs.c b/src/test/fuzz/fuzz_vrs.c index 0b869aa5c0..967397d1af 100644 --- a/src/test/fuzz/fuzz_vrs.c +++ b/src/test/fuzz/fuzz_vrs.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define NS_PARSE_PRIVATE #define NETWORKSTATUS_PRIVATE diff --git a/src/test/fuzz/fuzzing.h b/src/test/fuzz/fuzzing.h index e90e5d58e0..150ac4aa7d 100644 --- a/src/test/fuzz/fuzzing.h +++ b/src/test/fuzz/fuzzing.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef FUZZING_H #define FUZZING_H diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c index 1401e4c28d..8ea4898522 100644 --- a/src/test/fuzz/fuzzing_common.c +++ b/src/test/fuzz/fuzzing_common.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CRYPTO_ED25519_PRIVATE #include "orconfig.h" diff --git a/src/test/fuzz_static_testcases.sh b/src/test/fuzz_static_testcases.sh index 138f85b106..f7b3adffb1 100755 --- a/src/test/fuzz_static_testcases.sh +++ b/src/test/fuzz_static_testcases.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016-2018, The Tor Project, Inc. +# Copyright (c) 2016-2019, The Tor Project, Inc. # See LICENSE for licensing information set -e diff --git a/src/test/hs_ntor_ref.py b/src/test/hs_ntor_ref.py index 0c5756ad73..1b9772a5d6 100644 --- a/src/test/hs_ntor_ref.py +++ b/src/test/hs_ntor_ref.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2017-2018, The Tor Project, Inc +# Copyright 2017-2019, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/hs_test_helpers.c b/src/test/hs_test_helpers.c index dcec1b9d48..f2ae8398df 100644 --- a/src/test/hs_test_helpers.c +++ b/src/test/hs_test_helpers.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/hs_test_helpers.h b/src/test/hs_test_helpers.h index b7c2714769..9662a83ba8 100644 --- a/src/test/hs_test_helpers.h +++ b/src/test/hs_test_helpers.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_HS_TEST_HELPERS_H diff --git a/src/test/log_test_helpers.c b/src/test/log_test_helpers.c index 2e91b1ecdc..03c52dd6bd 100644 --- a/src/test/log_test_helpers.c +++ b/src/test/log_test_helpers.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Tor Project, Inc. */ +/* Copyright (c) 2015-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define LOG_PRIVATE #include "lib/log/log.h" diff --git a/src/test/log_test_helpers.h b/src/test/log_test_helpers.h index 6a774cdfc7..5d1c3c1914 100644 --- a/src/test/log_test_helpers.h +++ b/src/test/log_test_helpers.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/ntor_ref.py b/src/test/ntor_ref.py index 56e97ece36..204f05e2ad 100755 --- a/src/test/ntor_ref.py +++ b/src/test/ntor_ref.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2012-2018, The Tor Project, Inc +# Copyright 2012-2019, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/ope_ref.py b/src/test/ope_ref.py index 3677e57a61..f9bd97c546 100644 --- a/src/test/ope_ref.py +++ b/src/test/ope_ref.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -# Copyright 2018, The Tor Project, Inc. See LICENSE for licensing info. +# Copyright 2018-2019, The Tor Project, Inc. See LICENSE for licensing info. # Reference implementation for our rudimentary OPE code, used to # generate test vectors. See crypto_ope.c for more details. diff --git a/src/test/rend_test_helpers.c b/src/test/rend_test_helpers.c index 85a679a967..f12d193cc5 100644 --- a/src/test/rend_test_helpers.c +++ b/src/test/rend_test_helpers.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/rend_test_helpers.h b/src/test/rend_test_helpers.h index 103e143ec6..c10da52cd7 100644 --- a/src/test/rend_test_helpers.h +++ b/src/test/rend_test_helpers.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test-child.c b/src/test/test-child.c index 14df1a9b76..11a1695cad 100644 --- a/src/test/test-child.c +++ b/src/test/test-child.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2018, The Tor Project, Inc. */ +/* Copyright (c) 2011-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c index c879013ed6..15e6a03d8a 100644 --- a/src/test/test-memwipe.c +++ b/src/test/test-memwipe.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Tor Project, Inc. */ +/* Copyright (c) 2015-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" @@ -12,6 +12,10 @@ #include <sys/types.h> #include <stdlib.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + static unsigned fill_a_buffer_memset(void) __attribute__((noinline)); static unsigned fill_a_buffer_memwipe(void) __attribute__((noinline)); static unsigned fill_a_buffer_nothing(void) __attribute__((noinline)); diff --git a/src/test/test-timers.c b/src/test/test-timers.c index 923f51ecce..c80fb1e305 100644 --- a/src/test/test-timers.c +++ b/src/test/test-timers.c @@ -1,4 +1,4 @@ -/* Copyright 2016-2018, The Tor Project, Inc. */ +/* Copyright 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test.c b/src/test/test.c index 70d91e3967..58b468775c 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test.h b/src/test/test.h index a46fedf3e0..aacc9dba87 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2003, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_TEST_H diff --git a/src/test/test_accounting.c b/src/test/test_accounting.c index 7721a9eb99..8ae8fe4343 100644 --- a/src/test/test_accounting.c +++ b/src/test/test_accounting.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_addr.c b/src/test/test_addr.c index a9004048a5..985f43b3fa 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ADDRESSMAP_PRIVATE diff --git a/src/test/test_address.c b/src/test/test_address.c index e99220f838..cfb32b855f 100644 --- a/src/test/test_address.c +++ b/src/test/test_address.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ADDRESS_PRIVATE @@ -1013,7 +1013,7 @@ test_address_get_if_addrs6(void *arg) (void)arg; - rv = get_interface_address6(LOG_ERR, AF_INET6, &tor_addr); + rv = get_interface_address6(LOG_WARN, AF_INET6, &tor_addr); /* Work even on systems without IPv6 interfaces */ if (rv == 0) { @@ -1204,4 +1204,3 @@ struct testcase_t address_tests[] = { ADDRESS_TEST(tor_addr_in_same_network_family, 0), END_OF_TESTCASES }; - diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c index f231740011..fb8408b3c3 100644 --- a/src/test/test_address_set.c +++ b/src/test/test_address_set.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_bridges.c b/src/test/test_bridges.c index 1cad5445f4..879ae6636b 100644 --- a/src/test/test_bridges.c +++ b/src/test/test_bridges.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, The Tor Project, Inc. */ +/* Copyright (c) 2018-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c index 89cbca2066..0c15a02ee4 100644 --- a/src/test/test_bt_cl.c +++ b/src/test/test_bt_cl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Tor Project, Inc. */ +/* Copyright (c) 2012-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c index 477066f699..2f9ad1fbe3 100644 --- a/src/test/test_buffers.c +++ b/src/test/test_buffers.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define BUFFERS_PRIVATE diff --git a/src/test/test_bwmgt.c b/src/test/test_bwmgt.c index 7a1782c2c9..5a013aa268 100644 --- a/src/test/test_bwmgt.c +++ b/src/test/test_bwmgt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, The Tor Project, Inc. */ +/* Copyright (c) 2018-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_cell_formats.c b/src/test/test_cell_formats.c index daf0296e2a..fc5367557d 100644 --- a/src/test/test_cell_formats.c +++ b/src/test/test_cell_formats.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_cell_queue.c b/src/test/test_cell_queue.c index d74bb9c622..8fc1da031e 100644 --- a/src/test/test_cell_queue.c +++ b/src/test/test_cell_queue.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITLIST_PRIVATE diff --git a/src/test/test_channel.c b/src/test/test_channel.c index 26af8de917..e55b9b0750 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c index 0fd60d0a92..5da2d81377 100644 --- a/src/test/test_channelpadding.c +++ b/src/test/test_channelpadding.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c index 787a30a85d..10513e451d 100644 --- a/src/test/test_channeltls.c +++ b/src/test/test_channeltls.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_checkdir.c b/src/test/test_checkdir.c index 652e308ed8..1df74c390a 100644 --- a/src/test/test_checkdir.c +++ b/src/test/test_checkdir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_circuitbuild.c b/src/test/test_circuitbuild.c index 02eadecd98..275f1eced2 100644 --- a/src/test/test_circuitbuild.c +++ b/src/test/test_circuitbuild.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITBUILD_PRIVATE diff --git a/src/test/test_circuitlist.c b/src/test/test_circuitlist.c index 8dd7f5f5a9..5cebdbeda0 100644 --- a/src/test/test_circuitlist.c +++ b/src/test/test_circuitlist.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c index 1be2ff5281..a2b3e62fe8 100644 --- a/src/test/test_circuitmux.c +++ b/src/test/test_circuitmux.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_circuitstats.c b/src/test/test_circuitstats.c index c3cfad88da..1cbcb14f2b 100644 --- a/src/test/test_circuitstats.c +++ b/src/test/test_circuitstats.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITBUILD_PRIVATE diff --git a/src/test/test_circuituse.c b/src/test/test_circuituse.c index 720adeac84..3acfc12044 100644 --- a/src/test/test_circuituse.c +++ b/src/test/test_circuituse.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITLIST_PRIVATE diff --git a/src/test/test_compat_libevent.c b/src/test/test_compat_libevent.c index 3f505d013b..2f8646e897 100644 --- a/src/test/test_compat_libevent.c +++ b/src/test/test_compat_libevent.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define COMPAT_LIBEVENT_PRIVATE diff --git a/src/test/test_config.c b/src/test/test_config.c index dae4d83766..c342d8cca4 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_connection.c b/src/test/test_connection.c index 0013f47fbc..ebe7c6d36f 100644 --- a/src/test/test_connection.c +++ b/src/test/test_connection.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Tor Project, Inc. */ +/* Copyright (c) 2015-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_connection.h b/src/test/test_connection.h index 27c296504a..47a5599e5f 100644 --- a/src/test/test_connection.h +++ b/src/test/test_connection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** Some constants used by test_connection and helpers */ diff --git a/src/test/test_conscache.c b/src/test/test_conscache.c index b5cbd72515..095ff09350 100644 --- a/src/test/test_conscache.c +++ b/src/test/test_conscache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_consdiff.c b/src/test/test_consdiff.c index b836befd22..682ba5b970 100644 --- a/src/test/test_consdiff.c +++ b/src/test/test_consdiff.c @@ -1,5 +1,5 @@ /* Copyright (c) 2014, Daniel Martà - * Copyright (c) 2014-2018, The Tor Project, Inc. */ + * Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONSDIFF_PRIVATE diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c index 6c451da685..254a5ba5d0 100644 --- a/src/test/test_consdiffmgr.c +++ b/src/test/test_consdiffmgr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONSDIFFMGR_PRIVATE diff --git a/src/test/test_containers.c b/src/test/test_containers.c index 717eb0892a..aedd2f7a89 100644 --- a/src/test/test_containers.c +++ b/src/test/test_containers.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_controller.c b/src/test/test_controller.c index 4f5a9f58d5..5b406e159b 100644 --- a/src/test/test_controller.c +++ b/src/test/test_controller.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Tor Project, Inc. */ +/* Copyright (c) 2015-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONTROL_PRIVATE diff --git a/src/test/test_controller_events.c b/src/test/test_controller_events.c index 4c404876b0..70d36e53d4 100644 --- a/src/test/test_controller_events.c +++ b/src/test/test_controller_events.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONNECTION_PRIVATE diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 81d2fa6f33..fa79f4cc47 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_crypto_ope.c b/src/test/test_crypto_ope.c index 4e7b952327..dc67c02676 100644 --- a/src/test/test_crypto_ope.c +++ b/src/test/test_crypto_ope.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2017, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_crypto_openssl.c b/src/test/test_crypto_openssl.c index 92f9cbab2f..42dc3f6be2 100644 --- a/src/test/test_crypto_openssl.c +++ b/src/test/test_crypto_openssl.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_crypto_slow.c b/src/test/test_crypto_slow.c index ca6b7b8d4d..e24aee8930 100644 --- a/src/test/test_crypto_slow.c +++ b/src/test/test_crypto_slow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_data.c b/src/test/test_data.c index be8153258b..fe1190ea77 100644 --- a/src/test/test_data.c +++ b/src/test/test_data.c @@ -1,6 +1,6 @@ /* Copyright 2001-2004 Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "test/test.h" diff --git a/src/test/test_dir.c b/src/test/test_dir.c index c18aa99fea..9d163872d4 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c index 86d2838944..3723d6c31b 100644 --- a/src/test/test_dir_common.c +++ b/src/test/test_dir_common.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_dir_common.h b/src/test/test_dir_common.h index 1e958a21ff..d6c5241b14 100644 --- a/src/test/test_dir_common.h +++ b/src/test/test_dir_common.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c index 1d4a36d7fc..90691fff94 100644 --- a/src/test/test_dir_handle_get.c +++ b/src/test/test_dir_handle_get.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define RENDCOMMON_PRIVATE diff --git a/src/test/test_dns.c b/src/test/test_dns.c index 8369f844f6..41a56f65d8 100644 --- a/src/test/test_dns.c +++ b/src/test/test_dns.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Tor Project, Inc. */ +/* Copyright (c) 2015-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_dos.c b/src/test/test_dos.c index 40a4c6ba29..4756c5014e 100644 --- a/src/test/test_dos.c +++ b/src/test/test_dos.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, The Tor Project, Inc. */ +/* Copyright (c) 2018-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define DOS_PRIVATE diff --git a/src/test/test_entryconn.c b/src/test/test_entryconn.c index bec70090e6..fc7c5d5800 100644 --- a/src/test/test_entryconn.c +++ b/src/test/test_entryconn.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index 52b87a84a8..8f0b960046 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" @@ -2847,13 +2847,16 @@ test_entry_guard_outdated_dirserver_exclusion(void *arg) digests, 3, 7, 0); /* ... and check that because we failed to fetch microdescs from all our - * primaries, we didnt end up selecting a primary for fetching dir info */ + * primaries, we didn't end up selecting a primary for fetching dir info */ expect_log_msg_containing("No primary or confirmed guards available."); teardown_capture_of_logs(); } done: + UNMOCK(networkstatus_get_latest_consensus_by_flavor); + UNMOCK(directory_initiate_request); smartlist_free(digests); + tor_free(mock_ns_val); tor_free(args); if (conn) { tor_free(conn->requested_resource); diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c index 71be9131c7..0c34d37a71 100644 --- a/src/test/test_extorport.c +++ b/src/test/test_extorport.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONNECTION_PRIVATE diff --git a/src/test/test_geoip.c b/src/test/test_geoip.c index 6f9c39063b..16c566bdbc 100644 --- a/src/test/test_geoip.c +++ b/src/test/test_geoip.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_guardfraction.c b/src/test/test_guardfraction.c index d6f4cd63f2..ac8bfbfded 100644 --- a/src/test/test_guardfraction.c +++ b/src/test/test_guardfraction.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define GUARDFRACTION_PRIVATE diff --git a/src/test/test_handles.c b/src/test/test_handles.c index 2910d7e18f..7f1d6e1898 100644 --- a/src/test/test_handles.c +++ b/src/test/test_handles.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c index 6ac73bff5c..802d0a9ebe 100644 --- a/src/test/test_helpers.c +++ b/src/test/test_helpers.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_helpers.h b/src/test/test_helpers.h index 72bf7f2f71..9e376a563d 100644 --- a/src/test/test_helpers.h +++ b/src/test/test_helpers.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_TEST_HELPERS_H diff --git a/src/test/test_hs.c b/src/test/test_hs.c index e3599d5720..a611b46ca6 100644 --- a/src/test/test_hs.c +++ b/src/test/test_hs.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2018, The Tor Project, Inc. */ +/* Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c index 203a1d7039..9182829116 100644 --- a/src/test/test_hs_cache.c +++ b/src/test/test_hs_cache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_cell.c b/src/test/test_hs_cell.c index 5b48dd3785..0c93f593ce 100644 --- a/src/test/test_hs_cell.c +++ b/src/test/test_hs_cell.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c index 91b3ed1ec4..2f2bb45581 100644 --- a/src/test/test_hs_client.c +++ b/src/test/test_hs_client.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c index 95f7ed14ba..2aff179687 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_config.c b/src/test/test_hs_config.c index b6ab0c21f9..c2c556307d 100644 --- a/src/test/test_hs_config.c +++ b/src/test/test_hs_config.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_control.c b/src/test/test_hs_control.c index 48402030bf..ba67712f1b 100644 --- a/src/test/test_hs_control.c +++ b/src/test/test_hs_control.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c index 428ca1024b..de584ed47a 100644 --- a/src/test/test_hs_descriptor.c +++ b/src/test/test_hs_descriptor.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c index 628d99bfde..660f21ffd8 100644 --- a/src/test/test_hs_intropoint.c +++ b/src/test/test_hs_intropoint.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_ntor.c b/src/test/test_hs_ntor.c index eeb0491657..1c694e6040 100644 --- a/src/test/test_hs_ntor.c +++ b/src/test/test_hs_ntor.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_hs_ntor_cl.c b/src/test/test_hs_ntor_cl.c index a4915c4f8a..6341b96d84 100644 --- a/src/test/test_hs_ntor_cl.c +++ b/src/test/test_hs_ntor_cl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** This is a wrapper over the little-t-tor HS ntor functions. The wrapper is diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index ee2d71aa75..32b08ecf37 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_introduce.c b/src/test/test_introduce.c index 4d2d909945..4a6d90d97e 100644 --- a/src/test/test_introduce.c +++ b/src/test/test_introduce.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Tor Project, Inc. */ +/* Copyright (c) 2012-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_keypin.c b/src/test/test_keypin.c index 9af12ff548..e7beef8609 100644 --- a/src/test/test_keypin.c +++ b/src/test/test_keypin.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c index 82a91a9ae2..34f59f26cd 100644 --- a/src/test/test_link_handshake.c +++ b/src/test/test_link_handshake.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_logging.c b/src/test/test_logging.c index cd685a4af7..95a2fce757 100644 --- a/src/test/test_logging.c +++ b/src/test/test_logging.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONFIG_PRIVATE diff --git a/src/test/test_mainloop.c b/src/test/test_mainloop.c index 92ce2e9918..089ea812cf 100644 --- a/src/test/test_mainloop.c +++ b/src/test/test_mainloop.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, The Tor Project, Inc. */ +/* Copyright (c) 2018-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c index 8ede2690ec..4c4317d81a 100644 --- a/src/test/test_microdesc.c +++ b/src/test/test_microdesc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c index 1af6db68ec..53eb0413e5 100644 --- a/src/test/test_nodelist.c +++ b/src/test/test_nodelist.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2018, The Tor Project, Inc. */ +/* Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_ntor_cl.c b/src/test/test_ntor_cl.c index 3f914523a3..68b6927f56 100644 --- a/src/test/test_ntor_cl.c +++ b/src/test/test_ntor_cl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Tor Project, Inc. */ +/* Copyright (c) 2012-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_oom.c b/src/test/test_oom.c index 313a6b3114..b813fa43a3 100644 --- a/src/test/test_oom.c +++ b/src/test/test_oom.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Unit tests for OOM handling logic */ diff --git a/src/test/test_oos.c b/src/test/test_oos.c index fb0daa7a8d..815feda7ce 100644 --- a/src/test/test_oos.c +++ b/src/test/test_oos.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Unit tests for OOS handler */ diff --git a/src/test/test_options.c b/src/test/test_options.c index f14e620eeb..66b0e7ef11 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONFIG_PRIVATE @@ -23,6 +23,10 @@ #include "test/test_helpers.h" #include "lib/net/resolve.h" +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + #define NS_MODULE test_options typedef struct { diff --git a/src/test/test_pem.c b/src/test/test_pem.c index 2bae286e25..865688b1a7 100644 --- a/src/test/test_pem.c +++ b/src/test/test_pem.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_periodic_event.c b/src/test/test_periodic_event.c index 86dedd85d8..4a53639dad 100644 --- a/src/test/test_periodic_event.c +++ b/src/test/test_periodic_event.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, The Tor Project, Inc. */ +/* Copyright (c) 2018-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_policy.c b/src/test/test_policy.c index afe608f5f7..9c001c294a 100644 --- a/src/test/test_policy.c +++ b/src/test/test_policy.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018, The Tor Project, Inc. */ +/* Copyright (c) 2013-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONFIG_PRIVATE diff --git a/src/test/test_procmon.c b/src/test/test_procmon.c index 2c7918f580..e23578f4fd 100644 --- a/src/test/test_procmon.c +++ b/src/test/test_procmon.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define PROCMON_PRIVATE diff --git a/src/test/test_proto_http.c b/src/test/test_proto_http.c index 1cfa0a752c..08990c0b6a 100644 --- a/src/test/test_proto_http.c +++ b/src/test/test_proto_http.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_proto_misc.c b/src/test/test_proto_misc.c index 1fcb763421..af9cf7eee2 100644 --- a/src/test/test_proto_misc.c +++ b/src/test/test_proto_misc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_protover.c b/src/test/test_protover.c index 5f9a8b7937..63c508bd13 100644 --- a/src/test/test_protover.c +++ b/src/test/test_protover.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define PROTOVER_PRIVATE diff --git a/src/test/test_pt.c b/src/test/test_pt.c index d0160d1148..1f9786648a 100644 --- a/src/test/test_pt.c +++ b/src/test/test_pt.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py index c63341a681..00e5a08be7 100644 --- a/src/test/test_rebind.py +++ b/src/test/test_rebind.py @@ -1,6 +1,7 @@ from __future__ import print_function import errno +import logging import os import random import socket @@ -10,10 +11,9 @@ import time LOG_TIMEOUT = 60.0 LOG_WAIT = 0.1 -LOG_CHECK_LIMIT = LOG_TIMEOUT / LOG_WAIT def fail(msg): - print('FAIL') + logging.error('FAIL') sys.exit(msg) def try_connecting_to_socksport(): @@ -24,18 +24,18 @@ def try_connecting_to_socksport(): socks_socket.close() def wait_for_log(s): - log_checked = 0 - while log_checked < LOG_CHECK_LIMIT: + cutoff = time.time() + LOG_TIMEOUT + while time.time() < cutoff: l = tor_process.stdout.readline() l = l.decode('utf8') if s in l: + logging.info('Tor logged: "{}"'.format(l.strip())) return - print('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s)) + logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s)) # readline() returns a blank string when there is no output # avoid busy-waiting if len(s) == 0: time.sleep(LOG_WAIT) - log_checked += 1 fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT)) def pick_random_port(): @@ -55,6 +55,10 @@ def pick_random_port(): return port +logging.basicConfig(level=logging.DEBUG, + format='%(asctime)s.%(msecs)03d %(message)s', + datefmt='%Y-%m-%d %H:%M:%S') + if sys.hexversion < 0x02070000: fail("ERROR: unsupported Python version (should be >= 2.7)") @@ -67,14 +71,23 @@ socks_port = pick_random_port() assert control_port != 0 assert socks_port != 0 +if len(sys.argv) < 3: + fail('Usage: %s <path-to-tor> <data-dir>' % sys.argv[0]) + if not os.path.exists(sys.argv[1]): fail('ERROR: cannot find tor at %s' % sys.argv[1]) +if not os.path.exists(sys.argv[2]): + fail('ERROR: cannot find datadir at %s' % sys.argv[2]) tor_path = sys.argv[1] +data_dir = sys.argv[2] tor_process = subprocess.Popen([tor_path, + '-DataDirectory', data_dir, '-ControlPort', '127.0.0.1:{}'.format(control_port), '-SOCKSPort', '127.0.0.1:{}'.format(socks_port), + '-Log', 'debug stdout', + '-LogTimeGranularity', '1', '-FetchServerDescriptors', '0'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -82,9 +95,6 @@ tor_process = subprocess.Popen([tor_path, if tor_process == None: fail('ERROR: running tor failed') -if len(sys.argv) < 2: - fail('Usage: %s <path-to-tor>' % sys.argv[0]) - wait_for_log('Opened Control listener on') try_connecting_to_socksport() @@ -108,13 +118,13 @@ try_connecting_to_socksport() control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8')) wait_for_log('exiting cleanly') -print('OK') +logging.info('OK') try: tor_process.terminate() except OSError as e: if e.errno == errno.ESRCH: # errno 3: No such process # assume tor has already exited due to SIGNAL HALT - print("Tor has already exited") + logging.warn("Tor has already exited") else: raise diff --git a/src/test/test_rebind.sh b/src/test/test_rebind.sh index 76eb9f2e4d..498072de35 100755 --- a/src/test/test_rebind.sh +++ b/src/test/test_rebind.sh @@ -14,6 +14,19 @@ fi exitcode=0 -"${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" "${TESTING_TOR_BINARY}" || exitcode=1 +tmpdir= +clean () { test -n "$tmpdir" && test -d "$tmpdir" && rm -rf "$tmpdir" || :; } +trap clean EXIT HUP INT TERM + +tmpdir="`mktemp -d -t tor_rebind_test.XXXXXX`" +if [ -z "$tmpdir" ]; then + echo >&2 mktemp failed + exit 2 +elif [ ! -d "$tmpdir" ]; then + echo >&2 mktemp failed to make a directory + exit 3 +fi + +"${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" "${TESTING_TOR_BINARY}" "$tmpdir" || exitcode=1 exit ${exitcode} diff --git a/src/test/test_relay.c b/src/test/test_relay.c index 4311392be8..0b7a7be332 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITBUILD_PRIVATE diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c index 3d3addfb9e..0623583511 100644 --- a/src/test/test_relaycell.c +++ b/src/test/test_relaycell.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Unit tests for handling different kinds of relay cell */ diff --git a/src/test/test_relaycrypt.c b/src/test/test_relaycrypt.c index c3cfb7d10b..fe6889e521 100644 --- a/src/test/test_relaycrypt.c +++ b/src/test/test_relaycrypt.c @@ -1,6 +1,6 @@ /* Copyright 2001-2004 Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c index 394e28d785..4f544cf21c 100644 --- a/src/test/test_rendcache.c +++ b/src/test/test_rendcache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" @@ -788,7 +788,9 @@ test_rend_cache_clean(void *data) desc_two->pk = pk_generate(1); strmap_set_lc(rend_cache, "foo1", one); + rend_cache_increment_allocation(rend_cache_entry_allocation(one)); strmap_set_lc(rend_cache, "foo2", two); + rend_cache_increment_allocation(rend_cache_entry_allocation(two)); rend_cache_clean(time(NULL), REND_CACHE_TYPE_CLIENT); tt_int_op(strmap_size(rend_cache), OP_EQ, 0); @@ -806,7 +808,9 @@ test_rend_cache_clean(void *data) desc_one->pk = pk_generate(0); desc_two->pk = pk_generate(1); + rend_cache_increment_allocation(rend_cache_entry_allocation(one)); strmap_set_lc(rend_cache, "foo1", one); + rend_cache_increment_allocation(rend_cache_entry_allocation(two)); strmap_set_lc(rend_cache, "foo2", two); rend_cache_clean(time(NULL), REND_CACHE_TYPE_CLIENT); diff --git a/src/test/test_replay.c b/src/test/test_replay.c index bca3a6660a..28a508bf4d 100644 --- a/src/test/test_replay.c +++ b/src/test/test_replay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Tor Project, Inc. */ +/* Copyright (c) 2012-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define REPLAYCACHE_PRIVATE diff --git a/src/test/test_router.c b/src/test/test_router.c index 921ec42904..601881a124 100644 --- a/src/test/test_router.c +++ b/src/test/test_router.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* Copyright (c) 2017, isis agora lovecruft */ /* See LICENSE for licensing information */ diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c index f05401ba0d..727fa5660f 100644 --- a/src/test/test_routerkeys.c +++ b/src/test/test_routerkeys.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c index 67af2fd484..95c9176faa 100644 --- a/src/test/test_routerlist.c +++ b/src/test/test_routerlist.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c index 86f9c0fa82..c45f0e1595 100644 --- a/src/test/test_routerset.c +++ b/src/test/test_routerset.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ROUTERSET_PRIVATE diff --git a/src/test/test_scheduler.c b/src/test/test_scheduler.c index 2d562299ab..bf9c6a49cd 100644 --- a/src/test/test_scheduler.c +++ b/src/test/test_scheduler.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c index 8a7fb95cc1..98a114e1af 100644 --- a/src/test/test_shared_random.c +++ b/src/test/test_shared_random.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define SHARED_RANDOM_PRIVATE diff --git a/src/test/test_slow.c b/src/test/test_slow.c index 0b665363ab..bda67b2d92 100644 --- a/src/test/test_slow.c +++ b/src/test/test_slow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_socks.c b/src/test/test_socks.c index 7f6d8a48f1..783f4726ee 100644 --- a/src/test/test_socks.c +++ b/src/test/test_socks.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" @@ -479,6 +479,44 @@ test_socks_5_authenticate(void *ptr) ; } +/** Perform SOCKS 5 authentication with empty username/password fields. + * Technically this violates RfC 1929, but some client software will send + * this kind of message to Tor. + * */ +static void +test_socks_5_authenticate_empty_user_pass(void *ptr) +{ + SOCKS_TEST_INIT(); + + /* SOCKS 5 Negotiate username/password authentication */ + ADD_DATA(buf, "\x05\x01\x02"); + + tt_assert(!fetch_from_buf_socks(buf, socks, + get_options()->TestSocks, + get_options()->SafeSocks)); + tt_int_op(2,OP_EQ, socks->replylen); + tt_int_op(5,OP_EQ, socks->reply[0]); + tt_int_op(SOCKS_USER_PASS,OP_EQ, socks->reply[1]); + tt_int_op(5,OP_EQ, socks->socks_version); + + tt_int_op(0,OP_EQ, buf_datalen(buf)); + + /* SOCKS 5 Send username/password auth message with empty user/pass fields */ + ADD_DATA(buf, "\x01\x00\x00"); + tt_assert(!fetch_from_buf_socks(buf, socks, + get_options()->TestSocks, + get_options()->SafeSocks)); + tt_int_op(5,OP_EQ, socks->socks_version); + tt_int_op(2,OP_EQ, socks->replylen); + tt_int_op(1,OP_EQ, socks->reply[0]); + tt_int_op(0,OP_EQ, socks->reply[1]); + + tt_int_op(0,OP_EQ, socks->usernamelen); + tt_int_op(0,OP_EQ, socks->passwordlen); + + done: + ; +} /** Perform SOCKS 5 authentication and send data all in one go */ static void test_socks_5_authenticate_with_data(void *ptr) @@ -1035,6 +1073,7 @@ struct testcase_t socks_tests[] = { SOCKSENT(5_auth_unsupported_version), SOCKSENT(5_auth_before_negotiation), SOCKSENT(5_authenticate), + SOCKSENT(5_authenticate_empty_user_pass), SOCKSENT(5_authenticate_with_data), SOCKSENT(5_malformed_commands), SOCKSENT(5_bad_arguments), diff --git a/src/test/test_status.c b/src/test/test_status.c index 3ceba77a84..9c47469975 100644 --- a/src/test/test_status.c +++ b/src/test/test_status.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2018, The Tor Project, Inc. */ +/* Copyright (c) 2014-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define STATUS_PRIVATE diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c index 76aae7e033..24e45c7428 100644 --- a/src/test/test_storagedir.c +++ b/src/test/test_storagedir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Tor Project, Inc. */ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_switch_id.c b/src/test/test_switch_id.c index d8a1d15e4e..baddf8d66e 100644 --- a/src/test/test_switch_id.c +++ b/src/test/test_switch_id.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Tor Project, Inc. */ +/* Copyright (c) 2015-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_threads.c b/src/test/test_threads.c index 2bf5026061..4a5ecc6fae 100644 --- a/src/test/test_threads.c +++ b/src/test/test_threads.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c index 79b52437f8..11e35be2fa 100644 --- a/src/test/test_tortls.c +++ b/src/test/test_tortls.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TORTLS_PRIVATE diff --git a/src/test/test_tortls.h b/src/test/test_tortls.h index c997934ebc..1a8b117d0f 100644 --- a/src/test/test_tortls.h +++ b/src/test/test_tortls.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TEST_TORTLS_H diff --git a/src/test/test_tortls_openssl.c b/src/test/test_tortls_openssl.c index abe1fb7889..73041a871c 100644 --- a/src/test/test_tortls_openssl.c +++ b/src/test/test_tortls_openssl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TORTLS_PRIVATE diff --git a/src/test/test_util.c b/src/test/test_util.c index 7bc1b7921a..4701fadf1a 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" @@ -690,6 +690,12 @@ test_util_time(void *arg) expect_single_log_msg_containing(msg); \ teardown_capture_of_logs(); \ } while (0) +#define CHECK_POSSIBLE_EINVAL() do { \ + if (mock_saved_log_n_entries()) { \ + expect_single_log_msg_containing("Invalid argument"); \ + } \ + teardown_capture_of_logs(); \ + } while (0) #define CHECK_TIMEGM_ARG_OUT_OF_RANGE(msg) \ CHECK_TIMEGM_WARNING("Out-of-range argument to tor_timegm") @@ -885,12 +891,16 @@ test_util_time(void *arg) if (sizeof(time_t) == 4 || sizeof(time_t) == 8) { t_res = -1*(1 << 30); + CAPTURE(); tor_gmtime_r(&t_res, &b_time); + CHECK_POSSIBLE_EINVAL(); tt_assert(b_time.tm_year == (1970-1900) || b_time.tm_year == (1935-1900)); t_res = INT32_MIN; + CAPTURE(); tor_gmtime_r(&t_res, &b_time); + CHECK_POSSIBLE_EINVAL(); tt_assert(b_time.tm_year == (1970-1900) || b_time.tm_year == (1901-1900)); } @@ -900,7 +910,9 @@ test_util_time(void *arg) /* one of the smallest tm_year values my 64 bit system supports: * b_time.tm_year == (-292275055LL-1900LL) without clamping */ t_res = -9223372036854775LL; + CAPTURE(); tor_gmtime_r(&t_res, &b_time); + CHECK_POSSIBLE_EINVAL(); tt_assert(b_time.tm_year == (1970-1900) || b_time.tm_year == (1-1900)); @@ -926,7 +938,9 @@ test_util_time(void *arg) { /* As above, but with localtime. */ t_res = -9223372036854775LL; + CAPTURE(); tor_localtime_r(&t_res, &b_time); + CHECK_POSSIBLE_EINVAL(); tt_assert(b_time.tm_year == (1970-1900) || b_time.tm_year == (1-1900)); @@ -983,7 +997,9 @@ test_util_time(void *arg) /* one of the largest tm_year values my 64 bit system supports: * b_time.tm_year == (292278994L-1900L) without clamping */ t_res = 9223372036854775LL; + CAPTURE(); tor_gmtime_r(&t_res, &b_time); + CHECK_POSSIBLE_EINVAL(); tt_assert(b_time.tm_year == (2037-1900) || b_time.tm_year == (9999-1900)); @@ -1004,7 +1020,9 @@ test_util_time(void *arg) { /* As above but with localtime. */ t_res = 9223372036854775LL; + CAPTURE(); tor_localtime_r(&t_res, &b_time); + CHECK_POSSIBLE_EINVAL(); tt_assert(b_time.tm_year == (2037-1900) || b_time.tm_year == (9999-1900)); @@ -1047,7 +1065,10 @@ test_util_time(void *arg) /* This value is out of range with 32 bit time_t, but in range for 64 bit * time_t */ + CAPTURE(); format_rfc1123_time(timestr, (time_t)2150000000UL); + CHECK_POSSIBLE_EINVAL(); + #if SIZEOF_TIME_T == 4 #if 0 /* Wrapping around will have made it this. */ @@ -1216,7 +1237,9 @@ test_util_time(void *arg) /* This value is out of range with 32 bit time_t, but in range for 64 bit * time_t */ tv.tv_sec = (time_t)2150000000UL; + CAPTURE(); format_iso_time(timestr, (time_t)tv.tv_sec); + CHECK_POSSIBLE_EINVAL(); #if SIZEOF_TIME_T == 4 /* format_iso_time should indicate failure on overflow, but it doesn't yet. * Hopefully #18480 will improve the failure semantics in this case. @@ -1231,6 +1254,7 @@ test_util_time(void *arg) #undef CAPTURE #undef CHECK_TIMEGM_ARG_OUT_OF_RANGE +#undef CHECK_POSSIBLE_EINVAL done: teardown_capture_of_logs(); diff --git a/src/test/test_util_format.c b/src/test/test_util_format.c index 85d8a8e62e..d344d0e95c 100644 --- a/src/test/test_util_format.c +++ b/src/test/test_util_format.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_util_process.c b/src/test/test_util_process.c index 44c4da9169..4d04eb6dfc 100644 --- a/src/test/test_util_process.c +++ b/src/test/test_util_process.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define UTIL_PROCESS_PRIVATE diff --git a/src/test/test_util_slow.c b/src/test/test_util_slow.c index c7b3e3e2a4..29e30eaa11 100644 --- a/src/test/test_util_slow.c +++ b/src/test/test_util_slow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_voting_schedule.c b/src/test/test_voting_schedule.c index c3a581cf21..ba4d53a4ae 100644 --- a/src/test/test_voting_schedule.c +++ b/src/test/test_voting_schedule.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, The Tor Project, Inc. */ +/* Copyright (c) 2018-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_workqueue.c b/src/test/test_workqueue.c index 28fbd6fb9f..c58634da5c 100644 --- a/src/test/test_workqueue.c +++ b/src/test/test_workqueue.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "core/or/or.h" diff --git a/src/test/test_x509.c b/src/test/test_x509.c index 9128958492..792849ae4b 100644 --- a/src/test/test_x509.c +++ b/src/test/test_x509.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018, The Tor Project, Inc. */ +/* Copyright (c) 2010-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_X509_PRIVATE diff --git a/src/test/testing_common.c b/src/test/testing_common.c index c52683afca..62d40a42fa 100644 --- a/src/test/testing_common.c +++ b/src/test/testing_common.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** @@ -239,6 +239,15 @@ tinytest_postfork(void) init_pregenerated_keys(); } +static void +log_callback_failure(int severity, uint32_t domain, const char *msg) +{ + (void)msg; + if (severity == LOG_ERR || (domain & LD_BUG)) { + tinytest_set_test_failed_(); + } +} + /** Main entry point for unit test code: parse the command line, and run * some unit tests. */ int @@ -287,6 +296,7 @@ main(int c, const char **v) c = i_out; { + /* setup logs to stdout */ log_severity_list_t s; memset(&s, 0, sizeof(s)); set_log_severity_config(loglevel, LOG_ERR, &s); @@ -294,6 +304,14 @@ main(int c, const char **v) s.masks[LOG_WARN-LOG_ERR] |= LD_BUG; add_stream_log(&s, "", fileno(stdout)); } + { + /* Setup logs that cause failure. */ + log_severity_list_t s; + memset(&s, 0, sizeof(s)); + set_log_severity_config(LOG_ERR, LOG_ERR, &s); + s.masks[LOG_WARN-LOG_ERR] |= LD_BUG; + add_callback_log(&s, log_callback_failure); + } init_protocol_warning_severity_level(); options->command = CMD_RUN_UNITTESTS; diff --git a/src/test/testing_rsakeys.c b/src/test/testing_rsakeys.c index c8062b82d5..0f22d4e01b 100644 --- a/src/test/testing_rsakeys.c +++ b/src/test/testing_rsakeys.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ + * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "lib/crypt_ops/crypto_rand.h" |