include.am 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. # When the day comes that Tor requires Automake >= 1.12 change
  2. # TESTS_ENVIRONMENT to AM_TESTS_ENVIRONMENT because the former is reserved for
  3. # users while the later is reserved for developers.
  4. TESTS_ENVIRONMENT = \
  5. export PYTHON="$(PYTHON)"; \
  6. export SHELL="$(SHELL)"; \
  7. export abs_top_srcdir="$(abs_top_srcdir)"; \
  8. export abs_top_builddir="$(abs_top_builddir)"; \
  9. export builddir="$(builddir)"; \
  10. export TESTING_TOR_BINARY="$(TESTING_TOR_BINARY)"; \
  11. export CARGO="$(CARGO)"; \
  12. export CARGO_ONLINE="$(CARGO_ONLINE)";
  13. TESTSCRIPTS = \
  14. src/test/fuzz_static_testcases.sh \
  15. src/test/test_zero_length_keys.sh \
  16. src/test/test_workqueue_cancel.sh \
  17. src/test/test_workqueue_efd.sh \
  18. src/test/test_workqueue_efd2.sh \
  19. src/test/test_workqueue_pipe.sh \
  20. src/test/test_workqueue_pipe2.sh \
  21. src/test/test_workqueue_socketpair.sh \
  22. src/test/test_switch_id.sh
  23. if USE_RUST
  24. TESTSCRIPTS += \
  25. src/test/test_rust.sh
  26. endif
  27. if USEPYTHON
  28. TESTSCRIPTS += src/test/test_ntor.sh src/test/test_hs_ntor.sh src/test/test_bt.sh
  29. endif
  30. TESTS += src/test/test src/test/test-slow src/test/test-memwipe \
  31. src/test/test_workqueue \
  32. src/test/test_keygen.sh \
  33. src/test/test_key_expiration.sh \
  34. src/test/test-timers \
  35. $(TESTSCRIPTS)
  36. # These flavors are run using automake's test-driver and test-network.sh
  37. TEST_CHUTNEY_FLAVORS = basic-min bridges-min hs-v2-min hs-v3-min \
  38. single-onion-v23
  39. # only run if we can ping6 ::1 (localhost)
  40. # IPv6-only v3 single onion services don't work yet, so we don't test the
  41. # single-onion-v23-ipv6-md flavor
  42. TEST_CHUTNEY_FLAVORS_IPV6 = bridges+ipv6-min ipv6-exit-min hs-v23-ipv6-md \
  43. single-onion-ipv6-md
  44. # only run if we can find a stable (or simply another) version of tor
  45. TEST_CHUTNEY_FLAVORS_MIXED = mixed+hs-v23
  46. ### This is a lovely feature, but it requires automake >= 1.12, and Tor
  47. ### doesn't require that yet.
  48. ###
  49. # TEST_EXTENSIONS = .sh
  50. # SH_LOG_COMPILER = $(SHELL)
  51. noinst_PROGRAMS+= src/test/bench
  52. if UNITTESTS_ENABLED
  53. noinst_PROGRAMS+= \
  54. src/test/test \
  55. src/test/test-slow \
  56. src/test/test-memwipe \
  57. src/test/test-child \
  58. src/test/test_workqueue \
  59. src/test/test-switch-id \
  60. src/test/test-timers
  61. endif
  62. src_test_AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
  63. -DLOCALSTATEDIR="\"$(localstatedir)\"" \
  64. -DBINDIR="\"$(bindir)\"" \
  65. -I"$(top_srcdir)/src/or" -I"$(top_srcdir)/src/ext" \
  66. -I"$(top_srcdir)/src/trunnel" \
  67. -I"$(top_srcdir)/src/ext/trunnel" \
  68. -DTOR_UNIT_TESTS
  69. # -L flags need to go in LDFLAGS. -l flags need to go in LDADD.
  70. # This seems to matter nowhere but on Windows, but I assure you that it
  71. # matters a lot there, and is quite hard to debug if you forget to do it.
  72. src_test_test_SOURCES = \
  73. src/test/log_test_helpers.c \
  74. src/test/hs_test_helpers.c \
  75. src/test/rend_test_helpers.c \
  76. src/test/test.c \
  77. src/test/test_accounting.c \
  78. src/test/test_addr.c \
  79. src/test/test_address.c \
  80. src/test/test_buffers.c \
  81. src/test/test_cell_formats.c \
  82. src/test/test_cell_queue.c \
  83. src/test/test_channel.c \
  84. src/test/test_channelpadding.c \
  85. src/test/test_channeltls.c \
  86. src/test/test_checkdir.c \
  87. src/test/test_circuitlist.c \
  88. src/test/test_circuitmux.c \
  89. src/test/test_circuitbuild.c \
  90. src/test/test_circuituse.c \
  91. src/test/test_circuitstats.c \
  92. src/test/test_compat_libevent.c \
  93. src/test/test_config.c \
  94. src/test/test_connection.c \
  95. src/test/test_conscache.c \
  96. src/test/test_consdiff.c \
  97. src/test/test_consdiffmgr.c \
  98. src/test/test_containers.c \
  99. src/test/test_controller.c \
  100. src/test/test_controller_events.c \
  101. src/test/test_crypto.c \
  102. src/test/test_crypto_openssl.c \
  103. src/test/test_data.c \
  104. src/test/test_dir.c \
  105. src/test/test_dir_common.c \
  106. src/test/test_dir_handle_get.c \
  107. src/test/test_dos.c \
  108. src/test/test_entryconn.c \
  109. src/test/test_entrynodes.c \
  110. src/test/test_guardfraction.c \
  111. src/test/test_extorport.c \
  112. src/test/test_hs.c \
  113. src/test/test_hs_common.c \
  114. src/test/test_hs_config.c \
  115. src/test/test_hs_cell.c \
  116. src/test/test_hs_ntor.c \
  117. src/test/test_hs_service.c \
  118. src/test/test_hs_client.c \
  119. src/test/test_hs_intropoint.c \
  120. src/test/test_hs_control.c \
  121. src/test/test_handles.c \
  122. src/test/test_hs_cache.c \
  123. src/test/test_hs_descriptor.c \
  124. src/test/test_introduce.c \
  125. src/test/test_keypin.c \
  126. src/test/test_link_handshake.c \
  127. src/test/test_logging.c \
  128. src/test/test_microdesc.c \
  129. src/test/test_nodelist.c \
  130. src/test/test_oom.c \
  131. src/test/test_oos.c \
  132. src/test/test_options.c \
  133. src/test/test_policy.c \
  134. src/test/test_procmon.c \
  135. src/test/test_proto_http.c \
  136. src/test/test_proto_misc.c \
  137. src/test/test_protover.c \
  138. src/test/test_pt.c \
  139. src/test/test_pubsub.c \
  140. src/test/test_relay.c \
  141. src/test/test_relaycell.c \
  142. src/test/test_rendcache.c \
  143. src/test/test_replay.c \
  144. src/test/test_router.c \
  145. src/test/test_routerkeys.c \
  146. src/test/test_routerlist.c \
  147. src/test/test_routerset.c \
  148. src/test/test_scheduler.c \
  149. src/test/test_shared_random.c \
  150. src/test/test_socks.c \
  151. src/test/test_status.c \
  152. src/test/test_storagedir.c \
  153. src/test/test_threads.c \
  154. src/test/test_tortls.c \
  155. src/test/test_util.c \
  156. src/test/test_util_format.c \
  157. src/test/test_util_process.c \
  158. src/test/test_helpers.c \
  159. src/test/test_dns.c \
  160. src/test/testing_common.c \
  161. src/test/testing_rsakeys.c \
  162. src/ext/tinytest.c
  163. src_test_test_slow_SOURCES = \
  164. src/test/test_slow.c \
  165. src/test/test_crypto_slow.c \
  166. src/test/test_util_slow.c \
  167. src/test/testing_common.c \
  168. src/test/testing_rsakeys.c \
  169. src/ext/tinytest.c
  170. src_test_test_memwipe_SOURCES = \
  171. src/test/test-memwipe.c
  172. src_test_test_timers_SOURCES = \
  173. src/test/test-timers.c
  174. src_test_test_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
  175. src_test_test_CPPFLAGS= $(src_test_AM_CPPFLAGS) $(TEST_CPPFLAGS)
  176. src_test_bench_SOURCES = \
  177. src/test/bench.c
  178. src_test_test_workqueue_SOURCES = \
  179. src/test/test_workqueue.c
  180. src_test_test_workqueue_CPPFLAGS= $(src_test_AM_CPPFLAGS)
  181. src_test_test_workqueue_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
  182. src_test_test_switch_id_SOURCES = \
  183. src/test/test_switch_id.c
  184. src_test_test_switch_id_CPPFLAGS= $(src_test_AM_CPPFLAGS)
  185. src_test_test_switch_id_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
  186. src_test_test_switch_id_LDFLAGS = @TOR_LDFLAGS_zlib@
  187. src_test_test_switch_id_LDADD = \
  188. src/common/libor-testing.a \
  189. src/common/libor-ctime-testing.a \
  190. $(rust_ldadd) \
  191. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
  192. @TOR_LIB_WS32@ @TOR_LIB_USERENV@ \
  193. @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
  194. src_test_test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
  195. @TOR_LDFLAGS_libevent@
  196. src_test_test_LDADD = src/or/libtor-testing.a \
  197. src/common/libor-crypto-testing.a \
  198. $(LIBKECCAK_TINY) \
  199. $(LIBDONNA) \
  200. src/common/libor-testing.a \
  201. src/common/libor-ctime-testing.a \
  202. src/common/libor-event-testing.a \
  203. src/trunnel/libor-trunnel-testing.a \
  204. src/trace/libor-trace.a \
  205. $(rust_ldadd) \
  206. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
  207. @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  208. @CURVE25519_LIBS@ \
  209. @TOR_SYSTEMD_LIBS@ @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
  210. src_test_test_slow_CPPFLAGS = $(src_test_test_CPPFLAGS)
  211. src_test_test_slow_CFLAGS = $(src_test_test_CFLAGS)
  212. src_test_test_slow_LDADD = $(src_test_test_LDADD)
  213. src_test_test_slow_LDFLAGS = $(src_test_test_LDFLAGS)
  214. src_test_test_memwipe_CPPFLAGS = $(src_test_test_CPPFLAGS)
  215. # Don't use bugtrap cflags here: memwipe tests require memory violations.
  216. src_test_test_memwipe_CFLAGS = $(TEST_CFLAGS)
  217. src_test_test_memwipe_LDADD = $(src_test_test_LDADD)
  218. # The LDFLAGS need to include the bugtrap cflags, or else we won't link
  219. # successfully with the libraries built with them.
  220. src_test_test_memwipe_LDFLAGS = $(src_test_test_LDFLAGS) @CFLAGS_BUGTRAP@
  221. src_test_bench_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
  222. @TOR_LDFLAGS_libevent@
  223. src_test_bench_LDADD = src/or/libtor.a src/common/libor.a \
  224. src/common/libor-ctime.a \
  225. src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
  226. src/common/libor-event.a src/trunnel/libor-trunnel.a \
  227. src/trace/libor-trace.a \
  228. $(rust_ldadd) \
  229. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
  230. @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  231. @CURVE25519_LIBS@ \
  232. @TOR_SYSTEMD_LIBS@ @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
  233. src_test_test_workqueue_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
  234. @TOR_LDFLAGS_libevent@
  235. src_test_test_workqueue_LDADD = src/or/libtor-testing.a \
  236. src/common/libor-testing.a \
  237. src/common/libor-ctime-testing.a \
  238. src/common/libor-crypto-testing.a $(LIBKECCAK_TINY) $(LIBDONNA) \
  239. src/common/libor-event-testing.a \
  240. src/trace/libor-trace.a \
  241. $(rust_ldadd) \
  242. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
  243. @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  244. @CURVE25519_LIBS@ \
  245. @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
  246. src_test_test_timers_CPPFLAGS = $(src_test_test_CPPFLAGS)
  247. src_test_test_timers_CFLAGS = $(src_test_test_CFLAGS)
  248. src_test_test_timers_LDADD = \
  249. src/common/libor-testing.a \
  250. src/common/libor-ctime-testing.a \
  251. src/common/libor-event-testing.a \
  252. src/common/libor-crypto-testing.a $(LIBKECCAK_TINY) $(LIBDONNA) \
  253. $(rust_ldadd) \
  254. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
  255. @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  256. @CURVE25519_LIBS@ \
  257. @TOR_LZMA_LIBS@
  258. src_test_test_timers_LDFLAGS = $(src_test_test_LDFLAGS)
  259. noinst_HEADERS+= \
  260. src/test/fakechans.h \
  261. src/test/hs_test_helpers.h \
  262. src/test/log_test_helpers.h \
  263. src/test/rend_test_helpers.h \
  264. src/test/test.h \
  265. src/test/test_helpers.h \
  266. src/test/test_dir_common.h \
  267. src/test/test_connection.h \
  268. src/test/test_descriptors.inc \
  269. src/test/example_extrainfo.inc \
  270. src/test/failing_routerdescs.inc \
  271. src/test/ed25519_vectors.inc \
  272. src/test/test_descriptors.inc \
  273. src/test/test_hs_descriptor.inc \
  274. src/test/vote_descriptors.inc
  275. noinst_PROGRAMS+= src/test/test-ntor-cl
  276. noinst_PROGRAMS+= src/test/test-hs-ntor-cl
  277. src_test_test_ntor_cl_SOURCES = src/test/test_ntor_cl.c
  278. src_test_test_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
  279. src_test_test_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \
  280. src/common/libor-ctime.a \
  281. src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
  282. src/trace/libor-trace.a \
  283. $(rust_ldadd) \
  284. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
  285. @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  286. @CURVE25519_LIBS@ @TOR_LZMA_LIBS@
  287. src_test_test_ntor_cl_AM_CPPFLAGS = \
  288. -I"$(top_srcdir)/src/or"
  289. src_test_test_hs_ntor_cl_SOURCES = src/test/test_hs_ntor_cl.c
  290. src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
  291. src_test_test_hs_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \
  292. src/common/libor-ctime.a \
  293. src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
  294. @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
  295. @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@
  296. src_test_test_hs_ntor_cl_AM_CPPFLAGS = \
  297. -I"$(top_srcdir)/src/or"
  298. noinst_PROGRAMS += src/test/test-bt-cl
  299. src_test_test_bt_cl_SOURCES = src/test/test_bt_cl.c
  300. src_test_test_bt_cl_LDADD = src/common/libor-testing.a \
  301. src/common/libor-ctime-testing.a \
  302. src/trace/libor-trace.a \
  303. $(rust_ldadd) \
  304. @TOR_LIB_MATH@ \
  305. @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@
  306. src_test_test_bt_cl_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
  307. src_test_test_bt_cl_CPPFLAGS= $(src_test_AM_CPPFLAGS) $(TEST_CPPFLAGS)
  308. EXTRA_DIST += \
  309. src/test/bt_test.py \
  310. src/test/ntor_ref.py \
  311. src/test/hs_ntor_ref.py \
  312. src/test/hs_build_address.py \
  313. src/test/hs_indexes.py \
  314. src/test/fuzz_static_testcases.sh \
  315. src/test/slownacl_curve25519.py \
  316. src/test/zero_length_keys.sh \
  317. src/test/test_keygen.sh \
  318. src/test/test_key_expiration.sh \
  319. src/test/test_zero_length_keys.sh \
  320. src/test/test_ntor.sh src/test/test_hs_ntor.sh src/test/test_bt.sh \
  321. src/test/test-network.sh \
  322. src/test/test_rust.sh \
  323. src/test/test_switch_id.sh \
  324. src/test/test_workqueue_cancel.sh \
  325. src/test/test_workqueue_efd.sh \
  326. src/test/test_workqueue_efd2.sh \
  327. src/test/test_workqueue_pipe.sh \
  328. src/test/test_workqueue_pipe2.sh \
  329. src/test/test_workqueue_socketpair.sh