include.am 11 KB

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