From dc4bf7ef0e4240cd41a725b306072f85c4f8ff9f Mon Sep 17 00:00:00 2001 From: sat bot Date: Fri, 24 Feb 2017 18:00:38 +0000 Subject: [PATCH] 2017.0.2-0 release --- .../support/tests/math/basic.py | 17 - .../support/tests/mymodule/my_function.py | 7 - .../support/tests/strings/cat.py | 12 - .../support/tests/testlib.py | 6 - .../support/coverage/tests/test_covered.py | 4 - .../support/coverage2/tests/test_covered.py | 8 - .../package1/tests/test_example_function.py | 15 - .../support/package3/tests/test_a.py | 4 - .../support/package3/tests/test_b.py | 4 - .../support/foo/tests/dir_test_file.py | 3 - .../support/pkgorg/tests/test_mod.py | 4 - pyzmq/pyzmq-15.4.0/zmq/tests/__init__.py | 186 ---- .../zmq/tests/asyncio/__init__.py | 0 .../zmq/tests/asyncio/_test_asyncio.py | 280 ------ .../zmq/tests/asyncio/test_asyncio.py | 6 - pyzmq/pyzmq-15.4.0/zmq/tests/test_auth.py | 435 --------- .../zmq/tests/test_cffi_backend.py | 310 ------- .../pyzmq-15.4.0/zmq/tests/test_constants.py | 121 --- pyzmq/pyzmq-15.4.0/zmq/tests/test_context.py | 323 ------- .../pyzmq-15.4.0/zmq/tests/test_decorators.py | 375 -------- pyzmq/pyzmq-15.4.0/zmq/tests/test_device.py | 141 --- pyzmq/pyzmq-15.4.0/zmq/tests/test_error.py | 43 - pyzmq/pyzmq-15.4.0/zmq/tests/test_etc.py | 20 - pyzmq/pyzmq-15.4.0/zmq/tests/test_future.py | 162 ---- pyzmq/pyzmq-15.4.0/zmq/tests/test_imports.py | 65 -- pyzmq/pyzmq-15.4.0/zmq/tests/test_ioloop.py | 104 --- pyzmq/pyzmq-15.4.0/zmq/tests/test_log.py | 116 --- pyzmq/pyzmq-15.4.0/zmq/tests/test_message.py | 379 -------- pyzmq/pyzmq-15.4.0/zmq/tests/test_monitor.py | 83 -- pyzmq/pyzmq-15.4.0/zmq/tests/test_monqueue.py | 227 ----- .../pyzmq-15.4.0/zmq/tests/test_multipart.py | 35 - pyzmq/pyzmq-15.4.0/zmq/tests/test_pair.py | 53 -- pyzmq/pyzmq-15.4.0/zmq/tests/test_poll.py | 229 ----- pyzmq/pyzmq-15.4.0/zmq/tests/test_pubsub.py | 41 - pyzmq/pyzmq-15.4.0/zmq/tests/test_reqrep.py | 62 -- .../zmq/tests/test_retry_eintr.py | 94 -- pyzmq/pyzmq-15.4.0/zmq/tests/test_security.py | 212 ----- pyzmq/pyzmq-15.4.0/zmq/tests/test_socket.py | 522 ----------- pyzmq/pyzmq-15.4.0/zmq/tests/test_ssh.py | 8 - .../pyzmq-15.4.0/zmq/tests/test_stopwatch.py | 42 - pyzmq/pyzmq-15.4.0/zmq/tests/test_version.py | 44 - .../pyzmq-15.4.0/zmq/tests/test_win32_shim.py | 61 -- pyzmq/pyzmq-15.4.0/zmq/tests/test_z85.py | 63 -- .../pyzmq-15.4.0/zmq/tests/test_zmqstream.py | 34 - xz/xz-5.2.2/tests/Makefile.am | 57 -- xz/xz-5.2.2/tests/Makefile.in | 845 ------------------ xz/xz-5.2.2/tests/bcj_test.c | 65 -- xz/xz-5.2.2/tests/compress_prepared_bcj_sparc | Bin 1240 -> 0 bytes xz/xz-5.2.2/tests/compress_prepared_bcj_x86 | Bin 1388 -> 0 bytes xz/xz-5.2.2/tests/create_compress_files.c | 158 ---- xz/xz-5.2.2/tests/files/README | 240 ----- .../tests/files/bad-0-backward_size.xz | Bin 32 -> 0 bytes .../tests/files/bad-0-empty-truncated.xz | Bin 31 -> 0 bytes xz/xz-5.2.2/tests/files/bad-0-footer_magic.xz | Bin 32 -> 0 bytes xz/xz-5.2.2/tests/files/bad-0-header_magic.xz | Bin 32 -> 0 bytes .../tests/files/bad-0-nonempty_index.xz | Bin 32 -> 0 bytes xz/xz-5.2.2/tests/files/bad-0cat-alone.xz | Bin 55 -> 0 bytes .../tests/files/bad-0cat-header_magic.xz | Bin 64 -> 0 bytes xz/xz-5.2.2/tests/files/bad-0catpad-empty.xz | Bin 69 -> 0 bytes xz/xz-5.2.2/tests/files/bad-0pad-empty.xz | Bin 37 -> 0 bytes .../tests/files/bad-1-block_header-1.xz | Bin 64 -> 0 bytes .../tests/files/bad-1-block_header-2.xz | Bin 64 -> 0 bytes .../tests/files/bad-1-block_header-3.xz | Bin 68 -> 0 bytes .../tests/files/bad-1-block_header-4.xz | Bin 76 -> 0 bytes .../tests/files/bad-1-block_header-5.xz | Bin 72 -> 0 bytes .../tests/files/bad-1-block_header-6.xz | Bin 72 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-check-crc32.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-check-crc64.xz | Bin 72 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-check-sha256.xz | Bin 96 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-1.xz | Bin 64 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-2.xz | Bin 424 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-3.xz | Bin 424 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-4.xz | Bin 408 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-5.xz | Bin 408 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-6.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-7.xz | Bin 408 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-lzma2-8.xz | Bin 464 -> 0 bytes .../tests/files/bad-1-stream_flags-1.xz | Bin 68 -> 0 bytes .../tests/files/bad-1-stream_flags-2.xz | Bin 68 -> 0 bytes .../tests/files/bad-1-stream_flags-3.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-vli-1.xz | Bin 72 -> 0 bytes xz/xz-5.2.2/tests/files/bad-1-vli-2.xz | Bin 76 -> 0 bytes .../files/bad-2-compressed_data_padding.xz | Bin 92 -> 0 bytes xz/xz-5.2.2/tests/files/bad-2-index-1.xz | Bin 92 -> 0 bytes xz/xz-5.2.2/tests/files/bad-2-index-2.xz | Bin 92 -> 0 bytes xz/xz-5.2.2/tests/files/bad-2-index-3.xz | Bin 92 -> 0 bytes xz/xz-5.2.2/tests/files/bad-2-index-4.xz | Bin 92 -> 0 bytes xz/xz-5.2.2/tests/files/bad-2-index-5.xz | Bin 92 -> 0 bytes xz/xz-5.2.2/tests/files/good-0-empty.xz | Bin 32 -> 0 bytes xz/xz-5.2.2/tests/files/good-0cat-empty.xz | Bin 64 -> 0 bytes xz/xz-5.2.2/tests/files/good-0catpad-empty.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/good-0pad-empty.xz | Bin 36 -> 0 bytes .../tests/files/good-1-3delta-lzma2.xz | Bin 528 -> 0 bytes .../tests/files/good-1-block_header-1.xz | Bin 72 -> 0 bytes .../tests/files/good-1-block_header-2.xz | Bin 68 -> 0 bytes .../tests/files/good-1-block_header-3.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-check-crc32.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-check-crc64.xz | Bin 72 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-check-none.xz | Bin 64 -> 0 bytes .../tests/files/good-1-check-sha256.xz | Bin 96 -> 0 bytes .../tests/files/good-1-delta-lzma2.tiff.xz | Bin 51316 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-lzma2-1.xz | Bin 424 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-lzma2-2.xz | Bin 424 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-lzma2-3.xz | Bin 408 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-lzma2-4.xz | Bin 464 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-lzma2-5.xz | Bin 52 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-sparc-lzma2.xz | Bin 612 -> 0 bytes xz/xz-5.2.2/tests/files/good-1-x86-lzma2.xz | Bin 716 -> 0 bytes xz/xz-5.2.2/tests/files/good-2-lzma2.xz | Bin 92 -> 0 bytes .../tests/files/unsupported-block_header.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/files/unsupported-check.xz | Bin 68 -> 0 bytes .../tests/files/unsupported-filter_flags-1.xz | Bin 68 -> 0 bytes .../tests/files/unsupported-filter_flags-2.xz | Bin 68 -> 0 bytes .../tests/files/unsupported-filter_flags-3.xz | Bin 68 -> 0 bytes xz/xz-5.2.2/tests/test_bcj_exact_size.c | 113 --- xz/xz-5.2.2/tests/test_block_header.c | 240 ----- xz/xz-5.2.2/tests/test_check.c | 83 -- xz/xz-5.2.2/tests/test_compress.sh | 142 --- xz/xz-5.2.2/tests/test_files.sh | 57 -- xz/xz-5.2.2/tests/test_filter_flags.c | 258 ------ xz/xz-5.2.2/tests/test_index.c | 659 -------------- xz/xz-5.2.2/tests/test_scripts.sh | 76 -- xz/xz-5.2.2/tests/test_stream_flags.c | 180 ---- xz/xz-5.2.2/tests/tests.h | 124 --- xz/xz-5.2.2/tests/xzgrep_expected_output | 39 - .../zeromq-4.1.4/tests/test_abstract_ipc.cpp | 67 -- .../tests/test_bind_src_address.cpp | 57 -- .../zeromq-4.1.4/tests/test_capabilities.cpp | 71 -- zeromq/zeromq-4.1.4/tests/test_conflate.cpp | 82 -- .../tests/test_connect_delay_tipc.cpp | 248 ----- .../tests/test_connect_resolve.cpp | 70 -- .../zeromq-4.1.4/tests/test_connect_rid.cpp | 194 ---- .../zeromq-4.1.4/tests/test_ctx_destroy.cpp | 100 --- .../zeromq-4.1.4/tests/test_ctx_options.cpp | 69 -- zeromq/zeromq-4.1.4/tests/test_diffserv.cpp | 80 -- .../tests/test_disconnect_inproc.cpp | 135 --- zeromq/zeromq-4.1.4/tests/test_filter_ipc.cpp | 171 ---- zeromq/zeromq-4.1.4/tests/test_fork.cpp | 91 -- .../tests/test_getsockopt_memset.cpp | 69 -- zeromq/zeromq-4.1.4/tests/test_hwm.cpp | 309 ------- zeromq/zeromq-4.1.4/tests/test_hwm_pubsub.cpp | 171 ---- zeromq/zeromq-4.1.4/tests/test_immediate.cpp | 238 ----- .../tests/test_inproc_connect.cpp | 489 ---------- .../zeromq-4.1.4/tests/test_invalid_rep.cpp | 98 -- zeromq/zeromq-4.1.4/tests/test_iov.cpp | 116 --- .../zeromq-4.1.4/tests/test_ipc_wildcard.cpp | 65 -- zeromq/zeromq-4.1.4/tests/test_issue_566.cpp | 95 -- .../zeromq-4.1.4/tests/test_last_endpoint.cpp | 66 -- .../zeromq-4.1.4/tests/test_many_sockets.cpp | 100 --- zeromq/zeromq-4.1.4/tests/test_metadata.cpp | 129 --- zeromq/zeromq-4.1.4/tests/test_monitor.cpp | 138 --- zeromq/zeromq-4.1.4/tests/test_msg_flags.cpp | 127 --- .../zeromq-4.1.4/tests/test_pair_inproc.cpp | 81 -- zeromq/zeromq-4.1.4/tests/test_pair_ipc.cpp | 60 -- zeromq/zeromq-4.1.4/tests/test_pair_tcp.cpp | 60 -- zeromq/zeromq-4.1.4/tests/test_pair_tipc.cpp | 64 -- .../zeromq-4.1.4/tests/test_probe_router.cpp | 82 -- zeromq/zeromq-4.1.4/tests/test_proxy.cpp | 261 ------ .../tests/test_proxy_single_socket.cpp | 113 --- .../tests/test_proxy_terminate.cpp | 123 --- .../zeromq-4.1.4/tests/test_req_correlate.cpp | 187 ---- .../zeromq-4.1.4/tests/test_req_relaxed.cpp | 126 --- .../zeromq-4.1.4/tests/test_reqrep_device.cpp | 145 --- .../tests/test_reqrep_device_tipc.cpp | 153 ---- .../zeromq-4.1.4/tests/test_reqrep_inproc.cpp | 60 -- zeromq/zeromq-4.1.4/tests/test_reqrep_ipc.cpp | 60 -- zeromq/zeromq-4.1.4/tests/test_reqrep_tcp.cpp | 60 -- .../zeromq-4.1.4/tests/test_reqrep_tipc.cpp | 64 -- .../tests/test_router_handover.cpp | 111 --- .../tests/test_router_mandatory.cpp | 91 -- .../tests/test_router_mandatory_hwm.cpp | 126 --- .../tests/test_router_mandatory_tipc.cpp | 72 -- .../tests/test_security_curve.cpp | 291 ------ .../zeromq-4.1.4/tests/test_security_null.cpp | 187 ---- .../tests/test_security_plain.cpp | 195 ---- .../tests/test_shutdown_stress.cpp | 90 -- .../tests/test_shutdown_stress_tipc.cpp | 103 --- .../zeromq-4.1.4/tests/test_spec_dealer.cpp | 264 ------ .../zeromq-4.1.4/tests/test_spec_pushpull.cpp | 303 ------- zeromq/zeromq-4.1.4/tests/test_spec_rep.cpp | 165 ---- zeromq/zeromq-4.1.4/tests/test_spec_req.cpp | 263 ------ .../zeromq-4.1.4/tests/test_spec_router.cpp | 214 ----- zeromq/zeromq-4.1.4/tests/test_srcfd.cpp | 109 --- zeromq/zeromq-4.1.4/tests/test_stream.cpp | 292 ------ .../tests/test_stream_disconnect.cpp | 268 ------ .../zeromq-4.1.4/tests/test_stream_empty.cpp | 70 -- .../tests/test_stream_timeout.cpp | 226 ----- .../zeromq-4.1.4/tests/test_sub_forward.cpp | 101 --- .../tests/test_sub_forward_tipc.cpp | 111 --- zeromq/zeromq-4.1.4/tests/test_system.cpp | 99 -- .../zeromq-4.1.4/tests/test_term_endpoint.cpp | 167 ---- .../tests/test_term_endpoint_tipc.cpp | 130 --- zeromq/zeromq-4.1.4/tests/test_timeo.cpp | 85 -- .../zeromq-4.1.4/tests/test_unbind_inproc.cpp | 43 - .../tests/test_unbind_wildcard.cpp | 48 - .../zeromq-4.1.4/tests/test_xpub_nodrop.cpp | 116 --- zeromq/zeromq-4.1.4/tests/testutil.hpp | 303 ------- 197 files changed, 18283 deletions(-) delete mode 100644 nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/math/basic.py delete mode 100644 nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/mymodule/my_function.py delete mode 100644 nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/strings/cat.py delete mode 100644 nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/testlib.py delete mode 100644 nose/nose-1.3.7/functional_tests/support/coverage/tests/test_covered.py delete mode 100644 nose/nose-1.3.7/functional_tests/support/coverage2/tests/test_covered.py delete mode 100644 nose/nose-1.3.7/functional_tests/support/package1/tests/test_example_function.py delete mode 100644 nose/nose-1.3.7/functional_tests/support/package3/tests/test_a.py delete mode 100644 nose/nose-1.3.7/functional_tests/support/package3/tests/test_b.py delete mode 100644 nose/nose-1.3.7/unit_tests/support/foo/tests/dir_test_file.py delete mode 100644 nose/nose-1.3.7/unit_tests/support/pkgorg/tests/test_mod.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/__init__.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/__init__.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/_test_asyncio.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/test_asyncio.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_auth.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_cffi_backend.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_constants.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_context.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_decorators.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_device.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_error.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_etc.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_future.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_imports.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_ioloop.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_log.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_message.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_monitor.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_monqueue.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_multipart.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_pair.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_poll.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_pubsub.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_reqrep.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_retry_eintr.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_security.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_socket.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_ssh.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_stopwatch.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_version.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_win32_shim.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_z85.py delete mode 100644 pyzmq/pyzmq-15.4.0/zmq/tests/test_zmqstream.py delete mode 100644 xz/xz-5.2.2/tests/Makefile.am delete mode 100644 xz/xz-5.2.2/tests/Makefile.in delete mode 100644 xz/xz-5.2.2/tests/bcj_test.c delete mode 100644 xz/xz-5.2.2/tests/compress_prepared_bcj_sparc delete mode 100644 xz/xz-5.2.2/tests/compress_prepared_bcj_x86 delete mode 100644 xz/xz-5.2.2/tests/create_compress_files.c delete mode 100644 xz/xz-5.2.2/tests/files/README delete mode 100644 xz/xz-5.2.2/tests/files/bad-0-backward_size.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0-empty-truncated.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0-footer_magic.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0-header_magic.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0-nonempty_index.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0cat-alone.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0cat-header_magic.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0catpad-empty.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-0pad-empty.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-block_header-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-block_header-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-block_header-3.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-block_header-4.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-block_header-5.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-block_header-6.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-check-crc32.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-check-crc64.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-check-sha256.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-3.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-4.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-5.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-6.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-7.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-lzma2-8.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-stream_flags-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-stream_flags-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-stream_flags-3.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-vli-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-1-vli-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-2-compressed_data_padding.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-2-index-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-2-index-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-2-index-3.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-2-index-4.xz delete mode 100644 xz/xz-5.2.2/tests/files/bad-2-index-5.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-0-empty.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-0cat-empty.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-0catpad-empty.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-0pad-empty.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-3delta-lzma2.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-block_header-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-block_header-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-block_header-3.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-check-crc32.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-check-crc64.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-check-none.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-check-sha256.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-delta-lzma2.tiff.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-lzma2-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-lzma2-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-lzma2-3.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-lzma2-4.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-lzma2-5.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-sparc-lzma2.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-1-x86-lzma2.xz delete mode 100644 xz/xz-5.2.2/tests/files/good-2-lzma2.xz delete mode 100644 xz/xz-5.2.2/tests/files/unsupported-block_header.xz delete mode 100644 xz/xz-5.2.2/tests/files/unsupported-check.xz delete mode 100644 xz/xz-5.2.2/tests/files/unsupported-filter_flags-1.xz delete mode 100644 xz/xz-5.2.2/tests/files/unsupported-filter_flags-2.xz delete mode 100644 xz/xz-5.2.2/tests/files/unsupported-filter_flags-3.xz delete mode 100644 xz/xz-5.2.2/tests/test_bcj_exact_size.c delete mode 100644 xz/xz-5.2.2/tests/test_block_header.c delete mode 100644 xz/xz-5.2.2/tests/test_check.c delete mode 100755 xz/xz-5.2.2/tests/test_compress.sh delete mode 100755 xz/xz-5.2.2/tests/test_files.sh delete mode 100644 xz/xz-5.2.2/tests/test_filter_flags.c delete mode 100644 xz/xz-5.2.2/tests/test_index.c delete mode 100755 xz/xz-5.2.2/tests/test_scripts.sh delete mode 100644 xz/xz-5.2.2/tests/test_stream_flags.c delete mode 100644 xz/xz-5.2.2/tests/tests.h delete mode 100644 xz/xz-5.2.2/tests/xzgrep_expected_output delete mode 100644 zeromq/zeromq-4.1.4/tests/test_abstract_ipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_bind_src_address.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_capabilities.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_conflate.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_connect_delay_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_connect_resolve.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_connect_rid.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_ctx_destroy.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_ctx_options.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_diffserv.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_disconnect_inproc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_filter_ipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_fork.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_getsockopt_memset.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_hwm.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_hwm_pubsub.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_immediate.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_inproc_connect.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_invalid_rep.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_iov.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_ipc_wildcard.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_issue_566.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_last_endpoint.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_many_sockets.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_metadata.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_monitor.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_msg_flags.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_pair_inproc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_pair_ipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_pair_tcp.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_pair_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_probe_router.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_proxy.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_proxy_single_socket.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_proxy_terminate.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_req_correlate.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_req_relaxed.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_reqrep_device.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_reqrep_device_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_reqrep_inproc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_reqrep_ipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_reqrep_tcp.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_reqrep_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_router_handover.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_router_mandatory.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_router_mandatory_hwm.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_router_mandatory_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_security_curve.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_security_null.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_security_plain.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_shutdown_stress.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_shutdown_stress_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_spec_dealer.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_spec_pushpull.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_spec_rep.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_spec_req.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_spec_router.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_srcfd.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_stream.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_stream_disconnect.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_stream_empty.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_stream_timeout.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_sub_forward.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_sub_forward_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_system.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_term_endpoint.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_term_endpoint_tipc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_timeo.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_unbind_inproc.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_unbind_wildcard.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/test_xpub_nodrop.cpp delete mode 100644 zeromq/zeromq-4.1.4/tests/testutil.hpp diff --git a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/math/basic.py b/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/math/basic.py deleted file mode 100644 index 7639ddced0..0000000000 --- a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/math/basic.py +++ /dev/null @@ -1,17 +0,0 @@ -import testlib -from mypackage import math - - -class TestBasicMath(testlib.Base): - - def test_add(self): - self.assertEqual(math.add(1, 2), 3) - - def test_sub(self): - self.assertEqual(math.sub(3, 1), 2) - - -class TestHelperClass: - def __init__(self): - raise Exception( - "This test helper class should not be collected") diff --git a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/mymodule/my_function.py b/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/mymodule/my_function.py deleted file mode 100644 index 85808c9be2..0000000000 --- a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/mymodule/my_function.py +++ /dev/null @@ -1,7 +0,0 @@ -import mymodule -import testlib - -class MyFunction(testlib.Base): - - def test_tuple_groups(self): - self.assertEqual(mymodule.my_function(1, 2, 3), (1, (2, 3))) diff --git a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/strings/cat.py b/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/strings/cat.py deleted file mode 100644 index 3b410e86e2..0000000000 --- a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/strings/cat.py +++ /dev/null @@ -1,12 +0,0 @@ -import testlib -from mypackage import strings - -class StringsCat(testlib.Base): - - def test_cat(self): - self.assertEqual(strings.cat('one', 'two'), 'onetwo') - - -def test_helper_function(): - raise Exception( - "This test helper function should not be collected") diff --git a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/testlib.py b/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/testlib.py deleted file mode 100644 index 92c4f96ac2..0000000000 --- a/nose/nose-1.3.7/functional_tests/doc_tests/test_selector_plugin/support/tests/testlib.py +++ /dev/null @@ -1,6 +0,0 @@ -import unittest - -class Base(unittest.TestCase): - """Use this base class for all tests. - """ - pass diff --git a/nose/nose-1.3.7/functional_tests/support/coverage/tests/test_covered.py b/nose/nose-1.3.7/functional_tests/support/coverage/tests/test_covered.py deleted file mode 100644 index c669c5cdd4..0000000000 --- a/nose/nose-1.3.7/functional_tests/support/coverage/tests/test_covered.py +++ /dev/null @@ -1,4 +0,0 @@ -import blah - -def test_blah(): - blah.dostuff() diff --git a/nose/nose-1.3.7/functional_tests/support/coverage2/tests/test_covered.py b/nose/nose-1.3.7/functional_tests/support/coverage2/tests/test_covered.py deleted file mode 100644 index 034f98402b..0000000000 --- a/nose/nose-1.3.7/functional_tests/support/coverage2/tests/test_covered.py +++ /dev/null @@ -1,8 +0,0 @@ -import blah -import moo - -def test_blah(): - blah.dostuff() - -def test_moo(): - moo.dostuff() diff --git a/nose/nose-1.3.7/functional_tests/support/package1/tests/test_example_function.py b/nose/nose-1.3.7/functional_tests/support/package1/tests/test_example_function.py deleted file mode 100644 index d74f2a5c3b..0000000000 --- a/nose/nose-1.3.7/functional_tests/support/package1/tests/test_example_function.py +++ /dev/null @@ -1,15 +0,0 @@ -import example -import unittest - -class TestExampleFunction_TestCase(unittest.TestCase): - def test_times_two(self): - self.assertEqual(example.times_two(2), 4) - - -class TestExampleFunction: - def test_times_two(self): - assert example.times_two(2) == 4 - - -def test_times_two(): - assert example.times_two(2) == 4 diff --git a/nose/nose-1.3.7/functional_tests/support/package3/tests/test_a.py b/nose/nose-1.3.7/functional_tests/support/package3/tests/test_a.py deleted file mode 100644 index 3b978fcd6a..0000000000 --- a/nose/nose-1.3.7/functional_tests/support/package3/tests/test_a.py +++ /dev/null @@ -1,4 +0,0 @@ -import a - -def test_a(): - a.a() diff --git a/nose/nose-1.3.7/functional_tests/support/package3/tests/test_b.py b/nose/nose-1.3.7/functional_tests/support/package3/tests/test_b.py deleted file mode 100644 index d8c182a126..0000000000 --- a/nose/nose-1.3.7/functional_tests/support/package3/tests/test_b.py +++ /dev/null @@ -1,4 +0,0 @@ -import b - -def test_b(): - b.b() diff --git a/nose/nose-1.3.7/unit_tests/support/foo/tests/dir_test_file.py b/nose/nose-1.3.7/unit_tests/support/foo/tests/dir_test_file.py deleted file mode 100644 index 79b86ece65..0000000000 --- a/nose/nose-1.3.7/unit_tests/support/foo/tests/dir_test_file.py +++ /dev/null @@ -1,3 +0,0 @@ -# test file in test dir in a package -def test_foo(): - pass diff --git a/nose/nose-1.3.7/unit_tests/support/pkgorg/tests/test_mod.py b/nose/nose-1.3.7/unit_tests/support/pkgorg/tests/test_mod.py deleted file mode 100644 index 2516258e85..0000000000 --- a/nose/nose-1.3.7/unit_tests/support/pkgorg/tests/test_mod.py +++ /dev/null @@ -1,4 +0,0 @@ -import modernity - -def test(): - pass diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/__init__.py b/pyzmq/pyzmq-15.4.0/zmq/tests/__init__.py deleted file mode 100644 index 9d4b1d56f1..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/__init__.py +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright (c) PyZMQ Developers. -# Distributed under the terms of the Modified BSD License. - -import sys -import time -from threading import Thread - -from unittest import TestCase -try: - from unittest import SkipTest -except ImportError: - from unittest2 import SkipTest - -from pytest import mark -import zmq -from zmq.utils import jsonapi - -try: - import gevent - from zmq import green as gzmq - have_gevent = True -except ImportError: - have_gevent = False - - -PYPY = 'PyPy' in sys.version - -#----------------------------------------------------------------------------- -# skip decorators (directly from unittest) -#----------------------------------------------------------------------------- - -_id = lambda x: x - -skip_pypy = mark.skipif(PYPY, reason="Doesn't work on PyPy") -require_zmq_4 = mark.skipif(zmq.zmq_version_info() < (4,), reason="requires zmq >= 4") - -#----------------------------------------------------------------------------- -# Base test class -#----------------------------------------------------------------------------- - -class BaseZMQTestCase(TestCase): - green = False - - @property - def Context(self): - if self.green: - return gzmq.Context - else: - return zmq.Context - - def socket(self, socket_type): - s = self.context.socket(socket_type) - self.sockets.append(s) - return s - - def setUp(self): - super(BaseZMQTestCase, self).setUp() - if self.green and not have_gevent: - raise SkipTest("requires gevent") - self.context = self.Context.instance() - self.sockets = [] - - def tearDown(self): - contexts = set([self.context]) - while self.sockets: - sock = self.sockets.pop() - contexts.add(sock.context) # in case additional contexts are created - sock.close(0) - for ctx in contexts: - t = Thread(target=ctx.term) - t.daemon = True - t.start() - t.join(timeout=2) - if t.is_alive(): - # reset Context.instance, so the failure to term doesn't corrupt subsequent tests - zmq.sugar.context.Context._instance = None - raise RuntimeError("context could not terminate, open sockets likely remain in test") - super(BaseZMQTestCase, self).tearDown() - - def create_bound_pair(self, type1=zmq.PAIR, type2=zmq.PAIR, interface='tcp://127.0.0.1'): - """Create a bound socket pair using a random port.""" - s1 = self.context.socket(type1) - s1.setsockopt(zmq.LINGER, 0) - port = s1.bind_to_random_port(interface) - s2 = self.context.socket(type2) - s2.setsockopt(zmq.LINGER, 0) - s2.connect('%s:%s' % (interface, port)) - self.sockets.extend([s1,s2]) - return s1, s2 - - def ping_pong(self, s1, s2, msg): - s1.send(msg) - msg2 = s2.recv() - s2.send(msg2) - msg3 = s1.recv() - return msg3 - - def ping_pong_json(self, s1, s2, o): - if jsonapi.jsonmod is None: - raise SkipTest("No json library") - s1.send_json(o) - o2 = s2.recv_json() - s2.send_json(o2) - o3 = s1.recv_json() - return o3 - - def ping_pong_pyobj(self, s1, s2, o): - s1.send_pyobj(o) - o2 = s2.recv_pyobj() - s2.send_pyobj(o2) - o3 = s1.recv_pyobj() - return o3 - - def assertRaisesErrno(self, errno, func, *args, **kwargs): - try: - func(*args, **kwargs) - except zmq.ZMQError as e: - self.assertEqual(e.errno, errno, "wrong error raised, expected '%s' \ -got '%s'" % (zmq.ZMQError(errno), zmq.ZMQError(e.errno))) - else: - self.fail("Function did not raise any error") - - def _select_recv(self, multipart, socket, **kwargs): - """call recv[_multipart] in a way that raises if there is nothing to receive""" - if zmq.zmq_version_info() >= (3,1,0): - # zmq 3.1 has a bug, where poll can return false positives, - # so we wait a little bit just in case - # See LIBZMQ-280 on JIRA - time.sleep(0.1) - - r,w,x = zmq.select([socket], [], [], timeout=5) - assert len(r) > 0, "Should have received a message" - kwargs['flags'] = zmq.DONTWAIT | kwargs.get('flags', 0) - - recv = socket.recv_multipart if multipart else socket.recv - return recv(**kwargs) - - def recv(self, socket, **kwargs): - """call recv in a way that raises if there is nothing to receive""" - return self._select_recv(False, socket, **kwargs) - - def recv_multipart(self, socket, **kwargs): - """call recv_multipart in a way that raises if there is nothing to receive""" - return self._select_recv(True, socket, **kwargs) - - -class PollZMQTestCase(BaseZMQTestCase): - pass - -class GreenTest: - """Mixin for making green versions of test classes""" - green = True - - def assertRaisesErrno(self, errno, func, *args, **kwargs): - if errno == zmq.EAGAIN: - raise SkipTest("Skipping because we're green.") - try: - func(*args, **kwargs) - except zmq.ZMQError: - e = sys.exc_info()[1] - self.assertEqual(e.errno, errno, "wrong error raised, expected '%s' \ -got '%s'" % (zmq.ZMQError(errno), zmq.ZMQError(e.errno))) - else: - self.fail("Function did not raise any error") - - def tearDown(self): - contexts = set([self.context]) - while self.sockets: - sock = self.sockets.pop() - contexts.add(sock.context) # in case additional contexts are created - sock.close() - try: - gevent.joinall([gevent.spawn(ctx.term) for ctx in contexts], timeout=2, raise_error=True) - except gevent.Timeout: - raise RuntimeError("context could not terminate, open sockets likely remain in test") - - def skip_green(self): - raise SkipTest("Skipping because we are green") - -def skip_green(f): - def skipping_test(self, *args, **kwargs): - if self.green: - raise SkipTest("Skipping because we are green") - else: - return f(self, *args, **kwargs) - return skipping_test diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/__init__.py b/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/_test_asyncio.py b/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/_test_asyncio.py deleted file mode 100644 index d0aabade51..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/_test_asyncio.py +++ /dev/null @@ -1,280 +0,0 @@ -"""Test asyncio support""" -# Copyright (c) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import sys - -from pytest import mark - -import zmq -from zmq.utils.strtypes import u - -try: - import asyncio - import zmq.asyncio as zaio - from zmq.auth.asyncio import AsyncioAuthenticator -except ImportError: - if sys.version_info >= (3,4): - raise - asyncio = None - -from zmq.tests import BaseZMQTestCase, SkipTest -from zmq.tests.test_auth import TestThreadAuthentication - - -class TestAsyncIOSocket(BaseZMQTestCase): - if asyncio is not None: - Context = zaio.Context - - def setUp(self): - if asyncio is None: - raise SkipTest() - self.loop = zaio.ZMQEventLoop() - asyncio.set_event_loop(self.loop) - super(TestAsyncIOSocket, self).setUp() - - def tearDown(self): - self.loop.close() - super().tearDown() - - def test_socket_class(self): - s = self.context.socket(zmq.PUSH) - assert isinstance(s, zaio.Socket) - s.close() - - def test_recv_multipart(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_multipart() - assert not f.done() - yield from a.send(b'hi') - recvd = yield from f - self.assertEqual(recvd, [b'hi']) - self.loop.run_until_complete(test()) - - def test_recv(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f1 = b.recv() - f2 = b.recv() - assert not f1.done() - assert not f2.done() - yield from a.send_multipart([b'hi', b'there']) - recvd = yield from f2 - assert f1.done() - self.assertEqual(f1.result(), b'hi') - self.assertEqual(recvd, b'there') - self.loop.run_until_complete(test()) - - @mark.skipif(not hasattr(zmq, 'RCVTIMEO'), reason="requires RCVTIMEO") - def test_recv_timeout(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - b.rcvtimeo = 100 - f1 = b.recv() - b.rcvtimeo = 1000 - f2 = b.recv_multipart() - with self.assertRaises(zmq.Again): - yield from f1 - yield from a.send_multipart([b'hi', b'there']) - recvd = yield from f2 - assert f2.done() - self.assertEqual(recvd, [b'hi', b'there']) - self.loop.run_until_complete(test()) - - @mark.skipif(not hasattr(zmq, 'SNDTIMEO'), reason="requires SNDTIMEO") - def test_send_timeout(self): - @asyncio.coroutine - def test(): - s = self.socket(zmq.PUSH) - s.sndtimeo = 100 - with self.assertRaises(zmq.Again): - yield from s.send(b'not going anywhere') - self.loop.run_until_complete(test()) - - def test_recv_string(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_string() - assert not f.done() - msg = u('πøøπ') - yield from a.send_string(msg) - recvd = yield from f - assert f.done() - self.assertEqual(f.result(), msg) - self.assertEqual(recvd, msg) - self.loop.run_until_complete(test()) - - def test_recv_json(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_json() - assert not f.done() - obj = dict(a=5) - yield from a.send_json(obj) - recvd = yield from f - assert f.done() - self.assertEqual(f.result(), obj) - self.assertEqual(recvd, obj) - self.loop.run_until_complete(test()) - - def test_recv_pyobj(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_pyobj() - assert not f.done() - obj = dict(a=5) - yield from a.send_pyobj(obj) - recvd = yield from f - assert f.done() - self.assertEqual(f.result(), obj) - self.assertEqual(recvd, obj) - self.loop.run_until_complete(test()) - - def test_recv_dontwait(self): - @asyncio.coroutine - def test(): - push, pull = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = pull.recv(zmq.DONTWAIT) - with self.assertRaises(zmq.Again): - yield from f - yield from push.send(b'ping') - yield from pull.poll() # ensure message will be waiting - f = pull.recv(zmq.DONTWAIT) - assert f.done() - msg = yield from f - self.assertEqual(msg, b'ping') - self.loop.run_until_complete(test()) - - def test_recv_cancel(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f1 = b.recv() - f2 = b.recv_multipart() - assert f1.cancel() - assert f1.done() - assert not f2.done() - yield from a.send_multipart([b'hi', b'there']) - recvd = yield from f2 - assert f1.cancelled() - assert f2.done() - self.assertEqual(recvd, [b'hi', b'there']) - self.loop.run_until_complete(test()) - - def test_poll(self): - @asyncio.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.poll(timeout=0) - yield from asyncio.sleep(0) - self.assertEqual(f.result(), 0) - - f = b.poll(timeout=1) - assert not f.done() - evt = yield from f - - self.assertEqual(evt, 0) - - f = b.poll(timeout=1000) - assert not f.done() - yield from a.send_multipart([b'hi', b'there']) - evt = yield from f - self.assertEqual(evt, zmq.POLLIN) - recvd = yield from b.recv_multipart() - self.assertEqual(recvd, [b'hi', b'there']) - self.loop.run_until_complete(test()) - - def test_aiohttp(self): - try: - import aiohttp - except ImportError: - raise SkipTest("Requires aiohttp") - from aiohttp import web - - zmq.asyncio.install() - - @asyncio.coroutine - def echo(request): - print(request.path) - return web.Response(body=str(request).encode('utf8')) - - @asyncio.coroutine - def server(loop): - app = web.Application(loop=loop) - app.router.add_route('GET', '/', echo) - - srv = yield from loop.create_server(app.make_handler(), - '127.0.0.1', 8080) - print("Server started at http://127.0.0.1:8080") - return srv - - @asyncio.coroutine - def client(): - push, pull = self.create_bound_pair(zmq.PUSH, zmq.PULL) - - res = yield from aiohttp.request('GET', 'http://127.0.0.1:8080/') - text = yield from res.text() - yield from push.send(text.encode('utf8')) - rcvd = yield from pull.recv() - self.assertEqual(rcvd.decode('utf8'), text) - - loop = asyncio.get_event_loop() - loop.run_until_complete(server(loop)) - print("servered") - loop.run_until_complete(client()) - - -class TestAsyncioAuthentication(TestThreadAuthentication): - """Test authentication running in a asyncio task""" - - if asyncio is not None: - Context = zaio.Context - - def shortDescription(self): - """Rewrite doc strings from TestThreadAuthentication from - 'threaded' to 'asyncio'. - """ - doc = self._testMethodDoc - if doc: - doc = doc.split("\n")[0].strip() - if doc.startswith('threaded auth'): - doc = doc.replace('threaded auth', 'asyncio auth') - return doc - - def setUp(self): - if asyncio is None: - raise SkipTest() - self.loop = zaio.ZMQEventLoop() - asyncio.set_event_loop(self.loop) - super().setUp() - - def tearDown(self): - super().tearDown() - self.loop.close() - - def make_auth(self): - return AsyncioAuthenticator(self.context) - - def can_connect(self, server, client): - """Check if client can connect to server using tcp transport""" - @asyncio.coroutine - def go(): - result = False - iface = 'tcp://127.0.0.1' - port = server.bind_to_random_port(iface) - client.connect("%s:%i" % (iface, port)) - msg = [b"Hello World"] - yield from server.send_multipart(msg) - if (yield from client.poll(1000)): - rcvd_msg = yield from client.recv_multipart() - self.assertEqual(rcvd_msg, msg) - result = True - return result - return self.loop.run_until_complete(go()) diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/test_asyncio.py b/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/test_asyncio.py deleted file mode 100644 index 49a41ad64e..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/asyncio/test_asyncio.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Test asyncio support""" - -try: - from ._test_asyncio import TestAsyncIOSocket, TestAsyncioAuthentication -except SyntaxError: - pass diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_auth.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_auth.py deleted file mode 100644 index 6f4e97f50b..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_auth.py +++ /dev/null @@ -1,435 +0,0 @@ -# -*- coding: utf8 -*- - -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import logging -import os -import shutil -import sys -import tempfile - -import zmq.auth -from zmq.auth.ioloop import IOLoopAuthenticator -from zmq.auth.thread import ThreadAuthenticator - -from zmq.eventloop import ioloop, zmqstream -from zmq.tests import (BaseZMQTestCase, SkipTest) - - -class BaseAuthTestCase(BaseZMQTestCase): - def setUp(self): - if zmq.zmq_version_info() < (4,0): - raise SkipTest("security is new in libzmq 4.0") - try: - zmq.curve_keypair() - except zmq.ZMQError: - raise SkipTest("security requires libzmq to have curve support") - super(BaseAuthTestCase, self).setUp() - # enable debug logging while we run tests - logging.getLogger('zmq.auth').setLevel(logging.DEBUG) - self.auth = self.make_auth() - self.auth.start() - self.base_dir, self.public_keys_dir, self.secret_keys_dir = self.create_certs() - - def make_auth(self): - raise NotImplementedError() - - def tearDown(self): - if self.auth: - self.auth.stop() - self.auth = None - self.remove_certs(self.base_dir) - super(BaseAuthTestCase, self).tearDown() - - def create_certs(self): - """Create CURVE certificates for a test""" - - # Create temporary CURVE keypairs for this test run. We create all keys in a - # temp directory and then move them into the appropriate private or public - # directory. - - base_dir = tempfile.mkdtemp() - keys_dir = os.path.join(base_dir, 'certificates') - public_keys_dir = os.path.join(base_dir, 'public_keys') - secret_keys_dir = os.path.join(base_dir, 'private_keys') - - os.mkdir(keys_dir) - os.mkdir(public_keys_dir) - os.mkdir(secret_keys_dir) - - server_public_file, server_secret_file = zmq.auth.create_certificates(keys_dir, "server") - client_public_file, client_secret_file = zmq.auth.create_certificates(keys_dir, "client") - - for key_file in os.listdir(keys_dir): - if key_file.endswith(".key"): - shutil.move(os.path.join(keys_dir, key_file), - os.path.join(public_keys_dir, '.')) - - for key_file in os.listdir(keys_dir): - if key_file.endswith(".key_secret"): - shutil.move(os.path.join(keys_dir, key_file), - os.path.join(secret_keys_dir, '.')) - - return (base_dir, public_keys_dir, secret_keys_dir) - - def remove_certs(self, base_dir): - """Remove certificates for a test""" - shutil.rmtree(base_dir) - - def load_certs(self, secret_keys_dir): - """Return server and client certificate keys""" - server_secret_file = os.path.join(secret_keys_dir, "server.key_secret") - client_secret_file = os.path.join(secret_keys_dir, "client.key_secret") - - server_public, server_secret = zmq.auth.load_certificate(server_secret_file) - client_public, client_secret = zmq.auth.load_certificate(client_secret_file) - - return server_public, server_secret, client_public, client_secret - - -class TestThreadAuthentication(BaseAuthTestCase): - """Test authentication running in a thread""" - - def make_auth(self): - return ThreadAuthenticator(self.context) - - def can_connect(self, server, client): - """Check if client can connect to server using tcp transport""" - result = False - iface = 'tcp://127.0.0.1' - port = server.bind_to_random_port(iface) - client.connect("%s:%i" % (iface, port)) - msg = [b"Hello World"] - if server.poll(1000, zmq.POLLOUT): - server.send_multipart(msg) - if client.poll(1000): - rcvd_msg = client.recv_multipart() - self.assertEqual(rcvd_msg, msg) - result = True - return result - - def test_null(self): - """threaded auth - NULL""" - # A default NULL connection should always succeed, and not - # go through our authentication infrastructure at all. - self.auth.stop() - self.auth = None - # use a new context, so ZAP isn't inherited - self.context = self.Context() - - server = self.socket(zmq.PUSH) - client = self.socket(zmq.PULL) - self.assertTrue(self.can_connect(server, client)) - - # By setting a domain we switch on authentication for NULL sockets, - # though no policies are configured yet. The client connection - # should still be allowed. - server = self.socket(zmq.PUSH) - server.zap_domain = b'global' - client = self.socket(zmq.PULL) - self.assertTrue(self.can_connect(server, client)) - - def test_blacklist(self): - """threaded auth - Blacklist""" - # Blacklist 127.0.0.1, connection should fail - self.auth.deny('127.0.0.1') - server = self.socket(zmq.PUSH) - # By setting a domain we switch on authentication for NULL sockets, - # though no policies are configured yet. - server.zap_domain = b'global' - client = self.socket(zmq.PULL) - self.assertFalse(self.can_connect(server, client)) - - def test_whitelist(self): - """threaded auth - Whitelist""" - # Whitelist 127.0.0.1, connection should pass" - self.auth.allow('127.0.0.1') - server = self.socket(zmq.PUSH) - # By setting a domain we switch on authentication for NULL sockets, - # though no policies are configured yet. - server.zap_domain = b'global' - client = self.socket(zmq.PULL) - self.assertTrue(self.can_connect(server, client)) - - def test_plain(self): - """threaded auth - PLAIN""" - - # Try PLAIN authentication - without configuring server, connection should fail - server = self.socket(zmq.PUSH) - server.plain_server = True - client = self.socket(zmq.PULL) - client.plain_username = b'admin' - client.plain_password = b'Password' - self.assertFalse(self.can_connect(server, client)) - - # Try PLAIN authentication - with server configured, connection should pass - server = self.socket(zmq.PUSH) - server.plain_server = True - client = self.socket(zmq.PULL) - client.plain_username = b'admin' - client.plain_password = b'Password' - self.auth.configure_plain(domain='*', passwords={'admin': 'Password'}) - self.assertTrue(self.can_connect(server, client)) - - # Try PLAIN authentication - with bogus credentials, connection should fail - server = self.socket(zmq.PUSH) - server.plain_server = True - client = self.socket(zmq.PULL) - client.plain_username = b'admin' - client.plain_password = b'Bogus' - self.assertFalse(self.can_connect(server, client)) - - # Remove authenticator and check that a normal connection works - self.auth.stop() - self.auth = None - - server = self.socket(zmq.PUSH) - client = self.socket(zmq.PULL) - self.assertTrue(self.can_connect(server, client)) - client.close() - server.close() - - def test_curve(self): - """threaded auth - CURVE""" - self.auth.allow('127.0.0.1') - certs = self.load_certs(self.secret_keys_dir) - server_public, server_secret, client_public, client_secret = certs - - #Try CURVE authentication - without configuring server, connection should fail - server = self.socket(zmq.PUSH) - server.curve_publickey = server_public - server.curve_secretkey = server_secret - server.curve_server = True - client = self.socket(zmq.PULL) - client.curve_publickey = client_public - client.curve_secretkey = client_secret - client.curve_serverkey = server_public - self.assertFalse(self.can_connect(server, client)) - - #Try CURVE authentication - with server configured to CURVE_ALLOW_ANY, connection should pass - self.auth.configure_curve(domain='*', location=zmq.auth.CURVE_ALLOW_ANY) - server = self.socket(zmq.PUSH) - server.curve_publickey = server_public - server.curve_secretkey = server_secret - server.curve_server = True - client = self.socket(zmq.PULL) - client.curve_publickey = client_public - client.curve_secretkey = client_secret - client.curve_serverkey = server_public - self.assertTrue(self.can_connect(server, client)) - - # Try CURVE authentication - with server configured, connection should pass - self.auth.configure_curve(domain='*', location=self.public_keys_dir) - server = self.socket(zmq.PUSH) - server.curve_publickey = server_public - server.curve_secretkey = server_secret - server.curve_server = True - client = self.socket(zmq.PULL) - client.curve_publickey = client_public - client.curve_secretkey = client_secret - client.curve_serverkey = server_public - self.assertTrue(self.can_connect(server, client)) - - # Remove authenticator and check that a normal connection works - self.auth.stop() - self.auth = None - - # Try connecting using NULL and no authentication enabled, connection should pass - server = self.socket(zmq.PUSH) - client = self.socket(zmq.PULL) - self.assertTrue(self.can_connect(server, client)) - - -def with_ioloop(method, expect_success=True): - """decorator for running tests with an IOLoop""" - def test_method(self): - r = method(self) - - loop = self.io_loop - if expect_success: - self.pullstream.on_recv(self.on_message_succeed) - else: - self.pullstream.on_recv(self.on_message_fail) - - loop.call_later(1, self.attempt_connection) - loop.call_later(1.2, self.send_msg) - - if expect_success: - loop.call_later(2, self.on_test_timeout_fail) - else: - loop.call_later(2, self.on_test_timeout_succeed) - - loop.start() - if self.fail_msg: - self.fail(self.fail_msg) - - return r - return test_method - -def should_auth(method): - return with_ioloop(method, True) - -def should_not_auth(method): - return with_ioloop(method, False) - -class TestIOLoopAuthentication(BaseAuthTestCase): - """Test authentication running in ioloop""" - - def setUp(self): - self.fail_msg = None - self.io_loop = ioloop.IOLoop() - super(TestIOLoopAuthentication, self).setUp() - self.server = self.socket(zmq.PUSH) - self.client = self.socket(zmq.PULL) - self.pushstream = zmqstream.ZMQStream(self.server, self.io_loop) - self.pullstream = zmqstream.ZMQStream(self.client, self.io_loop) - - def make_auth(self): - return IOLoopAuthenticator(self.context, io_loop=self.io_loop) - - def tearDown(self): - if self.auth: - self.auth.stop() - self.auth = None - self.io_loop.close(all_fds=True) - super(TestIOLoopAuthentication, self).tearDown() - - def attempt_connection(self): - """Check if client can connect to server using tcp transport""" - iface = 'tcp://127.0.0.1' - port = self.server.bind_to_random_port(iface) - self.client.connect("%s:%i" % (iface, port)) - - def send_msg(self): - """Send a message from server to a client""" - msg = [b"Hello World"] - self.pushstream.send_multipart(msg) - - def on_message_succeed(self, frames): - """A message was received, as expected.""" - if frames != [b"Hello World"]: - self.fail_msg = "Unexpected message received" - self.io_loop.stop() - - def on_message_fail(self, frames): - """A message was received, unexpectedly.""" - self.fail_msg = 'Received messaged unexpectedly, security failed' - self.io_loop.stop() - - def on_test_timeout_succeed(self): - """Test timer expired, indicates test success""" - self.io_loop.stop() - - def on_test_timeout_fail(self): - """Test timer expired, indicates test failure""" - self.fail_msg = 'Test timed out' - self.io_loop.stop() - - @should_auth - def test_none(self): - """ioloop auth - NONE""" - # A default NULL connection should always succeed, and not - # go through our authentication infrastructure at all. - # no auth should be running - self.auth.stop() - self.auth = None - - @should_auth - def test_null(self): - """ioloop auth - NULL""" - # By setting a domain we switch on authentication for NULL sockets, - # though no policies are configured yet. The client connection - # should still be allowed. - self.server.zap_domain = b'global' - - @should_not_auth - def test_blacklist(self): - """ioloop auth - Blacklist""" - # Blacklist 127.0.0.1, connection should fail - self.auth.deny('127.0.0.1') - self.server.zap_domain = b'global' - - @should_auth - def test_whitelist(self): - """ioloop auth - Whitelist""" - # Whitelist 127.0.0.1, which overrides the blacklist, connection should pass" - self.auth.allow('127.0.0.1') - - self.server.setsockopt(zmq.ZAP_DOMAIN, b'global') - - @should_not_auth - def test_plain_unconfigured_server(self): - """ioloop auth - PLAIN, unconfigured server""" - self.client.plain_username = b'admin' - self.client.plain_password = b'Password' - # Try PLAIN authentication - without configuring server, connection should fail - self.server.plain_server = True - - @should_auth - def test_plain_configured_server(self): - """ioloop auth - PLAIN, configured server""" - self.client.plain_username = b'admin' - self.client.plain_password = b'Password' - # Try PLAIN authentication - with server configured, connection should pass - self.server.plain_server = True - self.auth.configure_plain(domain='*', passwords={'admin': 'Password'}) - - @should_not_auth - def test_plain_bogus_credentials(self): - """ioloop auth - PLAIN, bogus credentials""" - self.client.plain_username = b'admin' - self.client.plain_password = b'Bogus' - self.server.plain_server = True - - self.auth.configure_plain(domain='*', passwords={'admin': 'Password'}) - - @should_not_auth - def test_curve_unconfigured_server(self): - """ioloop auth - CURVE, unconfigured server""" - certs = self.load_certs(self.secret_keys_dir) - server_public, server_secret, client_public, client_secret = certs - - self.auth.allow('127.0.0.1') - - self.server.curve_publickey = server_public - self.server.curve_secretkey = server_secret - self.server.curve_server = True - - self.client.curve_publickey = client_public - self.client.curve_secretkey = client_secret - self.client.curve_serverkey = server_public - - @should_auth - def test_curve_allow_any(self): - """ioloop auth - CURVE, CURVE_ALLOW_ANY""" - certs = self.load_certs(self.secret_keys_dir) - server_public, server_secret, client_public, client_secret = certs - - self.auth.allow('127.0.0.1') - self.auth.configure_curve(domain='*', location=zmq.auth.CURVE_ALLOW_ANY) - - self.server.curve_publickey = server_public - self.server.curve_secretkey = server_secret - self.server.curve_server = True - - self.client.curve_publickey = client_public - self.client.curve_secretkey = client_secret - self.client.curve_serverkey = server_public - - @should_auth - def test_curve_configured_server(self): - """ioloop auth - CURVE, configured server""" - self.auth.allow('127.0.0.1') - certs = self.load_certs(self.secret_keys_dir) - server_public, server_secret, client_public, client_secret = certs - - self.auth.configure_curve(domain='*', location=self.public_keys_dir) - - self.server.curve_publickey = server_public - self.server.curve_secretkey = server_secret - self.server.curve_server = True - - self.client.curve_publickey = client_public - self.client.curve_secretkey = client_secret - self.client.curve_serverkey = server_public diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_cffi_backend.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_cffi_backend.py deleted file mode 100644 index 73b0c17f45..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_cffi_backend.py +++ /dev/null @@ -1,310 +0,0 @@ -# -*- coding: utf8 -*- - -import sys -import time - -from unittest import TestCase - -from zmq.tests import BaseZMQTestCase, SkipTest - -try: - from zmq.backend.cffi import ( - zmq_version_info, - PUSH, PULL, IDENTITY, - REQ, REP, POLLIN, POLLOUT, - ) - from zmq.backend.cffi._cffi import ffi, C - have_ffi_backend = True -except ImportError: - have_ffi_backend = False - - -class TestCFFIBackend(TestCase): - - def setUp(self): - if not have_ffi_backend: - raise SkipTest('CFFI not available') - - def test_zmq_version_info(self): - version = zmq_version_info() - - assert version[0] in range(2,11) - - def test_zmq_ctx_new_destroy(self): - ctx = C.zmq_ctx_new() - - assert ctx != ffi.NULL - assert 0 == C.zmq_ctx_destroy(ctx) - - def test_zmq_socket_open_close(self): - ctx = C.zmq_ctx_new() - socket = C.zmq_socket(ctx, PUSH) - - assert ctx != ffi.NULL - assert ffi.NULL != socket - assert 0 == C.zmq_close(socket) - assert 0 == C.zmq_ctx_destroy(ctx) - - def test_zmq_setsockopt(self): - ctx = C.zmq_ctx_new() - socket = C.zmq_socket(ctx, PUSH) - - identity = ffi.new('char[3]', b'zmq') - ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3) - - assert ret == 0 - assert ctx != ffi.NULL - assert ffi.NULL != socket - assert 0 == C.zmq_close(socket) - assert 0 == C.zmq_ctx_destroy(ctx) - - def test_zmq_getsockopt(self): - ctx = C.zmq_ctx_new() - socket = C.zmq_socket(ctx, PUSH) - - identity = ffi.new('char[]', b'zmq') - ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3) - assert ret == 0 - - option_len = ffi.new('size_t*', 3) - option = ffi.new('char[3]') - ret = C.zmq_getsockopt(socket, - IDENTITY, - ffi.cast('void*', option), - option_len) - - assert ret == 0 - assert ffi.string(ffi.cast('char*', option))[0:1] == b"z" - assert ffi.string(ffi.cast('char*', option))[1:2] == b"m" - assert ffi.string(ffi.cast('char*', option))[2:3] == b"q" - assert ctx != ffi.NULL - assert ffi.NULL != socket - assert 0 == C.zmq_close(socket) - assert 0 == C.zmq_ctx_destroy(ctx) - - def test_zmq_bind(self): - ctx = C.zmq_ctx_new() - socket = C.zmq_socket(ctx, 8) - - assert 0 == C.zmq_bind(socket, b'tcp://*:4444') - assert ctx != ffi.NULL - assert ffi.NULL != socket - assert 0 == C.zmq_close(socket) - assert 0 == C.zmq_ctx_destroy(ctx) - - def test_zmq_bind_connect(self): - ctx = C.zmq_ctx_new() - - socket1 = C.zmq_socket(ctx, PUSH) - socket2 = C.zmq_socket(ctx, PULL) - - assert 0 == C.zmq_bind(socket1, b'tcp://*:4444') - assert 0 == C.zmq_connect(socket2, b'tcp://127.0.0.1:4444') - assert ctx != ffi.NULL - assert ffi.NULL != socket1 - assert ffi.NULL != socket2 - assert 0 == C.zmq_close(socket1) - assert 0 == C.zmq_close(socket2) - assert 0 == C.zmq_ctx_destroy(ctx) - - def test_zmq_msg_init_close(self): - zmq_msg = ffi.new('zmq_msg_t*') - - assert ffi.NULL != zmq_msg - assert 0 == C.zmq_msg_init(zmq_msg) - assert 0 == C.zmq_msg_close(zmq_msg) - - def test_zmq_msg_init_size(self): - zmq_msg = ffi.new('zmq_msg_t*') - - assert ffi.NULL != zmq_msg - assert 0 == C.zmq_msg_init_size(zmq_msg, 10) - assert 0 == C.zmq_msg_close(zmq_msg) - - def test_zmq_msg_init_data(self): - zmq_msg = ffi.new('zmq_msg_t*') - message = ffi.new('char[5]', b'Hello') - - assert 0 == C.zmq_msg_init_data(zmq_msg, - ffi.cast('void*', message), - 5, - ffi.NULL, - ffi.NULL) - - assert ffi.NULL != zmq_msg - assert 0 == C.zmq_msg_close(zmq_msg) - - def test_zmq_msg_data(self): - zmq_msg = ffi.new('zmq_msg_t*') - message = ffi.new('char[]', b'Hello') - assert 0 == C.zmq_msg_init_data(zmq_msg, - ffi.cast('void*', message), - 5, - ffi.NULL, - ffi.NULL) - - data = C.zmq_msg_data(zmq_msg) - - assert ffi.NULL != zmq_msg - assert ffi.string(ffi.cast("char*", data)) == b'Hello' - assert 0 == C.zmq_msg_close(zmq_msg) - - - def test_zmq_send(self): - ctx = C.zmq_ctx_new() - - sender = C.zmq_socket(ctx, REQ) - receiver = C.zmq_socket(ctx, REP) - - assert 0 == C.zmq_bind(receiver, b'tcp://*:7777') - assert 0 == C.zmq_connect(sender, b'tcp://127.0.0.1:7777') - - time.sleep(0.1) - - zmq_msg = ffi.new('zmq_msg_t*') - message = ffi.new('char[5]', b'Hello') - - C.zmq_msg_init_data(zmq_msg, - ffi.cast('void*', message), - ffi.cast('size_t', 5), - ffi.NULL, - ffi.NULL) - - assert 5 == C.zmq_msg_send(zmq_msg, sender, 0) - assert 0 == C.zmq_msg_close(zmq_msg) - assert C.zmq_close(sender) == 0 - assert C.zmq_close(receiver) == 0 - assert C.zmq_ctx_destroy(ctx) == 0 - - def test_zmq_recv(self): - ctx = C.zmq_ctx_new() - - sender = C.zmq_socket(ctx, REQ) - receiver = C.zmq_socket(ctx, REP) - - assert 0 == C.zmq_bind(receiver, b'tcp://*:2222') - assert 0 == C.zmq_connect(sender, b'tcp://127.0.0.1:2222') - - time.sleep(0.1) - - zmq_msg = ffi.new('zmq_msg_t*') - message = ffi.new('char[5]', b'Hello') - - C.zmq_msg_init_data(zmq_msg, - ffi.cast('void*', message), - ffi.cast('size_t', 5), - ffi.NULL, - ffi.NULL) - - zmq_msg2 = ffi.new('zmq_msg_t*') - C.zmq_msg_init(zmq_msg2) - - assert 5 == C.zmq_msg_send(zmq_msg, sender, 0) - assert 5 == C.zmq_msg_recv(zmq_msg2, receiver, 0) - assert 5 == C.zmq_msg_size(zmq_msg2) - assert b"Hello" == ffi.buffer(C.zmq_msg_data(zmq_msg2), - C.zmq_msg_size(zmq_msg2))[:] - assert C.zmq_close(sender) == 0 - assert C.zmq_close(receiver) == 0 - assert C.zmq_ctx_destroy(ctx) == 0 - - def test_zmq_poll(self): - ctx = C.zmq_ctx_new() - - sender = C.zmq_socket(ctx, REQ) - receiver = C.zmq_socket(ctx, REP) - - r1 = C.zmq_bind(receiver, b'tcp://*:3333') - r2 = C.zmq_connect(sender, b'tcp://127.0.0.1:3333') - - zmq_msg = ffi.new('zmq_msg_t*') - message = ffi.new('char[5]', b'Hello') - - C.zmq_msg_init_data(zmq_msg, - ffi.cast('void*', message), - ffi.cast('size_t', 5), - ffi.NULL, - ffi.NULL) - - receiver_pollitem = ffi.new('zmq_pollitem_t*') - receiver_pollitem.socket = receiver - receiver_pollitem.fd = 0 - receiver_pollitem.events = POLLIN | POLLOUT - receiver_pollitem.revents = 0 - - ret = C.zmq_poll(ffi.NULL, 0, 0) - assert ret == 0 - - ret = C.zmq_poll(receiver_pollitem, 1, 0) - assert ret == 0 - - ret = C.zmq_msg_send(zmq_msg, sender, 0) - print(ffi.string(C.zmq_strerror(C.zmq_errno()))) - assert ret == 5 - - time.sleep(0.2) - - ret = C.zmq_poll(receiver_pollitem, 1, 0) - assert ret == 1 - - assert int(receiver_pollitem.revents) & POLLIN - assert not int(receiver_pollitem.revents) & POLLOUT - - zmq_msg2 = ffi.new('zmq_msg_t*') - C.zmq_msg_init(zmq_msg2) - - ret_recv = C.zmq_msg_recv(zmq_msg2, receiver, 0) - assert ret_recv == 5 - - assert 5 == C.zmq_msg_size(zmq_msg2) - assert b"Hello" == ffi.buffer(C.zmq_msg_data(zmq_msg2), - C.zmq_msg_size(zmq_msg2))[:] - - sender_pollitem = ffi.new('zmq_pollitem_t*') - sender_pollitem.socket = sender - sender_pollitem.fd = 0 - sender_pollitem.events = POLLIN | POLLOUT - sender_pollitem.revents = 0 - - ret = C.zmq_poll(sender_pollitem, 1, 0) - assert ret == 0 - - zmq_msg_again = ffi.new('zmq_msg_t*') - message_again = ffi.new('char[11]', b'Hello Again') - - C.zmq_msg_init_data(zmq_msg_again, - ffi.cast('void*', message_again), - ffi.cast('size_t', 11), - ffi.NULL, - ffi.NULL) - - assert 11 == C.zmq_msg_send(zmq_msg_again, receiver, 0) - - time.sleep(0.2) - - assert 0 <= C.zmq_poll(sender_pollitem, 1, 0) - assert int(sender_pollitem.revents) & POLLIN - assert 11 == C.zmq_msg_recv(zmq_msg2, sender, 0) - assert 11 == C.zmq_msg_size(zmq_msg2) - assert b"Hello Again" == ffi.buffer(C.zmq_msg_data(zmq_msg2), - int(C.zmq_msg_size(zmq_msg2)))[:] - assert 0 == C.zmq_close(sender) - assert 0 == C.zmq_close(receiver) - assert 0 == C.zmq_ctx_destroy(ctx) - assert 0 == C.zmq_msg_close(zmq_msg) - assert 0 == C.zmq_msg_close(zmq_msg2) - assert 0 == C.zmq_msg_close(zmq_msg_again) - - def test_zmq_stopwatch_functions(self): - stopwatch = C.zmq_stopwatch_start() - ret = C.zmq_stopwatch_stop(stopwatch) - - assert ffi.NULL != stopwatch - assert 0 < int(ret) - - def test_zmq_sleep(self): - try: - C.zmq_sleep(1) - except Exception as e: - raise AssertionError("Error executing zmq_sleep(int)") - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_constants.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_constants.py deleted file mode 100644 index 6b4d0c9b67..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_constants.py +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import json -from unittest import TestCase - -import pytest - -import zmq - -from zmq.utils import constant_names -from zmq.sugar import constants as sugar_constants -from zmq.backend import constants as backend_constants - -all_set = set(constant_names.all_names) - -class TestConstants(TestCase): - - def _duplicate_test(self, namelist, listname): - """test that a given list has no duplicates""" - dupes = {} - for name in set(namelist): - cnt = namelist.count(name) - if cnt > 1: - dupes[name] = cnt - if dupes: - self.fail("The following names occur more than once in %s: %s" % (listname, json.dumps(dupes, indent=2))) - - def test_duplicate_all(self): - return self._duplicate_test(constant_names.all_names, "all_names") - - def _change_key(self, change, version): - """return changed-in key""" - return "%s-in %d.%d.%d" % tuple([change] + list(version)) - - def test_duplicate_changed(self): - all_changed = [] - for change in ("new", "removed"): - d = getattr(constant_names, change + "_in") - for version, namelist in d.items(): - all_changed.extend(namelist) - self._duplicate_test(namelist, self._change_key(change, version)) - - self._duplicate_test(all_changed, "all-changed") - - def test_changed_in_all(self): - missing = {} - for change in ("new", "removed"): - d = getattr(constant_names, change + "_in") - for version, namelist in d.items(): - key = self._change_key(change, version) - for name in namelist: - if name not in all_set: - if key not in missing: - missing[key] = [] - missing[key].append(name) - - if missing: - self.fail( - "The following names are missing in `all_names`: %s" % json.dumps(missing, indent=2) - ) - - def test_no_negative_constants(self): - for name in sugar_constants.__all__: - self.assertNotEqual(getattr(zmq, name), sugar_constants._UNDEFINED) - - def test_undefined_constants(self): - all_aliases = [] - for alias_group in sugar_constants.aliases: - all_aliases.extend(alias_group) - - for name in all_set.difference(all_aliases): - raw = getattr(backend_constants, name) - if raw == sugar_constants._UNDEFINED: - self.assertRaises(AttributeError, getattr, zmq, name) - else: - self.assertEqual(getattr(zmq, name), raw) - - def test_new(self): - zmq_version = zmq.zmq_version_info() - for version, new_names in constant_names.new_in.items(): - should_have = zmq_version >= version - for name in new_names: - try: - value = getattr(zmq, name) - except AttributeError: - if should_have: - self.fail("AttributeError: zmq.%s" % name) - else: - if not should_have: - self.fail("Shouldn't have: zmq.%s=%s" % (name, value)) - - @pytest.mark.skipif(not zmq.DRAFT_API, reason="Only test draft API if built with draft API") - def test_draft(self): - zmq_version = zmq.zmq_version_info() - for version, new_names in constant_names.draft_in.items(): - should_have = zmq_version >= version - for name in new_names: - try: - value = getattr(zmq, name) - except AttributeError: - if should_have: - self.fail("AttributeError: zmq.%s" % name) - else: - if not should_have: - self.fail("Shouldn't have: zmq.%s=%s" % (name, value)) - - def test_removed(self): - zmq_version = zmq.zmq_version_info() - for version, new_names in constant_names.removed_in.items(): - should_have = zmq_version < version - for name in new_names: - try: - value = getattr(zmq, name) - except AttributeError: - if should_have: - self.fail("AttributeError: zmq.%s" % name) - else: - if not should_have: - self.fail("Shouldn't have: zmq.%s=%s" % (name, value)) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_context.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_context.py deleted file mode 100644 index 344424da74..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_context.py +++ /dev/null @@ -1,323 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import copy -import gc -import sys -import time -from threading import Thread, Event -try: - from queue import Queue -except ImportError: - from Queue import Queue - -import zmq -from zmq.tests import ( - BaseZMQTestCase, have_gevent, GreenTest, skip_green, PYPY, SkipTest, -) - - -class KwargTestSocket(zmq.Socket): - test_kwarg_value = None - - def __init__(self, *args, **kwargs): - self.test_kwarg_value = kwargs.pop('test_kwarg', None) - super(KwargTestSocket, self).__init__(*args, **kwargs) - - -class KwargTestContext(zmq.Context): - _socket_class = KwargTestSocket - - -class TestContext(BaseZMQTestCase): - - def test_init(self): - c1 = self.Context() - self.assert_(isinstance(c1, self.Context)) - del c1 - c2 = self.Context() - self.assert_(isinstance(c2, self.Context)) - del c2 - c3 = self.Context() - self.assert_(isinstance(c3, self.Context)) - del c3 - - def test_dir(self): - ctx = self.Context() - self.assertTrue('socket' in dir(ctx)) - if zmq.zmq_version_info() > (3,): - self.assertTrue('IO_THREADS' in dir(ctx)) - ctx.term() - - def test_term(self): - c = self.Context() - c.term() - self.assert_(c.closed) - - def test_context_manager(self): - with self.Context() as c: - pass - self.assert_(c.closed) - - def test_fail_init(self): - self.assertRaisesErrno(zmq.EINVAL, self.Context, -1) - - def test_term_hang(self): - rep,req = self.create_bound_pair(zmq.ROUTER, zmq.DEALER) - req.setsockopt(zmq.LINGER, 0) - req.send(b'hello', copy=False) - req.close() - rep.close() - self.context.term() - - def test_instance(self): - ctx = self.Context.instance() - c2 = self.Context.instance(io_threads=2) - self.assertTrue(c2 is ctx) - c2.term() - c3 = self.Context.instance() - c4 = self.Context.instance() - self.assertFalse(c3 is c2) - self.assertFalse(c3.closed) - self.assertTrue(c3 is c4) - - def test_instance_threadsafe(self): - self.context.term() # clear default context - - q = Queue() - # slow context initialization, - # to ensure that we are both trying to create one at the same time - class SlowContext(self.Context): - def __init__(self, *a, **kw): - time.sleep(1) - super(SlowContext, self).__init__(*a, **kw) - - def f(): - q.put(SlowContext.instance()) - - # call ctx.instance() in several threads at once - N = 16 - threads = [ Thread(target=f) for i in range(N) ] - [ t.start() for t in threads ] - # also call it in the main thread (not first) - ctx = SlowContext.instance() - assert isinstance(ctx, SlowContext) - # check that all the threads got the same context - for i in range(N): - thread_ctx = q.get(timeout=5) - assert thread_ctx is ctx - # cleanup - ctx.term() - [ t.join(timeout=5) for t in threads ] - - def test_socket_passes_kwargs(self): - test_kwarg_value = 'testing one two three' - with KwargTestContext() as ctx: - with ctx.socket(zmq.DEALER, test_kwarg=test_kwarg_value) as socket: - self.assertTrue(socket.test_kwarg_value is test_kwarg_value) - - def test_many_sockets(self): - """opening and closing many sockets shouldn't cause problems""" - ctx = self.Context() - for i in range(16): - sockets = [ ctx.socket(zmq.REP) for i in range(65) ] - [ s.close() for s in sockets ] - # give the reaper a chance - time.sleep(1e-2) - ctx.term() - - def test_sockopts(self): - """setting socket options with ctx attributes""" - ctx = self.Context() - ctx.linger = 5 - self.assertEqual(ctx.linger, 5) - s = ctx.socket(zmq.REQ) - self.assertEqual(s.linger, 5) - self.assertEqual(s.getsockopt(zmq.LINGER), 5) - s.close() - # check that subscribe doesn't get set on sockets that don't subscribe: - ctx.subscribe = b'' - s = ctx.socket(zmq.REQ) - s.close() - - ctx.term() - - - def test_destroy(self): - """Context.destroy should close sockets""" - ctx = self.Context() - sockets = [ ctx.socket(zmq.REP) for i in range(65) ] - - # close half of the sockets - [ s.close() for s in sockets[::2] ] - - ctx.destroy() - # reaper is not instantaneous - time.sleep(1e-2) - for s in sockets: - self.assertTrue(s.closed) - - def test_destroy_linger(self): - """Context.destroy should set linger on closing sockets""" - req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) - req.send(b'hi') - time.sleep(1e-2) - self.context.destroy(linger=0) - # reaper is not instantaneous - time.sleep(1e-2) - for s in (req,rep): - self.assertTrue(s.closed) - - def test_term_noclose(self): - """Context.term won't close sockets""" - ctx = self.Context() - s = ctx.socket(zmq.REQ) - self.assertFalse(s.closed) - t = Thread(target=ctx.term) - t.start() - t.join(timeout=0.1) - self.assertTrue(t.is_alive(), "Context should be waiting") - s.close() - t.join(timeout=0.1) - self.assertFalse(t.is_alive(), "Context should have closed") - - def test_gc(self): - """test close&term by garbage collection alone""" - if PYPY: - raise SkipTest("GC doesn't work ") - - # test credit @dln (GH #137): - def gcf(): - def inner(): - ctx = self.Context() - s = ctx.socket(zmq.PUSH) - inner() - gc.collect() - t = Thread(target=gcf) - t.start() - t.join(timeout=1) - self.assertFalse(t.is_alive(), "Garbage collection should have cleaned up context") - - def test_cyclic_destroy(self): - """ctx.destroy should succeed when cyclic ref prevents gc""" - # test credit @dln (GH #137): - class CyclicReference(object): - def __init__(self, parent=None): - self.parent = parent - - def crash(self, sock): - self.sock = sock - self.child = CyclicReference(self) - - def crash_zmq(): - ctx = self.Context() - sock = ctx.socket(zmq.PULL) - c = CyclicReference() - c.crash(sock) - ctx.destroy() - - crash_zmq() - - def test_term_thread(self): - """ctx.term should not crash active threads (#139)""" - ctx = self.Context() - evt = Event() - evt.clear() - - def block(): - s = ctx.socket(zmq.REP) - s.bind_to_random_port('tcp://127.0.0.1') - evt.set() - try: - s.recv() - except zmq.ZMQError as e: - self.assertEqual(e.errno, zmq.ETERM) - return - finally: - s.close() - self.fail("recv should have been interrupted with ETERM") - t = Thread(target=block) - t.start() - - evt.wait(1) - self.assertTrue(evt.is_set(), "sync event never fired") - time.sleep(0.01) - ctx.term() - t.join(timeout=1) - self.assertFalse(t.is_alive(), "term should have interrupted s.recv()") - - def test_destroy_no_sockets(self): - ctx = self.Context() - s = ctx.socket(zmq.PUB) - s.bind_to_random_port('tcp://127.0.0.1') - s.close() - ctx.destroy() - assert s.closed - assert ctx.closed - - def test_ctx_opts(self): - if zmq.zmq_version_info() < (3,): - raise SkipTest("context options require libzmq 3") - ctx = self.Context() - ctx.set(zmq.MAX_SOCKETS, 2) - self.assertEqual(ctx.get(zmq.MAX_SOCKETS), 2) - ctx.max_sockets = 100 - self.assertEqual(ctx.max_sockets, 100) - self.assertEqual(ctx.get(zmq.MAX_SOCKETS), 100) - - def test_copy(self): - c1 = self.Context() - c2 = copy.copy(c1) - c2b = copy.deepcopy(c1) - c3 = copy.deepcopy(c2) - self.assert_(c2._shadow) - self.assert_(c3._shadow) - self.assertEqual(c1.underlying, c2.underlying) - self.assertEqual(c1.underlying, c3.underlying) - self.assertEqual(c1.underlying, c2b.underlying) - s = c3.socket(zmq.PUB) - s.close() - c1.term() - - def test_shadow(self): - ctx = self.Context() - ctx2 = self.Context.shadow(ctx.underlying) - self.assertEqual(ctx.underlying, ctx2.underlying) - s = ctx.socket(zmq.PUB) - s.close() - del ctx2 - self.assertFalse(ctx.closed) - s = ctx.socket(zmq.PUB) - ctx2 = self.Context.shadow(ctx.underlying) - s2 = ctx2.socket(zmq.PUB) - s.close() - s2.close() - ctx.term() - self.assertRaisesErrno(zmq.EFAULT, ctx2.socket, zmq.PUB) - del ctx2 - - def test_shadow_pyczmq(self): - try: - from pyczmq import zctx, zsocket, zstr - except Exception: - raise SkipTest("Requires pyczmq") - - ctx = zctx.new() - a = zsocket.new(ctx, zmq.PUSH) - zsocket.bind(a, "inproc://a") - ctx2 = self.Context.shadow_pyczmq(ctx) - b = ctx2.socket(zmq.PULL) - b.connect("inproc://a") - zstr.send(a, b'hi') - rcvd = self.recv(b) - self.assertEqual(rcvd, b'hi') - b.close() - - -if False: # disable green context tests - class TestContextGreen(GreenTest, TestContext): - """gevent subclass of context tests""" - # skip tests that use real threads: - test_gc = GreenTest.skip_green - test_term_thread = GreenTest.skip_green - test_destroy_linger = GreenTest.skip_green diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_decorators.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_decorators.py deleted file mode 100644 index ae6af3dfef..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_decorators.py +++ /dev/null @@ -1,375 +0,0 @@ -import threading -import zmq - -from pytest import raises -from zmq.decorators import context, socket - - -############################################## -# Test cases for @context -############################################## - - -def test_ctx(): - @context() - def test(ctx): - assert isinstance(ctx, zmq.Context), ctx - test() - - -def test_ctx_orig_args(): - @context() - def f(foo, bar, ctx, baz=None): - assert isinstance(ctx, zmq.Context), ctx - assert foo == 42 - assert bar is True - assert baz == 'mock' - - f(42, True, baz='mock') - - -def test_ctx_arg_naming(): - @context('myctx') - def test(myctx): - assert isinstance(myctx, zmq.Context), myctx - test() - - -def test_ctx_args(): - @context('ctx', 5) - def test(ctx): - assert isinstance(ctx, zmq.Context), ctx - assert ctx.IO_THREADS == 5, ctx.IO_THREADS - test() - - -def test_ctx_arg_kwarg(): - @context('ctx', io_threads=5) - def test(ctx): - assert isinstance(ctx, zmq.Context), ctx - assert ctx.IO_THREADS == 5, ctx.IO_THREADS - test() - - -def test_ctx_kw_naming(): - @context(name='myctx') - def test(myctx): - assert isinstance(myctx, zmq.Context), myctx - test() - - -def test_ctx_kwargs(): - @context(name='ctx', io_threads=5) - def test(ctx): - assert isinstance(ctx, zmq.Context), ctx - assert ctx.IO_THREADS == 5, ctx.IO_THREADS - test() - - -def test_ctx_kwargs_default(): - @context(name='ctx', io_threads=5) - def test(ctx=None): - assert isinstance(ctx, zmq.Context), ctx - assert ctx.IO_THREADS == 5, ctx.IO_THREADS - test() - - -def test_ctx_keyword_miss(): - @context(name='ctx') - def test(other_name): - pass # the keyword ``ctx`` not found - with raises(TypeError): - test() - - -def test_ctx_multi_assign(): - @context(name='ctx') - def test(ctx): - pass # explosion - with raises(TypeError): - test('mock') - - -def test_ctx_reinit(): - result = {'foo': None, 'bar': None} - - @context() - def f(key, ctx): - assert isinstance(ctx, zmq.Context), ctx - result[key] = ctx - - foo_t = threading.Thread(target=f, args=('foo',)) - bar_t = threading.Thread(target=f, args=('bar',)) - - foo_t.start() - bar_t.start() - - foo_t.join() - bar_t.join() - - assert result['foo'] is not None, result - assert result['bar'] is not None, result - assert result['foo'] is not result['bar'], result - - -def test_ctx_multi_thread(): - @context() - @context() - def f(foo, bar): - assert isinstance(foo, zmq.Context), foo - assert isinstance(bar, zmq.Context), bar - - assert len(set(map(id, [foo, bar]))) == 2, set(map(id, [foo, bar])) - - threads = [threading.Thread(target=f) for i in range(8)] - [t.start() for t in threads] - [t.join() for t in threads] - - -############################################## -# Test cases for @socket -############################################## - - -def test_ctx_skt(): - @context() - @socket(zmq.PUB) - def test(ctx, skt): - assert isinstance(ctx, zmq.Context), ctx - assert isinstance(skt, zmq.Socket), skt - assert skt.type == zmq.PUB - test() - - -def test_skt_name(): - @context() - @socket('myskt', zmq.PUB) - def test(ctx, myskt): - assert isinstance(myskt, zmq.Socket), myskt - assert isinstance(ctx, zmq.Context), ctx - assert myskt.type == zmq.PUB - test() - - -def test_skt_kwarg(): - @context() - @socket(zmq.PUB, name='myskt') - def test(ctx, myskt): - assert isinstance(myskt, zmq.Socket), myskt - assert isinstance(ctx, zmq.Context), ctx - assert myskt.type == zmq.PUB - test() - - -def test_ctx_skt_name(): - @context('ctx') - @socket('skt', zmq.PUB, context_name='ctx') - def test(ctx, skt): - assert isinstance(skt, zmq.Socket), skt - assert isinstance(ctx, zmq.Context), ctx - assert skt.type == zmq.PUB - test() - - -def test_skt_default_ctx(): - @socket(zmq.PUB) - def test(skt): - assert isinstance(skt, zmq.Socket), skt - assert skt.context is zmq.Context.instance() - assert skt.type == zmq.PUB - test() - - -def test_skt_reinit(): - result = {'foo': None, 'bar': None} - - @socket(zmq.PUB) - def f(key, skt): - assert isinstance(skt, zmq.Socket), skt - - result[key] = skt - - foo_t = threading.Thread(target=f, args=('foo',)) - bar_t = threading.Thread(target=f, args=('bar',)) - - foo_t.start() - bar_t.start() - - foo_t.join() - bar_t.join() - - assert result['foo'] is not None, result - assert result['bar'] is not None, result - assert result['foo'] is not result['bar'], result - - -def test_ctx_skt_reinit(): - result = {'foo': {'ctx': None, 'skt': None}, - 'bar': {'ctx': None, 'skt': None}} - - @context() - @socket(zmq.PUB) - def f(key, ctx, skt): - assert isinstance(ctx, zmq.Context), ctx - assert isinstance(skt, zmq.Socket), skt - - result[key]['ctx'] = ctx - result[key]['skt'] = skt - - foo_t = threading.Thread(target=f, args=('foo',)) - bar_t = threading.Thread(target=f, args=('bar',)) - - foo_t.start() - bar_t.start() - - foo_t.join() - bar_t.join() - - assert result['foo']['ctx'] is not None, result - assert result['foo']['skt'] is not None, result - assert result['bar']['ctx'] is not None, result - assert result['bar']['skt'] is not None, result - assert result['foo']['ctx'] is not result['bar']['ctx'], result - assert result['foo']['skt'] is not result['bar']['skt'], result - - -def test_skt_type_miss(): - @context() - @socket('myskt') - def f(ctx, myskt): - pass # the socket type is missing - with raises(TypeError): - f() - - -def test_multi_skts(): - @socket(zmq.PUB) - @socket(zmq.SUB) - @socket(zmq.PUSH) - def test(pub, sub, push): - assert isinstance(pub, zmq.Socket), pub - assert isinstance(sub, zmq.Socket), sub - assert isinstance(push, zmq.Socket), push - - assert pub.context is zmq.Context.instance() - assert sub.context is zmq.Context.instance() - assert push.context is zmq.Context.instance() - - assert pub.type == zmq.PUB - assert sub.type == zmq.SUB - assert push.type == zmq.PUSH - test() - - -def test_multi_skts_single_ctx(): - @context() - @socket(zmq.PUB) - @socket(zmq.SUB) - @socket(zmq.PUSH) - def test(ctx, pub, sub, push): - assert isinstance(ctx, zmq.Context), ctx - assert isinstance(pub, zmq.Socket), pub - assert isinstance(sub, zmq.Socket), sub - assert isinstance(push, zmq.Socket), push - - assert pub.context is ctx - assert sub.context is ctx - assert push.context is ctx - - assert pub.type == zmq.PUB - assert sub.type == zmq.SUB - assert push.type == zmq.PUSH - test() - - -def test_multi_skts_with_name(): - @socket('foo', zmq.PUSH) - @socket('bar', zmq.SUB) - @socket('baz', zmq.PUB) - def test(foo, bar, baz): - assert isinstance(foo, zmq.Socket), foo - assert isinstance(bar, zmq.Socket), bar - assert isinstance(baz, zmq.Socket), baz - - assert foo.context is zmq.Context.instance() - assert bar.context is zmq.Context.instance() - assert baz.context is zmq.Context.instance() - - assert foo.type == zmq.PUSH - assert bar.type == zmq.SUB - assert baz.type == zmq.PUB - test() - -def test_func_return(): - @context() - def f(ctx): - assert isinstance(ctx, zmq.Context), ctx - return 'something' - - assert f() == 'something' - - -def test_skt_multi_thread(): - @socket(zmq.PUB) - @socket(zmq.SUB) - @socket(zmq.PUSH) - def f(pub, sub, push): - assert isinstance(pub, zmq.Socket), pub - assert isinstance(sub, zmq.Socket), sub - assert isinstance(push, zmq.Socket), push - - assert pub.context is zmq.Context.instance() - assert sub.context is zmq.Context.instance() - assert push.context is zmq.Context.instance() - - assert pub.type == zmq.PUB - assert sub.type == zmq.SUB - assert push.type == zmq.PUSH - - assert len(set(map(id, [pub, sub, push]))) == 3 - - threads = [threading.Thread(target=f) for i in range(8)] - [t.start() for t in threads] - [t.join() for t in threads] - - -class TestMethodDecorators(): - @context() - @socket(zmq.PUB) - @socket(zmq.SUB) - def multi_skts_method(self, ctx, pub, sub, foo='bar'): - assert isinstance(self, TestMethodDecorators), self - assert isinstance(ctx, zmq.Context), ctx - assert isinstance(pub, zmq.Socket), pub - assert isinstance(sub, zmq.Socket), sub - assert foo == 'bar' - - assert pub.context is ctx - assert sub.context is ctx - - assert pub.type is zmq.PUB - assert sub.type is zmq.SUB - - def test_multi_skts_method(self): - self.multi_skts_method() - - def multi_skts_method_other_args(self): - @socket(zmq.PUB) - @socket(zmq.SUB) - def f(foo, pub, sub, bar=None): - assert isinstance(pub, zmq.Socket), pub - assert isinstance(sub, zmq.Socket), sub - - assert foo == 'mock' - assert bar == 'fake' - - assert pub.context is zmq.Context.instance() - assert sub.context is zmq.Context.instance() - - assert pub.type is zmq.PUB - assert sub.type is zmq.SUB - - f('mock', bar='fake') - - def test_multi_skts_method_other_args(self): - self.multi_skts_method_other_args() diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_device.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_device.py deleted file mode 100644 index 0ad9cfe7a9..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_device.py +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import time - -import zmq -from zmq import devices -from zmq.tests import BaseZMQTestCase, SkipTest, have_gevent, GreenTest, PYPY -from zmq.utils.strtypes import (bytes,unicode,basestring) - -if PYPY: - # cleanup of shared Context doesn't work on PyPy - devices.Device.context_factory = zmq.Context - -class TestDevice(BaseZMQTestCase): - - def test_device_types(self): - for devtype in (zmq.STREAMER, zmq.FORWARDER, zmq.QUEUE): - dev = devices.Device(devtype, zmq.PAIR, zmq.PAIR) - self.assertEqual(dev.device_type, devtype) - del dev - - def test_device_attributes(self): - dev = devices.Device(zmq.QUEUE, zmq.SUB, zmq.PUB) - self.assertEqual(dev.in_type, zmq.SUB) - self.assertEqual(dev.out_type, zmq.PUB) - self.assertEqual(dev.device_type, zmq.QUEUE) - self.assertEqual(dev.daemon, True) - del dev - - def test_single_socket_forwarder_connect(self): - if zmq.zmq_version() in ('4.1.1', '4.0.6'): - raise SkipTest("libzmq-%s broke single-socket devices" % zmq.zmq_version()) - dev = devices.ThreadDevice(zmq.QUEUE, zmq.REP, -1) - req = self.context.socket(zmq.REQ) - port = req.bind_to_random_port('tcp://127.0.0.1') - dev.connect_in('tcp://127.0.0.1:%i'%port) - dev.start() - time.sleep(.25) - msg = b'hello' - req.send(msg) - self.assertEqual(msg, self.recv(req)) - del dev - req.close() - dev = devices.ThreadDevice(zmq.QUEUE, zmq.REP, -1) - req = self.context.socket(zmq.REQ) - port = req.bind_to_random_port('tcp://127.0.0.1') - dev.connect_out('tcp://127.0.0.1:%i'%port) - dev.start() - time.sleep(.25) - msg = b'hello again' - req.send(msg) - self.assertEqual(msg, self.recv(req)) - del dev - req.close() - - def test_single_socket_forwarder_bind(self): - if zmq.zmq_version() in ('4.1.1', '4.0.6'): - raise SkipTest("libzmq-%s broke single-socket devices" % zmq.zmq_version()) - dev = devices.ThreadDevice(zmq.QUEUE, zmq.REP, -1) - # select random port: - binder = self.context.socket(zmq.REQ) - port = binder.bind_to_random_port('tcp://127.0.0.1') - binder.close() - time.sleep(0.1) - req = self.context.socket(zmq.REQ) - req.connect('tcp://127.0.0.1:%i'%port) - dev.bind_in('tcp://127.0.0.1:%i'%port) - dev.start() - time.sleep(.25) - msg = b'hello' - req.send(msg) - self.assertEqual(msg, self.recv(req)) - del dev - req.close() - dev = devices.ThreadDevice(zmq.QUEUE, zmq.REP, -1) - # select random port: - binder = self.context.socket(zmq.REQ) - port = binder.bind_to_random_port('tcp://127.0.0.1') - binder.close() - time.sleep(0.1) - req = self.context.socket(zmq.REQ) - req.connect('tcp://127.0.0.1:%i'%port) - dev.bind_in('tcp://127.0.0.1:%i'%port) - dev.start() - time.sleep(.25) - msg = b'hello again' - req.send(msg) - self.assertEqual(msg, self.recv(req)) - del dev - req.close() - - def test_proxy(self): - if zmq.zmq_version_info() < (3,2): - raise SkipTest("Proxies only in libzmq >= 3") - dev = devices.ThreadProxy(zmq.PULL, zmq.PUSH, zmq.PUSH) - binder = self.context.socket(zmq.REQ) - iface = 'tcp://127.0.0.1' - port = binder.bind_to_random_port(iface) - port2 = binder.bind_to_random_port(iface) - port3 = binder.bind_to_random_port(iface) - binder.close() - time.sleep(0.1) - dev.bind_in("%s:%i" % (iface, port)) - dev.bind_out("%s:%i" % (iface, port2)) - dev.bind_mon("%s:%i" % (iface, port3)) - dev.start() - time.sleep(0.25) - msg = b'hello' - push = self.context.socket(zmq.PUSH) - push.connect("%s:%i" % (iface, port)) - pull = self.context.socket(zmq.PULL) - pull.connect("%s:%i" % (iface, port2)) - mon = self.context.socket(zmq.PULL) - mon.connect("%s:%i" % (iface, port3)) - push.send(msg) - self.sockets.extend([push, pull, mon]) - self.assertEqual(msg, self.recv(pull)) - self.assertEqual(msg, self.recv(mon)) - -if have_gevent: - import gevent - import zmq.green - - class TestDeviceGreen(GreenTest, BaseZMQTestCase): - - def test_green_device(self): - rep = self.context.socket(zmq.REP) - req = self.context.socket(zmq.REQ) - self.sockets.extend([req, rep]) - port = rep.bind_to_random_port('tcp://127.0.0.1') - g = gevent.spawn(zmq.green.device, zmq.QUEUE, rep, rep) - req.connect('tcp://127.0.0.1:%i' % port) - req.send(b'hi') - timeout = gevent.Timeout(3) - timeout.start() - receiver = gevent.spawn(req.recv) - self.assertEqual(receiver.get(2), b'hi') - timeout.cancel() - g.kill(block=True) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_error.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_error.py deleted file mode 100644 index a2eee14af3..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_error.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import sys -import time - -import zmq -from zmq import ZMQError, strerror, Again, ContextTerminated -from zmq.tests import BaseZMQTestCase - -if sys.version_info[0] >= 3: - long = int - -class TestZMQError(BaseZMQTestCase): - - def test_strerror(self): - """test that strerror gets the right type.""" - for i in range(10): - e = strerror(i) - self.assertTrue(isinstance(e, str)) - - def test_zmqerror(self): - for errno in range(10): - e = ZMQError(errno) - self.assertEqual(e.errno, errno) - self.assertEqual(str(e), strerror(errno)) - - def test_again(self): - s = self.context.socket(zmq.REP) - self.assertRaises(Again, s.recv, zmq.NOBLOCK) - self.assertRaisesErrno(zmq.EAGAIN, s.recv, zmq.NOBLOCK) - s.close() - - def atest_ctxterm(self): - s = self.context.socket(zmq.REP) - t = Thread(target=self.context.term) - t.start() - self.assertRaises(ContextTerminated, s.recv, zmq.NOBLOCK) - self.assertRaisesErrno(zmq.TERM, s.recv, zmq.NOBLOCK) - s.close() - t.join() - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_etc.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_etc.py deleted file mode 100644 index 020dc22bdb..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_etc.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) PyZMQ Developers. -# Distributed under the terms of the Modified BSD License. - -import sys - -import zmq - -from pytest import mark - -@mark.skipif('zmq.zmq_version_info() < (4,1)') -def test_has(): - assert not zmq.has('something weird') - has_ipc = zmq.has('ipc') - not_windows = not sys.platform.startswith('win') - assert has_ipc == not_windows - -@mark.skipif(not hasattr(zmq, '_libzmq'), reason="bundled libzmq") -def test_has_curve(): - """bundled libzmq has curve support""" - assert zmq.has('curve') diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_future.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_future.py deleted file mode 100644 index 1db25defbb..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_future.py +++ /dev/null @@ -1,162 +0,0 @@ -# coding: utf-8 -# Copyright (c) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import pytest -gen = pytest.importorskip('tornado.gen') - -import zmq -from zmq.eventloop import future -from zmq.eventloop.ioloop import IOLoop -from zmq.utils.strtypes import u - -from zmq.tests import BaseZMQTestCase - -class TestFutureSocket(BaseZMQTestCase): - Context = future.Context - - def setUp(self): - self.loop = IOLoop() - self.loop.make_current() - super(TestFutureSocket, self).setUp() - - def tearDown(self): - super(TestFutureSocket, self).tearDown() - self.loop.close(all_fds=True) - - def test_socket_class(self): - s = self.context.socket(zmq.PUSH) - assert isinstance(s, future.Socket) - s.close() - - def test_recv_multipart(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_multipart() - assert not f.done() - yield a.send(b'hi') - recvd = yield f - self.assertEqual(recvd, [b'hi']) - self.loop.run_sync(test) - - def test_recv(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f1 = b.recv() - f2 = b.recv() - assert not f1.done() - assert not f2.done() - yield a.send_multipart([b'hi', b'there']) - recvd = yield f2 - assert f1.done() - self.assertEqual(f1.result(), b'hi') - self.assertEqual(recvd, b'there') - self.loop.run_sync(test) - - def test_recv_cancel(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f1 = b.recv() - f2 = b.recv_multipart() - assert f1.cancel() - assert f1.done() - assert not f2.done() - yield a.send_multipart([b'hi', b'there']) - recvd = yield f2 - assert f1.cancelled() - assert f2.done() - self.assertEqual(recvd, [b'hi', b'there']) - self.loop.run_sync(test) - - @pytest.mark.skipif(not hasattr(zmq, 'RCVTIMEO'), reason="requires RCVTIMEO") - def test_recv_timeout(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - b.rcvtimeo = 100 - f1 = b.recv() - b.rcvtimeo = 1000 - f2 = b.recv_multipart() - with pytest.raises(zmq.Again): - yield f1 - yield a.send_multipart([b'hi', b'there']) - recvd = yield f2 - assert f2.done() - self.assertEqual(recvd, [b'hi', b'there']) - self.loop.run_sync(test) - - @pytest.mark.skipif(not hasattr(zmq, 'SNDTIMEO'), reason="requires SNDTIMEO") - def test_send_timeout(self): - @gen.coroutine - def test(): - s = self.socket(zmq.PUSH) - s.sndtimeo = 100 - with pytest.raises(zmq.Again): - yield s.send(b'not going anywhere') - self.loop.run_sync(test) - - def test_recv_string(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_string() - assert not f.done() - msg = u('πøøπ') - yield a.send_string(msg) - recvd = yield f - assert f.done() - self.assertEqual(f.result(), msg) - self.assertEqual(recvd, msg) - self.loop.run_sync(test) - - def test_recv_json(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_json() - assert not f.done() - obj = dict(a=5) - yield a.send_json(obj) - recvd = yield f - assert f.done() - self.assertEqual(f.result(), obj) - self.assertEqual(recvd, obj) - self.loop.run_sync(test) - - def test_recv_pyobj(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.recv_pyobj() - assert not f.done() - obj = dict(a=5) - yield a.send_pyobj(obj) - recvd = yield f - assert f.done() - self.assertEqual(f.result(), obj) - self.assertEqual(recvd, obj) - self.loop.run_sync(test) - - def test_poll(self): - @gen.coroutine - def test(): - a, b = self.create_bound_pair(zmq.PUSH, zmq.PULL) - f = b.poll(timeout=0) - self.assertEqual(f.result(), 0) - - f = b.poll(timeout=1) - assert not f.done() - evt = yield f - self.assertEqual(evt, 0) - - f = b.poll(timeout=1000) - assert not f.done() - yield a.send_multipart([b'hi', b'there']) - evt = yield f - self.assertEqual(evt, zmq.POLLIN) - recvd = yield b.recv_multipart() - self.assertEqual(recvd, [b'hi', b'there']) - self.loop.run_sync(test) diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_imports.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_imports.py deleted file mode 100644 index de0551904f..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_imports.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import sys -from unittest import TestCase - -class TestImports(TestCase): - """Test Imports - the quickest test to ensure that we haven't - introduced version-incompatible syntax errors.""" - - def test_toplevel(self): - """test toplevel import""" - import zmq - - def test_core(self): - """test core imports""" - from zmq import Context - from zmq import Socket - from zmq import Poller - from zmq import Frame - from zmq import constants - from zmq import device, proxy - from zmq import Stopwatch - from zmq import ( - zmq_version, - zmq_version_info, - pyzmq_version, - pyzmq_version_info, - ) - - def test_devices(self): - """test device imports""" - import zmq.devices - from zmq.devices import basedevice - from zmq.devices import monitoredqueue - from zmq.devices import monitoredqueuedevice - - def test_log(self): - """test log imports""" - import zmq.log - from zmq.log import handlers - - def test_eventloop(self): - """test eventloop imports""" - import zmq.eventloop - from zmq.eventloop import ioloop - from zmq.eventloop import zmqstream - from zmq.eventloop.minitornado.platform import auto - from zmq.eventloop.minitornado import ioloop - - def test_utils(self): - """test util imports""" - import zmq.utils - from zmq.utils import strtypes - from zmq.utils import jsonapi - - def test_ssh(self): - """test ssh imports""" - from zmq.ssh import tunnel - - def test_decorators(self): - """test decorators imports""" - from zmq.decorators import context, socket - - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_ioloop.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_ioloop.py deleted file mode 100644 index 42ec2db9cc..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_ioloop.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import time -import os -import threading - -import zmq -from zmq.tests import BaseZMQTestCase -from zmq.eventloop import ioloop -from zmq.eventloop.minitornado.ioloop import _Timeout -try: - from tornado.ioloop import PollIOLoop, IOLoop as BaseIOLoop -except ImportError: - from zmq.eventloop.minitornado.ioloop import IOLoop as BaseIOLoop - - -def printer(): - os.system("say hello") - raise Exception - print (time.time()) - - -class Delay(threading.Thread): - def __init__(self, f, delay=1): - self.f=f - self.delay=delay - self.aborted=False - self.cond=threading.Condition() - super(Delay, self).__init__() - - def run(self): - self.cond.acquire() - self.cond.wait(self.delay) - self.cond.release() - if not self.aborted: - self.f() - - def abort(self): - self.aborted=True - self.cond.acquire() - self.cond.notify() - self.cond.release() - - -class TestIOLoop(BaseZMQTestCase): - - def test_simple(self): - """simple IOLoop creation test""" - loop = ioloop.IOLoop() - dc = ioloop.PeriodicCallback(loop.stop, 200, loop) - pc = ioloop.PeriodicCallback(lambda : None, 10, loop) - pc.start() - dc.start() - t = Delay(loop.stop,1) - t.start() - loop.start() - if t.isAlive(): - t.abort() - else: - self.fail("IOLoop failed to exit") - - def test_poller_events(self): - """Tornado poller implementation maps events correctly""" - req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) - poller = ioloop.ZMQPoller() - poller.register(req, ioloop.IOLoop.READ) - poller.register(rep, ioloop.IOLoop.READ) - events = dict(poller.poll(0)) - self.assertEqual(events.get(rep), None) - self.assertEqual(events.get(req), None) - - poller.register(req, ioloop.IOLoop.WRITE) - poller.register(rep, ioloop.IOLoop.WRITE) - events = dict(poller.poll(1)) - self.assertEqual(events.get(req), ioloop.IOLoop.WRITE) - self.assertEqual(events.get(rep), None) - - poller.register(rep, ioloop.IOLoop.READ) - req.send(b'hi') - events = dict(poller.poll(1)) - self.assertEqual(events.get(rep), ioloop.IOLoop.READ) - self.assertEqual(events.get(req), None) - - def test_instance(self): - """Test IOLoop.instance returns the right object""" - loop = ioloop.IOLoop.instance() - self.assertEqual(loop.__class__, ioloop.IOLoop) - loop = BaseIOLoop.instance() - self.assertEqual(loop.__class__, ioloop.IOLoop) - - def test_close_all(self): - """Test close(all_fds=True)""" - loop = ioloop.IOLoop.instance() - req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) - loop.add_handler(req, lambda msg: msg, ioloop.IOLoop.READ) - loop.add_handler(rep, lambda msg: msg, ioloop.IOLoop.READ) - self.assertEqual(req.closed, False) - self.assertEqual(rep.closed, False) - loop.close(all_fds=True) - self.assertEqual(req.closed, True) - self.assertEqual(rep.closed, True) - - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_log.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_log.py deleted file mode 100644 index 9206f095c8..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_log.py +++ /dev/null @@ -1,116 +0,0 @@ -# encoding: utf-8 - -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import logging -import time -from unittest import TestCase - -import zmq -from zmq.log import handlers -from zmq.utils.strtypes import b, u -from zmq.tests import BaseZMQTestCase - - -class TestPubLog(BaseZMQTestCase): - - iface = 'inproc://zmqlog' - topic= 'zmq' - - @property - def logger(self): - # print dir(self) - logger = logging.getLogger('zmqtest') - logger.setLevel(logging.DEBUG) - return logger - - def connect_handler(self, topic=None): - topic = self.topic if topic is None else topic - logger = self.logger - pub,sub = self.create_bound_pair(zmq.PUB, zmq.SUB) - handler = handlers.PUBHandler(pub) - handler.setLevel(logging.DEBUG) - handler.root_topic = topic - logger.addHandler(handler) - sub.setsockopt(zmq.SUBSCRIBE, b(topic)) - time.sleep(0.1) - return logger, handler, sub - - def test_init_iface(self): - logger = self.logger - ctx = self.context - handler = handlers.PUBHandler(self.iface) - self.assertFalse(handler.ctx is ctx) - self.sockets.append(handler.socket) - # handler.ctx.term() - handler = handlers.PUBHandler(self.iface, self.context) - self.sockets.append(handler.socket) - self.assertTrue(handler.ctx is ctx) - handler.setLevel(logging.DEBUG) - handler.root_topic = self.topic - logger.addHandler(handler) - sub = ctx.socket(zmq.SUB) - self.sockets.append(sub) - sub.setsockopt(zmq.SUBSCRIBE, b(self.topic)) - sub.connect(self.iface) - import time; time.sleep(0.25) - msg1 = 'message' - logger.info(msg1) - - (topic, msg2) = sub.recv_multipart() - self.assertEqual(topic, b'zmq.INFO') - self.assertEqual(msg2, b(msg1)+b'\n') - logger.removeHandler(handler) - - def test_init_socket(self): - pub,sub = self.create_bound_pair(zmq.PUB, zmq.SUB) - logger = self.logger - handler = handlers.PUBHandler(pub) - handler.setLevel(logging.DEBUG) - handler.root_topic = self.topic - logger.addHandler(handler) - - self.assertTrue(handler.socket is pub) - self.assertTrue(handler.ctx is pub.context) - self.assertTrue(handler.ctx is self.context) - sub.setsockopt(zmq.SUBSCRIBE, b(self.topic)) - import time; time.sleep(0.1) - msg1 = 'message' - logger.info(msg1) - - (topic, msg2) = sub.recv_multipart() - self.assertEqual(topic, b'zmq.INFO') - self.assertEqual(msg2, b(msg1)+b'\n') - logger.removeHandler(handler) - - def test_root_topic(self): - logger, handler, sub = self.connect_handler() - handler.socket.bind(self.iface) - sub2 = sub.context.socket(zmq.SUB) - self.sockets.append(sub2) - sub2.connect(self.iface) - sub2.setsockopt(zmq.SUBSCRIBE, b'') - handler.root_topic = b'twoonly' - msg1 = 'ignored' - logger.info(msg1) - self.assertRaisesErrno(zmq.EAGAIN, sub.recv, zmq.NOBLOCK) - topic,msg2 = sub2.recv_multipart() - self.assertEqual(topic, b'twoonly.INFO') - self.assertEqual(msg2, b(msg1)+b'\n') - - logger.removeHandler(handler) - - def test_unicode_message(self): - logger, handler, sub = self.connect_handler() - base_topic = b(self.topic + '.INFO') - for msg, expected in [ - (u('hello'), [base_topic, b('hello\n')]), - (u('héllo'), [base_topic, b('héllo\n')]), - (u('tøpic::héllo'), [base_topic + b('.tøpic'), b('héllo\n')]), - ]: - logger.info(msg) - received = sub.recv_multipart() - self.assertEqual(received, expected) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_message.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_message.py deleted file mode 100644 index 063768cc29..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_message.py +++ /dev/null @@ -1,379 +0,0 @@ -# -*- coding: utf8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import copy -import sys -try: - from sys import getrefcount as grc -except ImportError: - grc = None - -import time -from pprint import pprint -from unittest import TestCase - -import zmq -from zmq.tests import BaseZMQTestCase, SkipTest, skip_pypy, PYPY -from zmq.utils.strtypes import unicode, bytes, b, u - - -# some useful constants: - -x = b'x' - -try: - view = memoryview -except NameError: - view = buffer - -if grc: - rc0 = grc(x) - v = view(x) - view_rc = grc(x) - rc0 - -def await_gc(obj, rc): - """wait for refcount on an object to drop to an expected value - - Necessary because of the zero-copy gc thread, - which can take some time to receive its DECREF message. - """ - for i in range(50): - # rc + 2 because of the refs in this function - if grc(obj) <= rc + 2: - return - time.sleep(0.05) - -class TestFrame(BaseZMQTestCase): - - @skip_pypy - def test_above_30(self): - """Message above 30 bytes are never copied by 0MQ.""" - for i in range(5, 16): # 32, 64,..., 65536 - s = (2**i)*x - self.assertEqual(grc(s), 2) - m = zmq.Frame(s) - self.assertEqual(grc(s), 4) - del m - await_gc(s, 2) - self.assertEqual(grc(s), 2) - del s - - def test_str(self): - """Test the str representations of the Frames.""" - for i in range(16): - s = (2**i)*x - m = zmq.Frame(s) - m_str = str(m) - m_str_b = b(m_str) # py3compat - self.assertEqual(s, m_str_b) - - def test_bytes(self): - """Test the Frame.bytes property.""" - for i in range(1,16): - s = (2**i)*x - m = zmq.Frame(s) - b = m.bytes - self.assertEqual(s, m.bytes) - if not PYPY: - # check that it copies - self.assert_(b is not s) - # check that it copies only once - self.assert_(b is m.bytes) - - def test_unicode(self): - """Test the unicode representations of the Frames.""" - s = u('asdf') - self.assertRaises(TypeError, zmq.Frame, s) - for i in range(16): - s = (2**i)*u('§') - m = zmq.Frame(s.encode('utf8')) - self.assertEqual(s, unicode(m.bytes,'utf8')) - - def test_len(self): - """Test the len of the Frames.""" - for i in range(16): - s = (2**i)*x - m = zmq.Frame(s) - self.assertEqual(len(s), len(m)) - - @skip_pypy - def test_lifecycle1(self): - """Run through a ref counting cycle with a copy.""" - for i in range(5, 16): # 32, 64,..., 65536 - s = (2**i)*x - rc = 2 - self.assertEqual(grc(s), rc) - m = zmq.Frame(s) - rc += 2 - self.assertEqual(grc(s), rc) - m2 = copy.copy(m) - rc += 1 - self.assertEqual(grc(s), rc) - buf = m2.buffer - - rc += view_rc - self.assertEqual(grc(s), rc) - - self.assertEqual(s, b(str(m))) - self.assertEqual(s, bytes(m2)) - self.assertEqual(s, m.bytes) - # self.assert_(s is str(m)) - # self.assert_(s is str(m2)) - del m2 - rc -= 1 - self.assertEqual(grc(s), rc) - rc -= view_rc - del buf - self.assertEqual(grc(s), rc) - del m - rc -= 2 - await_gc(s, rc) - self.assertEqual(grc(s), rc) - self.assertEqual(rc, 2) - del s - - @skip_pypy - def test_lifecycle2(self): - """Run through a different ref counting cycle with a copy.""" - for i in range(5, 16): # 32, 64,..., 65536 - s = (2**i)*x - rc = 2 - self.assertEqual(grc(s), rc) - m = zmq.Frame(s) - rc += 2 - self.assertEqual(grc(s), rc) - m2 = copy.copy(m) - rc += 1 - self.assertEqual(grc(s), rc) - buf = m.buffer - rc += view_rc - self.assertEqual(grc(s), rc) - self.assertEqual(s, b(str(m))) - self.assertEqual(s, bytes(m2)) - self.assertEqual(s, m2.bytes) - self.assertEqual(s, m.bytes) - # self.assert_(s is str(m)) - # self.assert_(s is str(m2)) - del buf - self.assertEqual(grc(s), rc) - del m - # m.buffer is kept until m is del'd - rc -= view_rc - rc -= 1 - self.assertEqual(grc(s), rc) - del m2 - rc -= 2 - await_gc(s, rc) - self.assertEqual(grc(s), rc) - self.assertEqual(rc, 2) - del s - - @skip_pypy - def test_tracker(self): - m = zmq.Frame(b'asdf', track=True) - self.assertFalse(m.tracker.done) - pm = zmq.MessageTracker(m) - self.assertFalse(pm.done) - del m - for i in range(10): - if pm.done: - break - time.sleep(0.1) - self.assertTrue(pm.done) - - def test_no_tracker(self): - m = zmq.Frame(b'asdf', track=False) - self.assertEqual(m.tracker, None) - m2 = copy.copy(m) - self.assertEqual(m2.tracker, None) - self.assertRaises(ValueError, zmq.MessageTracker, m) - - @skip_pypy - def test_multi_tracker(self): - m = zmq.Frame(b'asdf', track=True) - m2 = zmq.Frame(b'whoda', track=True) - mt = zmq.MessageTracker(m,m2) - self.assertFalse(m.tracker.done) - self.assertFalse(mt.done) - self.assertRaises(zmq.NotDone, mt.wait, 0.1) - del m - time.sleep(0.1) - self.assertRaises(zmq.NotDone, mt.wait, 0.1) - self.assertFalse(mt.done) - del m2 - self.assertTrue(mt.wait() is None) - self.assertTrue(mt.done) - - - def test_buffer_in(self): - """test using a buffer as input""" - ins = b("§§¶•ªº˜µ¬˚…∆˙åß∂©œ∑´†≈ç√") - m = zmq.Frame(view(ins)) - - def test_bad_buffer_in(self): - """test using a bad object""" - self.assertRaises(TypeError, zmq.Frame, 5) - self.assertRaises(TypeError, zmq.Frame, object()) - - def test_buffer_out(self): - """receiving buffered output""" - ins = b("§§¶•ªº˜µ¬˚…∆˙åß∂©œ∑´†≈ç√") - m = zmq.Frame(ins) - outb = m.buffer - self.assertTrue(isinstance(outb, view)) - self.assert_(outb is m.buffer) - self.assert_(m.buffer is m.buffer) - - @skip_pypy - def test_memoryview_shape(self): - """memoryview shape info""" - if sys.version_info < (3,): - raise SkipTest("only test memoryviews on Python 3") - data = b("§§¶•ªº˜µ¬˚…∆˙åß∂©œ∑´†≈ç√") - n = len(data) - f = zmq.Frame(data) - view1 = f.buffer - self.assertEqual(view1.ndim, 1) - self.assertEqual(view1.shape, (n,)) - self.assertEqual(view1.tobytes(), data) - view2 = memoryview(f) - self.assertEqual(view2.ndim, 1) - self.assertEqual(view2.shape, (n,)) - self.assertEqual(view2.tobytes(), data) - - def test_multisend(self): - """ensure that a message remains intact after multiple sends""" - a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - s = b"message" - m = zmq.Frame(s) - self.assertEqual(s, m.bytes) - - a.send(m, copy=False) - time.sleep(0.1) - self.assertEqual(s, m.bytes) - a.send(m, copy=False) - time.sleep(0.1) - self.assertEqual(s, m.bytes) - a.send(m, copy=True) - time.sleep(0.1) - self.assertEqual(s, m.bytes) - a.send(m, copy=True) - time.sleep(0.1) - self.assertEqual(s, m.bytes) - for i in range(4): - r = b.recv() - self.assertEqual(s,r) - self.assertEqual(s, m.bytes) - - def test_buffer_numpy(self): - """test non-copying numpy array messages""" - try: - import numpy - except ImportError: - raise SkipTest("numpy required") - rand = numpy.random.randint - shapes = [ rand(2,16) for i in range(5) ] - for i in range(1,len(shapes)+1): - shape = shapes[:i] - A = numpy.random.random(shape) - m = zmq.Frame(A) - if view.__name__ == 'buffer': - self.assertEqual(A.data, m.buffer) - B = numpy.frombuffer(m.buffer,dtype=A.dtype).reshape(A.shape) - else: - self.assertEqual(memoryview(A), m.buffer) - B = numpy.array(m.buffer,dtype=A.dtype).reshape(A.shape) - self.assertEqual((A==B).all(), True) - - def test_memoryview(self): - """test messages from memoryview""" - major,minor = sys.version_info[:2] - if not (major >= 3 or (major == 2 and minor >= 7)): - raise SkipTest("memoryviews only in python >= 2.7") - - s = b'carrotjuice' - v = memoryview(s) - m = zmq.Frame(s) - buf = m.buffer - s2 = buf.tobytes() - self.assertEqual(s2,s) - self.assertEqual(m.bytes,s) - - def test_noncopying_recv(self): - """check for clobbering message buffers""" - null = b'\0'*64 - sa,sb = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - for i in range(32): - # try a few times - sb.send(null, copy=False) - m = sa.recv(copy=False) - mb = m.bytes - # buf = view(m) - buf = m.buffer - del m - for i in range(5): - ff=b'\xff'*(40 + i*10) - sb.send(ff, copy=False) - m2 = sa.recv(copy=False) - if view.__name__ == 'buffer': - b = bytes(buf) - else: - b = buf.tobytes() - self.assertEqual(b, null) - self.assertEqual(mb, null) - self.assertEqual(m2.bytes, ff) - - @skip_pypy - def test_buffer_numpy(self): - """test non-copying numpy array messages""" - try: - import numpy - except ImportError: - raise SkipTest("requires numpy") - if sys.version_info < (2,7): - raise SkipTest("requires new-style buffer interface (py >= 2.7)") - rand = numpy.random.randint - shapes = [ rand(2,5) for i in range(5) ] - a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - dtypes = [int, float, '>i4', 'B'] - for i in range(1,len(shapes)+1): - shape = shapes[:i] - for dt in dtypes: - A = numpy.empty(shape, dtype=dt) - while numpy.isnan(A).any(): - # don't let nan sneak in - A = numpy.ndarray(shape, dtype=dt) - a.send(A, copy=False) - msg = b.recv(copy=False) - - B = numpy.frombuffer(msg, A.dtype).reshape(A.shape) - self.assertEqual(A.shape, B.shape) - self.assertTrue((A==B).all()) - A = numpy.empty(shape, dtype=[('a', int), ('b', float), ('c', 'a32')]) - A['a'] = 1024 - A['b'] = 1e9 - A['c'] = 'hello there' - a.send(A, copy=False) - msg = b.recv(copy=False) - - B = numpy.frombuffer(msg, A.dtype).reshape(A.shape) - self.assertEqual(A.shape, B.shape) - self.assertTrue((A==B).all()) - - def test_frame_more(self): - """test Frame.more attribute""" - frame = zmq.Frame(b"hello") - self.assertFalse(frame.more) - sa,sb = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - sa.send_multipart([b'hi', b'there']) - frame = self.recv(sb, copy=False) - self.assertTrue(frame.more) - if zmq.zmq_version_info()[0] >= 3 and not PYPY: - self.assertTrue(frame.get(zmq.MORE)) - frame = self.recv(sb, copy=False) - self.assertFalse(frame.more) - if zmq.zmq_version_info()[0] >= 3 and not PYPY: - self.assertFalse(frame.get(zmq.MORE)) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_monitor.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_monitor.py deleted file mode 100644 index b0aac1831a..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_monitor.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import errno -import sys -import time -import struct - -from unittest import TestCase -from pytest import mark -import zmq -from zmq.tests import BaseZMQTestCase, skip_pypy, require_zmq_4 -from zmq.utils.monitor import recv_monitor_message - - -class TestSocketMonitor(BaseZMQTestCase): - - @require_zmq_4 - def test_monitor(self): - """Test monitoring interface for sockets.""" - s_rep = self.context.socket(zmq.REP) - s_req = self.context.socket(zmq.REQ) - self.sockets.extend([s_rep, s_req]) - s_req.bind("tcp://127.0.0.1:6666") - # try monitoring the REP socket - - s_rep.monitor("inproc://monitor.rep", zmq.EVENT_ALL) - # create listening socket for monitor - s_event = self.context.socket(zmq.PAIR) - self.sockets.append(s_event) - s_event.connect("inproc://monitor.rep") - s_event.linger = 0 - # test receive event for connect event - s_rep.connect("tcp://127.0.0.1:6666") - m = recv_monitor_message(s_event) - if m['event'] == zmq.EVENT_CONNECT_DELAYED: - self.assertEqual(m['endpoint'], b"tcp://127.0.0.1:6666") - # test receive event for connected event - m = recv_monitor_message(s_event) - self.assertEqual(m['event'], zmq.EVENT_CONNECTED) - self.assertEqual(m['endpoint'], b"tcp://127.0.0.1:6666") - - # test monitor can be disabled. - s_rep.disable_monitor() - m = recv_monitor_message(s_event) - self.assertEqual(m['event'], zmq.EVENT_MONITOR_STOPPED) - - @require_zmq_4 - def test_monitor_repeat(self): - s = self.socket(zmq.PULL) - m = s.get_monitor_socket() - self.sockets.append(m) - m2 = s.get_monitor_socket() - assert m is m2 - s.disable_monitor() - evt = recv_monitor_message(m) - self.assertEqual(evt['event'], zmq.EVENT_MONITOR_STOPPED) - m.close() - s.close() - - @require_zmq_4 - def test_monitor_connected(self): - """Test connected monitoring socket.""" - s_rep = self.context.socket(zmq.REP) - s_req = self.context.socket(zmq.REQ) - self.sockets.extend([s_rep, s_req]) - s_req.bind("tcp://127.0.0.1:6667") - # try monitoring the REP socket - # create listening socket for monitor - s_event = s_rep.get_monitor_socket() - s_event.linger = 0 - self.sockets.append(s_event) - # test receive event for connect event - s_rep.connect("tcp://127.0.0.1:6667") - m = recv_monitor_message(s_event) - if m['event'] == zmq.EVENT_CONNECT_DELAYED: - self.assertEqual(m['endpoint'], b"tcp://127.0.0.1:6667") - # test receive event for connected event - m = recv_monitor_message(s_event) - self.assertEqual(m['event'], zmq.EVENT_CONNECTED) - self.assertEqual(m['endpoint'], b"tcp://127.0.0.1:6667") diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_monqueue.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_monqueue.py deleted file mode 100644 index e855602e77..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_monqueue.py +++ /dev/null @@ -1,227 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import time -from unittest import TestCase - -import zmq -from zmq import devices - -from zmq.tests import BaseZMQTestCase, SkipTest, PYPY -from zmq.utils.strtypes import unicode - - -if PYPY or zmq.zmq_version_info() >= (4,1): - # cleanup of shared Context doesn't work on PyPy - # there also seems to be a bug in cleanup in libzmq-4.1 (zeromq/libzmq#1052) - devices.Device.context_factory = zmq.Context - - -class TestMonitoredQueue(BaseZMQTestCase): - - sockets = [] - - def build_device(self, mon_sub=b"", in_prefix=b'in', out_prefix=b'out'): - self.device = devices.ThreadMonitoredQueue(zmq.PAIR, zmq.PAIR, zmq.PUB, - in_prefix, out_prefix) - alice = self.context.socket(zmq.PAIR) - bob = self.context.socket(zmq.PAIR) - mon = self.context.socket(zmq.SUB) - - aport = alice.bind_to_random_port('tcp://127.0.0.1') - bport = bob.bind_to_random_port('tcp://127.0.0.1') - mport = mon.bind_to_random_port('tcp://127.0.0.1') - mon.setsockopt(zmq.SUBSCRIBE, mon_sub) - - self.device.connect_in("tcp://127.0.0.1:%i"%aport) - self.device.connect_out("tcp://127.0.0.1:%i"%bport) - self.device.connect_mon("tcp://127.0.0.1:%i"%mport) - self.device.start() - time.sleep(.2) - try: - # this is currenlty necessary to ensure no dropped monitor messages - # see LIBZMQ-248 for more info - mon.recv_multipart(zmq.NOBLOCK) - except zmq.ZMQError: - pass - self.sockets.extend([alice, bob, mon]) - return alice, bob, mon - - - def teardown_device(self): - for socket in self.sockets: - socket.close() - del socket - del self.device - - def test_reply(self): - alice, bob, mon = self.build_device() - alices = b"hello bob".split() - alice.send_multipart(alices) - bobs = self.recv_multipart(bob) - self.assertEqual(alices, bobs) - bobs = b"hello alice".split() - bob.send_multipart(bobs) - alices = self.recv_multipart(alice) - self.assertEqual(alices, bobs) - self.teardown_device() - - def test_queue(self): - alice, bob, mon = self.build_device() - alices = b"hello bob".split() - alice.send_multipart(alices) - alices2 = b"hello again".split() - alice.send_multipart(alices2) - alices3 = b"hello again and again".split() - alice.send_multipart(alices3) - bobs = self.recv_multipart(bob) - self.assertEqual(alices, bobs) - bobs = self.recv_multipart(bob) - self.assertEqual(alices2, bobs) - bobs = self.recv_multipart(bob) - self.assertEqual(alices3, bobs) - bobs = b"hello alice".split() - bob.send_multipart(bobs) - alices = self.recv_multipart(alice) - self.assertEqual(alices, bobs) - self.teardown_device() - - def test_monitor(self): - alice, bob, mon = self.build_device() - alices = b"hello bob".split() - alice.send_multipart(alices) - alices2 = b"hello again".split() - alice.send_multipart(alices2) - alices3 = b"hello again and again".split() - alice.send_multipart(alices3) - bobs = self.recv_multipart(bob) - self.assertEqual(alices, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'in']+bobs, mons) - bobs = self.recv_multipart(bob) - self.assertEqual(alices2, bobs) - bobs = self.recv_multipart(bob) - self.assertEqual(alices3, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'in']+alices2, mons) - bobs = b"hello alice".split() - bob.send_multipart(bobs) - alices = self.recv_multipart(alice) - self.assertEqual(alices, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'in']+alices3, mons) - mons = self.recv_multipart(mon) - self.assertEqual([b'out']+bobs, mons) - self.teardown_device() - - def test_prefix(self): - alice, bob, mon = self.build_device(b"", b'foo', b'bar') - alices = b"hello bob".split() - alice.send_multipart(alices) - alices2 = b"hello again".split() - alice.send_multipart(alices2) - alices3 = b"hello again and again".split() - alice.send_multipart(alices3) - bobs = self.recv_multipart(bob) - self.assertEqual(alices, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'foo']+bobs, mons) - bobs = self.recv_multipart(bob) - self.assertEqual(alices2, bobs) - bobs = self.recv_multipart(bob) - self.assertEqual(alices3, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'foo']+alices2, mons) - bobs = b"hello alice".split() - bob.send_multipart(bobs) - alices = self.recv_multipart(alice) - self.assertEqual(alices, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'foo']+alices3, mons) - mons = self.recv_multipart(mon) - self.assertEqual([b'bar']+bobs, mons) - self.teardown_device() - - def test_monitor_subscribe(self): - alice, bob, mon = self.build_device(b"out") - alices = b"hello bob".split() - alice.send_multipart(alices) - alices2 = b"hello again".split() - alice.send_multipart(alices2) - alices3 = b"hello again and again".split() - alice.send_multipart(alices3) - bobs = self.recv_multipart(bob) - self.assertEqual(alices, bobs) - bobs = self.recv_multipart(bob) - self.assertEqual(alices2, bobs) - bobs = self.recv_multipart(bob) - self.assertEqual(alices3, bobs) - bobs = b"hello alice".split() - bob.send_multipart(bobs) - alices = self.recv_multipart(alice) - self.assertEqual(alices, bobs) - mons = self.recv_multipart(mon) - self.assertEqual([b'out']+bobs, mons) - self.teardown_device() - - def test_router_router(self): - """test router-router MQ devices""" - dev = devices.ThreadMonitoredQueue(zmq.ROUTER, zmq.ROUTER, zmq.PUB, b'in', b'out') - self.device = dev - dev.setsockopt_in(zmq.LINGER, 0) - dev.setsockopt_out(zmq.LINGER, 0) - dev.setsockopt_mon(zmq.LINGER, 0) - - binder = self.context.socket(zmq.DEALER) - porta = binder.bind_to_random_port('tcp://127.0.0.1') - portb = binder.bind_to_random_port('tcp://127.0.0.1') - binder.close() - time.sleep(0.1) - a = self.context.socket(zmq.DEALER) - a.identity = b'a' - b = self.context.socket(zmq.DEALER) - b.identity = b'b' - self.sockets.extend([a, b]) - - a.connect('tcp://127.0.0.1:%i'%porta) - dev.bind_in('tcp://127.0.0.1:%i'%porta) - b.connect('tcp://127.0.0.1:%i'%portb) - dev.bind_out('tcp://127.0.0.1:%i'%portb) - dev.start() - time.sleep(0.2) - if zmq.zmq_version_info() >= (3,1,0): - # flush erroneous poll state, due to LIBZMQ-280 - ping_msg = [ b'ping', b'pong' ] - for s in (a,b): - s.send_multipart(ping_msg) - try: - s.recv(zmq.NOBLOCK) - except zmq.ZMQError: - pass - msg = [ b'hello', b'there' ] - a.send_multipart([b'b']+msg) - bmsg = self.recv_multipart(b) - self.assertEqual(bmsg, [b'a']+msg) - b.send_multipart(bmsg) - amsg = self.recv_multipart(a) - self.assertEqual(amsg, [b'b']+msg) - self.teardown_device() - - def test_default_mq_args(self): - self.device = dev = devices.ThreadMonitoredQueue(zmq.ROUTER, zmq.DEALER, zmq.PUB) - dev.setsockopt_in(zmq.LINGER, 0) - dev.setsockopt_out(zmq.LINGER, 0) - dev.setsockopt_mon(zmq.LINGER, 0) - # this will raise if default args are wrong - dev.start() - self.teardown_device() - - def test_mq_check_prefix(self): - ins = self.context.socket(zmq.ROUTER) - outs = self.context.socket(zmq.DEALER) - mons = self.context.socket(zmq.PUB) - self.sockets.extend([ins, outs, mons]) - - ins = unicode('in') - outs = unicode('out') - self.assertRaises(TypeError, devices.monitoredqueue, ins, outs, mons) diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_multipart.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_multipart.py deleted file mode 100644 index 24d41be059..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_multipart.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import zmq - - -from zmq.tests import BaseZMQTestCase, SkipTest, have_gevent, GreenTest - - -class TestMultipart(BaseZMQTestCase): - - def test_router_dealer(self): - router, dealer = self.create_bound_pair(zmq.ROUTER, zmq.DEALER) - - msg1 = b'message1' - dealer.send(msg1) - ident = self.recv(router) - more = router.rcvmore - self.assertEqual(more, True) - msg2 = self.recv(router) - self.assertEqual(msg1, msg2) - more = router.rcvmore - self.assertEqual(more, False) - - def test_basic_multipart(self): - a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - msg = [ b'hi', b'there', b'b'] - a.send_multipart(msg) - recvd = b.recv_multipart() - self.assertEqual(msg, recvd) - -if have_gevent: - class TestMultipartGreen(GreenTest, TestMultipart): - pass diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_pair.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_pair.py deleted file mode 100644 index e88c1e8b2e..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_pair.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import zmq - - -from zmq.tests import BaseZMQTestCase, have_gevent, GreenTest - - -x = b' ' -class TestPair(BaseZMQTestCase): - - def test_basic(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - - msg1 = b'message1' - msg2 = self.ping_pong(s1, s2, msg1) - self.assertEqual(msg1, msg2) - - def test_multiple(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - - for i in range(10): - msg = i*x - s1.send(msg) - - for i in range(10): - msg = i*x - s2.send(msg) - - for i in range(10): - msg = s1.recv() - self.assertEqual(msg, i*x) - - for i in range(10): - msg = s2.recv() - self.assertEqual(msg, i*x) - - def test_json(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - o = dict(a=10,b=list(range(10))) - o2 = self.ping_pong_json(s1, s2, o) - - def test_pyobj(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - o = dict(a=10,b=range(10)) - o2 = self.ping_pong_pyobj(s1, s2, o) - -if have_gevent: - class TestReqRepGreen(GreenTest, TestPair): - pass - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_poll.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_poll.py deleted file mode 100644 index 57346c8968..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_poll.py +++ /dev/null @@ -1,229 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import time -from unittest import TestCase - -import zmq - -from zmq.tests import PollZMQTestCase, have_gevent, GreenTest - -def wait(): - time.sleep(.25) - - -class TestPoll(PollZMQTestCase): - - Poller = zmq.Poller - - # This test is failing due to this issue: - # http://github.com/sustrik/zeromq2/issues#issue/26 - def test_pair(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - - # Sleep to allow sockets to connect. - wait() - - poller = self.Poller() - poller.register(s1, zmq.POLLIN|zmq.POLLOUT) - poller.register(s2, zmq.POLLIN|zmq.POLLOUT) - # Poll result should contain both sockets - socks = dict(poller.poll()) - # Now make sure that both are send ready. - self.assertEqual(socks[s1], zmq.POLLOUT) - self.assertEqual(socks[s2], zmq.POLLOUT) - # Now do a send on both, wait and test for zmq.POLLOUT|zmq.POLLIN - s1.send(b'msg1') - s2.send(b'msg2') - wait() - socks = dict(poller.poll()) - self.assertEqual(socks[s1], zmq.POLLOUT|zmq.POLLIN) - self.assertEqual(socks[s2], zmq.POLLOUT|zmq.POLLIN) - # Make sure that both are in POLLOUT after recv. - s1.recv() - s2.recv() - socks = dict(poller.poll()) - self.assertEqual(socks[s1], zmq.POLLOUT) - self.assertEqual(socks[s2], zmq.POLLOUT) - - poller.unregister(s1) - poller.unregister(s2) - - # Wait for everything to finish. - wait() - - def test_reqrep(self): - s1, s2 = self.create_bound_pair(zmq.REP, zmq.REQ) - - # Sleep to allow sockets to connect. - wait() - - poller = self.Poller() - poller.register(s1, zmq.POLLIN|zmq.POLLOUT) - poller.register(s2, zmq.POLLIN|zmq.POLLOUT) - - # Make sure that s1 is in state 0 and s2 is in POLLOUT - socks = dict(poller.poll()) - self.assertEqual(s1 in socks, 0) - self.assertEqual(socks[s2], zmq.POLLOUT) - - # Make sure that s2 goes immediately into state 0 after send. - s2.send(b'msg1') - socks = dict(poller.poll()) - self.assertEqual(s2 in socks, 0) - - # Make sure that s1 goes into POLLIN state after a time.sleep(). - time.sleep(0.5) - socks = dict(poller.poll()) - self.assertEqual(socks[s1], zmq.POLLIN) - - # Make sure that s1 goes into POLLOUT after recv. - s1.recv() - socks = dict(poller.poll()) - self.assertEqual(socks[s1], zmq.POLLOUT) - - # Make sure s1 goes into state 0 after send. - s1.send(b'msg2') - socks = dict(poller.poll()) - self.assertEqual(s1 in socks, 0) - - # Wait and then see that s2 is in POLLIN. - time.sleep(0.5) - socks = dict(poller.poll()) - self.assertEqual(socks[s2], zmq.POLLIN) - - # Make sure that s2 is in POLLOUT after recv. - s2.recv() - socks = dict(poller.poll()) - self.assertEqual(socks[s2], zmq.POLLOUT) - - poller.unregister(s1) - poller.unregister(s2) - - # Wait for everything to finish. - wait() - - def test_no_events(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - poller = self.Poller() - poller.register(s1, zmq.POLLIN|zmq.POLLOUT) - poller.register(s2, 0) - self.assertTrue(s1 in poller) - self.assertFalse(s2 in poller) - poller.register(s1, 0) - self.assertFalse(s1 in poller) - - def test_pubsub(self): - s1, s2 = self.create_bound_pair(zmq.PUB, zmq.SUB) - s2.setsockopt(zmq.SUBSCRIBE, b'') - - # Sleep to allow sockets to connect. - wait() - - poller = self.Poller() - poller.register(s1, zmq.POLLIN|zmq.POLLOUT) - poller.register(s2, zmq.POLLIN) - - # Now make sure that both are send ready. - socks = dict(poller.poll()) - self.assertEqual(socks[s1], zmq.POLLOUT) - self.assertEqual(s2 in socks, 0) - # Make sure that s1 stays in POLLOUT after a send. - s1.send(b'msg1') - socks = dict(poller.poll()) - self.assertEqual(socks[s1], zmq.POLLOUT) - - # Make sure that s2 is POLLIN after waiting. - wait() - socks = dict(poller.poll()) - self.assertEqual(socks[s2], zmq.POLLIN) - - # Make sure that s2 goes into 0 after recv. - s2.recv() - socks = dict(poller.poll()) - self.assertEqual(s2 in socks, 0) - - poller.unregister(s1) - poller.unregister(s2) - - # Wait for everything to finish. - wait() - def test_timeout(self): - """make sure Poller.poll timeout has the right units (milliseconds).""" - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - poller = self.Poller() - poller.register(s1, zmq.POLLIN) - tic = time.time() - evt = poller.poll(.005) - toc = time.time() - self.assertTrue(toc-tic < 0.1) - tic = time.time() - evt = poller.poll(5) - toc = time.time() - self.assertTrue(toc-tic < 0.1) - self.assertTrue(toc-tic > .001) - tic = time.time() - evt = poller.poll(500) - toc = time.time() - self.assertTrue(toc-tic < 1) - self.assertTrue(toc-tic > 0.1) - -class TestSelect(PollZMQTestCase): - - def test_pair(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - - # Sleep to allow sockets to connect. - wait() - - rlist, wlist, xlist = zmq.select([s1, s2], [s1, s2], [s1, s2]) - self.assert_(s1 in wlist) - self.assert_(s2 in wlist) - self.assert_(s1 not in rlist) - self.assert_(s2 not in rlist) - - def test_timeout(self): - """make sure select timeout has the right units (seconds).""" - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - tic = time.time() - r,w,x = zmq.select([s1,s2],[],[],.005) - toc = time.time() - self.assertTrue(toc-tic < 1) - self.assertTrue(toc-tic > 0.001) - tic = time.time() - r,w,x = zmq.select([s1,s2],[],[],.25) - toc = time.time() - self.assertTrue(toc-tic < 1) - self.assertTrue(toc-tic > 0.1) - - -if have_gevent: - import gevent - from zmq import green as gzmq - - class TestPollGreen(GreenTest, TestPoll): - Poller = gzmq.Poller - - def test_wakeup(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - poller = self.Poller() - poller.register(s2, zmq.POLLIN) - - tic = time.time() - r = gevent.spawn(lambda: poller.poll(10000)) - s = gevent.spawn(lambda: s1.send(b'msg1')) - r.join() - toc = time.time() - self.assertTrue(toc-tic < 1) - - def test_socket_poll(self): - s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - - tic = time.time() - r = gevent.spawn(lambda: s2.poll(10000)) - s = gevent.spawn(lambda: s1.send(b'msg1')) - r.join() - toc = time.time() - self.assertTrue(toc-tic < 1) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_pubsub.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_pubsub.py deleted file mode 100644 index a3ee22aa2d..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_pubsub.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import time -from unittest import TestCase - -import zmq - -from zmq.tests import BaseZMQTestCase, have_gevent, GreenTest - - -class TestPubSub(BaseZMQTestCase): - - pass - - # We are disabling this test while an issue is being resolved. - def test_basic(self): - s1, s2 = self.create_bound_pair(zmq.PUB, zmq.SUB) - s2.setsockopt(zmq.SUBSCRIBE,b'') - time.sleep(0.1) - msg1 = b'message' - s1.send(msg1) - msg2 = s2.recv() # This is blocking! - self.assertEqual(msg1, msg2) - - def test_topic(self): - s1, s2 = self.create_bound_pair(zmq.PUB, zmq.SUB) - s2.setsockopt(zmq.SUBSCRIBE, b'x') - time.sleep(0.1) - msg1 = b'message' - s1.send(msg1) - self.assertRaisesErrno(zmq.EAGAIN, s2.recv, zmq.NOBLOCK) - msg1 = b'xmessage' - s1.send(msg1) - msg2 = s2.recv() - self.assertEqual(msg1, msg2) - -if have_gevent: - class TestPubSubGreen(GreenTest, TestPubSub): - pass diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_reqrep.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_reqrep.py deleted file mode 100644 index de17f2b3f7..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_reqrep.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -from unittest import TestCase - -import zmq -from zmq.tests import BaseZMQTestCase, have_gevent, GreenTest - - -class TestReqRep(BaseZMQTestCase): - - def test_basic(self): - s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP) - - msg1 = b'message 1' - msg2 = self.ping_pong(s1, s2, msg1) - self.assertEqual(msg1, msg2) - - def test_multiple(self): - s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP) - - for i in range(10): - msg1 = i*b' ' - msg2 = self.ping_pong(s1, s2, msg1) - self.assertEqual(msg1, msg2) - - def test_bad_send_recv(self): - s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP) - - if zmq.zmq_version() != '2.1.8': - # this doesn't work on 2.1.8 - for copy in (True,False): - self.assertRaisesErrno(zmq.EFSM, s1.recv, copy=copy) - self.assertRaisesErrno(zmq.EFSM, s2.send, b'asdf', copy=copy) - - # I have to have this or we die on an Abort trap. - msg1 = b'asdf' - msg2 = self.ping_pong(s1, s2, msg1) - self.assertEqual(msg1, msg2) - - def test_json(self): - s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP) - o = dict(a=10,b=list(range(10))) - o2 = self.ping_pong_json(s1, s2, o) - - def test_pyobj(self): - s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP) - o = dict(a=10,b=range(10)) - o2 = self.ping_pong_pyobj(s1, s2, o) - - def test_large_msg(self): - s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP) - msg1 = 10000*b'X' - - for i in range(10): - msg2 = self.ping_pong(s1, s2, msg1) - self.assertEqual(msg1, msg2) - -if have_gevent: - class TestReqRepGreen(GreenTest, TestReqRep): - pass diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_retry_eintr.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_retry_eintr.py deleted file mode 100644 index 337ffbfbd4..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_retry_eintr.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import signal -import time -from threading import Thread - -from pytest import mark - -import zmq -from zmq.tests import ( - BaseZMQTestCase, SkipTest, skip_pypy -) -from zmq.utils.strtypes import b - - -# Partially based on EINTRBaseTest from CPython 3.5 eintr_tester - -class TestEINTRSysCall(BaseZMQTestCase): - """ Base class for EINTR tests. """ - - # delay for initial signal delivery - signal_delay = 0.1 - # timeout for tests. Must be > signal_delay - timeout = .25 - timeout_ms = int(timeout * 1e3) - - @mark.skipif(not hasattr(signal, 'setitimer'), reason='EINTR tests require setitimer') - def alarm(self, t=None): - """start a timer to fire only once - - like signal.alarm, but with better resolution than integer seconds. - """ - if t is None: - t = self.signal_delay - self.timer_fired = False - self.orig_handler = signal.signal(signal.SIGALRM, self.stop_timer) - # signal_period ignored, since only one timer event is allowed to fire - signal.setitimer(signal.ITIMER_REAL, t, 1000) - - def stop_timer(self, *args): - self.timer_fired = True - signal.setitimer(signal.ITIMER_REAL, 0, 0) - signal.signal(signal.SIGALRM, self.orig_handler) - - @mark.skipif(not hasattr(zmq, 'RCVTIMEO'), reason="requires RCVTIMEO") - def test_retry_recv(self): - pull = self.socket(zmq.PULL) - pull.rcvtimeo = self.timeout_ms - self.alarm() - self.assertRaises(zmq.Again, pull.recv) - assert self.timer_fired - - @mark.skipif(not hasattr(zmq, 'SNDTIMEO'), reason="requires SNDTIMEO") - def test_retry_send(self): - push = self.socket(zmq.PUSH) - push.sndtimeo = self.timeout_ms - self.alarm() - self.assertRaises(zmq.Again, push.send, b('buf')) - assert self.timer_fired - - def test_retry_poll(self): - x, y = self.create_bound_pair() - poller = zmq.Poller() - poller.register(x, zmq.POLLIN) - self.alarm() - def send(): - time.sleep(2 * self.signal_delay) - y.send(b('ping')) - t = Thread(target=send) - t.start() - evts = dict(poller.poll(2 * self.timeout_ms)) - t.join() - assert x in evts - assert self.timer_fired - x.recv() - - def test_retry_term(self): - push = self.socket(zmq.PUSH) - push.linger = self.timeout_ms - push.connect('tcp://127.0.0.1:5555') - push.send(b('ping')) - time.sleep(0.1) - self.alarm() - self.context.destroy() - assert self.timer_fired - assert self.context.closed - - def test_retry_getsockopt(self): - raise SkipTest("TODO: find a way to interrupt getsockopt") - - def test_retry_setsockopt(self): - raise SkipTest("TODO: find a way to interrupt setsockopt") diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_security.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_security.py deleted file mode 100644 index 8c90f76bec..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_security.py +++ /dev/null @@ -1,212 +0,0 @@ -"""Test libzmq security (libzmq >= 3.3.0)""" -# -*- coding: utf8 -*- - -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import os -from threading import Thread - -import zmq -from zmq.tests import ( - BaseZMQTestCase, SkipTest, PYPY -) -from zmq.utils import z85 - - -USER = b"admin" -PASS = b"password" - -class TestSecurity(BaseZMQTestCase): - - def setUp(self): - if zmq.zmq_version_info() < (4,0): - raise SkipTest("security is new in libzmq 4.0") - try: - zmq.curve_keypair() - except zmq.ZMQError: - raise SkipTest("security requires libzmq to be built with CURVE support") - super(TestSecurity, self).setUp() - - - def zap_handler(self): - socket = self.context.socket(zmq.REP) - socket.bind("inproc://zeromq.zap.01") - try: - msg = self.recv_multipart(socket) - - version, sequence, domain, address, identity, mechanism = msg[:6] - if mechanism == b'PLAIN': - username, password = msg[6:] - elif mechanism == b'CURVE': - key = msg[6] - - self.assertEqual(version, b"1.0") - self.assertEqual(identity, b"IDENT") - reply = [version, sequence] - if mechanism == b'CURVE' or \ - (mechanism == b'PLAIN' and username == USER and password == PASS) or \ - (mechanism == b'NULL'): - reply.extend([ - b"200", - b"OK", - b"anonymous", - b"\5Hello\0\0\0\5World", - ]) - else: - reply.extend([ - b"400", - b"Invalid username or password", - b"", - b"", - ]) - socket.send_multipart(reply) - finally: - socket.close() - - def start_zap(self): - self.zap_thread = Thread(target=self.zap_handler) - self.zap_thread.start() - - def stop_zap(self): - self.zap_thread.join() - - def bounce(self, server, client, test_metadata=True): - msg = [os.urandom(64), os.urandom(64)] - client.send_multipart(msg) - frames = self.recv_multipart(server, copy=False) - recvd = list(map(lambda x: x.bytes, frames)) - - try: - if test_metadata and not PYPY: - for frame in frames: - self.assertEqual(frame.get('User-Id'), 'anonymous') - self.assertEqual(frame.get('Hello'), 'World') - self.assertEqual(frame['Socket-Type'], 'DEALER') - except zmq.ZMQVersionError: - pass - - self.assertEqual(recvd, msg) - server.send_multipart(recvd) - msg2 = self.recv_multipart(client) - self.assertEqual(msg2, msg) - - def test_null(self): - """test NULL (default) security""" - server = self.socket(zmq.DEALER) - client = self.socket(zmq.DEALER) - self.assertEqual(client.MECHANISM, zmq.NULL) - self.assertEqual(server.mechanism, zmq.NULL) - self.assertEqual(client.plain_server, 0) - self.assertEqual(server.plain_server, 0) - iface = 'tcp://127.0.0.1' - port = server.bind_to_random_port(iface) - client.connect("%s:%i" % (iface, port)) - self.bounce(server, client, False) - - def test_plain(self): - """test PLAIN authentication""" - server = self.socket(zmq.DEALER) - server.identity = b'IDENT' - client = self.socket(zmq.DEALER) - self.assertEqual(client.plain_username, b'') - self.assertEqual(client.plain_password, b'') - client.plain_username = USER - client.plain_password = PASS - self.assertEqual(client.getsockopt(zmq.PLAIN_USERNAME), USER) - self.assertEqual(client.getsockopt(zmq.PLAIN_PASSWORD), PASS) - self.assertEqual(client.plain_server, 0) - self.assertEqual(server.plain_server, 0) - server.plain_server = True - self.assertEqual(server.mechanism, zmq.PLAIN) - self.assertEqual(client.mechanism, zmq.PLAIN) - - assert not client.plain_server - assert server.plain_server - - self.start_zap() - - iface = 'tcp://127.0.0.1' - port = server.bind_to_random_port(iface) - client.connect("%s:%i" % (iface, port)) - self.bounce(server, client) - self.stop_zap() - - def skip_plain_inauth(self): - """test PLAIN failed authentication""" - server = self.socket(zmq.DEALER) - server.identity = b'IDENT' - client = self.socket(zmq.DEALER) - self.sockets.extend([server, client]) - client.plain_username = USER - client.plain_password = b'incorrect' - server.plain_server = True - self.assertEqual(server.mechanism, zmq.PLAIN) - self.assertEqual(client.mechanism, zmq.PLAIN) - - self.start_zap() - - iface = 'tcp://127.0.0.1' - port = server.bind_to_random_port(iface) - client.connect("%s:%i" % (iface, port)) - client.send(b'ping') - server.rcvtimeo = 250 - self.assertRaisesErrno(zmq.EAGAIN, server.recv) - self.stop_zap() - - def test_keypair(self): - """test curve_keypair""" - try: - public, secret = zmq.curve_keypair() - except zmq.ZMQError: - raise SkipTest("CURVE unsupported") - - self.assertEqual(type(secret), bytes) - self.assertEqual(type(public), bytes) - self.assertEqual(len(secret), 40) - self.assertEqual(len(public), 40) - - # verify that it is indeed Z85 - bsecret, bpublic = [ z85.decode(key) for key in (public, secret) ] - self.assertEqual(type(bsecret), bytes) - self.assertEqual(type(bpublic), bytes) - self.assertEqual(len(bsecret), 32) - self.assertEqual(len(bpublic), 32) - - - def test_curve(self): - """test CURVE encryption""" - server = self.socket(zmq.DEALER) - server.identity = b'IDENT' - client = self.socket(zmq.DEALER) - self.sockets.extend([server, client]) - try: - server.curve_server = True - except zmq.ZMQError as e: - # will raise EINVAL if no CURVE support - if e.errno == zmq.EINVAL: - raise SkipTest("CURVE unsupported") - - server_public, server_secret = zmq.curve_keypair() - client_public, client_secret = zmq.curve_keypair() - - server.curve_secretkey = server_secret - server.curve_publickey = server_public - client.curve_serverkey = server_public - client.curve_publickey = client_public - client.curve_secretkey = client_secret - - self.assertEqual(server.mechanism, zmq.CURVE) - self.assertEqual(client.mechanism, zmq.CURVE) - - self.assertEqual(server.get(zmq.CURVE_SERVER), True) - self.assertEqual(client.get(zmq.CURVE_SERVER), False) - - self.start_zap() - - iface = 'tcp://127.0.0.1' - port = server.bind_to_random_port(iface) - client.connect("%s:%i" % (iface, port)) - self.bounce(server, client) - self.stop_zap() - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_socket.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_socket.py deleted file mode 100644 index e5a2732ae6..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_socket.py +++ /dev/null @@ -1,522 +0,0 @@ -# -*- coding: utf8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -import copy -import os -import platform -import time -import warnings -import socket -import sys - -from pytest import mark - -import zmq -from zmq.tests import ( - BaseZMQTestCase, SkipTest, have_gevent, GreenTest, skip_pypy -) -from zmq.utils.strtypes import unicode - -pypy = platform.python_implementation().lower() == 'pypy' -on_travis = bool(os.environ.get('TRAVIS_PYTHON_VERSION')) - -class TestSocket(BaseZMQTestCase): - - def test_create(self): - ctx = self.Context() - s = ctx.socket(zmq.PUB) - # Superluminal protocol not yet implemented - self.assertRaisesErrno(zmq.EPROTONOSUPPORT, s.bind, 'ftl://a') - self.assertRaisesErrno(zmq.EPROTONOSUPPORT, s.connect, 'ftl://a') - self.assertRaisesErrno(zmq.EINVAL, s.bind, 'tcp://') - s.close() - del ctx - - def test_context_manager(self): - url = 'inproc://a' - with self.Context() as ctx: - with ctx.socket(zmq.PUSH) as a: - a.bind(url) - with ctx.socket(zmq.PULL) as b: - b.connect(url) - msg = b'hi' - a.send(msg) - rcvd = self.recv(b) - self.assertEqual(rcvd, msg) - self.assertEqual(b.closed, True) - self.assertEqual(a.closed, True) - self.assertEqual(ctx.closed, True) - - def test_dir(self): - ctx = self.Context() - s = ctx.socket(zmq.PUB) - self.assertTrue('send' in dir(s)) - self.assertTrue('IDENTITY' in dir(s)) - self.assertTrue('AFFINITY' in dir(s)) - self.assertTrue('FD' in dir(s)) - s.close() - ctx.term() - - def test_bind_unicode(self): - s = self.socket(zmq.PUB) - p = s.bind_to_random_port(unicode("tcp://*")) - - def test_connect_unicode(self): - s = self.socket(zmq.PUB) - s.connect(unicode("tcp://127.0.0.1:5555")) - - def test_bind_to_random_port(self): - # Check that bind_to_random_port do not hide useful exception - ctx = self.Context() - c = ctx.socket(zmq.PUB) - # Invalid format - try: - c.bind_to_random_port('tcp:*') - except zmq.ZMQError as e: - self.assertEqual(e.errno, zmq.EINVAL) - # Invalid protocol - try: - c.bind_to_random_port('rand://*') - except zmq.ZMQError as e: - self.assertEqual(e.errno, zmq.EPROTONOSUPPORT) - - def test_identity(self): - s = self.context.socket(zmq.PULL) - self.sockets.append(s) - ident = b'identity\0\0' - s.identity = ident - self.assertEqual(s.get(zmq.IDENTITY), ident) - - def test_unicode_sockopts(self): - """test setting/getting sockopts with unicode strings""" - topic = "tést" - if str is not unicode: - topic = topic.decode('utf8') - p,s = self.create_bound_pair(zmq.PUB, zmq.SUB) - self.assertEqual(s.send_unicode, s.send_unicode) - self.assertEqual(p.recv_unicode, p.recv_unicode) - self.assertRaises(TypeError, s.setsockopt, zmq.SUBSCRIBE, topic) - self.assertRaises(TypeError, s.setsockopt, zmq.IDENTITY, topic) - s.setsockopt_unicode(zmq.IDENTITY, topic, 'utf16') - self.assertRaises(TypeError, s.setsockopt, zmq.AFFINITY, topic) - s.setsockopt_unicode(zmq.SUBSCRIBE, topic) - self.assertRaises(TypeError, s.getsockopt_unicode, zmq.AFFINITY) - self.assertRaisesErrno(zmq.EINVAL, s.getsockopt_unicode, zmq.SUBSCRIBE) - - identb = s.getsockopt(zmq.IDENTITY) - identu = identb.decode('utf16') - identu2 = s.getsockopt_unicode(zmq.IDENTITY, 'utf16') - self.assertEqual(identu, identu2) - time.sleep(0.1) # wait for connection/subscription - p.send_unicode(topic,zmq.SNDMORE) - p.send_unicode(topic*2, encoding='latin-1') - self.assertEqual(topic, s.recv_unicode()) - self.assertEqual(topic*2, s.recv_unicode(encoding='latin-1')) - - def test_int_sockopts(self): - "test integer sockopts" - v = zmq.zmq_version_info() - if v < (3,0): - default_hwm = 0 - else: - default_hwm = 1000 - p,s = self.create_bound_pair(zmq.PUB, zmq.SUB) - p.setsockopt(zmq.LINGER, 0) - self.assertEqual(p.getsockopt(zmq.LINGER), 0) - p.setsockopt(zmq.LINGER, -1) - self.assertEqual(p.getsockopt(zmq.LINGER), -1) - self.assertEqual(p.hwm, default_hwm) - p.hwm = 11 - self.assertEqual(p.hwm, 11) - # p.setsockopt(zmq.EVENTS, zmq.POLLIN) - self.assertEqual(p.getsockopt(zmq.EVENTS), zmq.POLLOUT) - self.assertRaisesErrno(zmq.EINVAL, p.setsockopt,zmq.EVENTS, 2**7-1) - self.assertEqual(p.getsockopt(zmq.TYPE), p.socket_type) - self.assertEqual(p.getsockopt(zmq.TYPE), zmq.PUB) - self.assertEqual(s.getsockopt(zmq.TYPE), s.socket_type) - self.assertEqual(s.getsockopt(zmq.TYPE), zmq.SUB) - - # check for overflow / wrong type: - errors = [] - backref = {} - constants = zmq.constants - for name in constants.__all__: - value = getattr(constants, name) - if isinstance(value, int): - backref[value] = name - for opt in zmq.constants.int_sockopts.union(zmq.constants.int64_sockopts): - sopt = backref[opt] - if sopt.startswith(( - 'ROUTER', 'XPUB', 'TCP', 'FAIL', - 'REQ_', 'CURVE_', 'PROBE_ROUTER', - 'IPC_FILTER', 'GSSAPI', 'STREAM_', - 'VMCI_BUFFER_SIZE', 'VMCI_BUFFER_MIN_SIZE', - 'VMCI_BUFFER_MAX_SIZE', 'VMCI_CONNECT_TIMEOUT', - )): - # some sockopts are write-only - continue - try: - n = p.getsockopt(opt) - except zmq.ZMQError as e: - errors.append("getsockopt(zmq.%s) raised '%s'."%(sopt, e)) - else: - if n > 2**31: - errors.append("getsockopt(zmq.%s) returned a ridiculous value." - " It is probably the wrong type."%sopt) - if errors: - self.fail('\n'.join([''] + errors)) - - def test_bad_sockopts(self): - """Test that appropriate errors are raised on bad socket options""" - s = self.context.socket(zmq.PUB) - self.sockets.append(s) - s.setsockopt(zmq.LINGER, 0) - # unrecognized int sockopts pass through to libzmq, and should raise EINVAL - self.assertRaisesErrno(zmq.EINVAL, s.setsockopt, 9999, 5) - self.assertRaisesErrno(zmq.EINVAL, s.getsockopt, 9999) - # but only int sockopts are allowed through this way, otherwise raise a TypeError - self.assertRaises(TypeError, s.setsockopt, 9999, b"5") - # some sockopts are valid in general, but not on every socket: - self.assertRaisesErrno(zmq.EINVAL, s.setsockopt, zmq.SUBSCRIBE, b'hi') - - def test_sockopt_roundtrip(self): - "test set/getsockopt roundtrip." - p = self.context.socket(zmq.PUB) - self.sockets.append(p) - p.setsockopt(zmq.LINGER, 11) - self.assertEqual(p.getsockopt(zmq.LINGER), 11) - - def test_send_unicode(self): - "test sending unicode objects" - a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - self.sockets.extend([a,b]) - u = "çπ§" - if str is not unicode: - u = u.decode('utf8') - self.assertRaises(TypeError, a.send, u,copy=False) - self.assertRaises(TypeError, a.send, u,copy=True) - a.send_unicode(u) - s = b.recv() - self.assertEqual(s,u.encode('utf8')) - self.assertEqual(s.decode('utf8'),u) - a.send_unicode(u,encoding='utf16') - s = b.recv_unicode(encoding='utf16') - self.assertEqual(s,u) - - def test_send_multipart_check_type(self): - "check type on all frames in send_multipart" - a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR) - self.sockets.extend([a,b]) - self.assertRaises(TypeError, a.send_multipart, [b'a', 5]) - a.send_multipart([b'b']) - rcvd = self.recv_multipart(b) - self.assertEqual(rcvd, [b'b']) - - @skip_pypy - def test_tracker(self): - "test the MessageTracker object for tracking when zmq is done with a buffer" - addr = 'tcp://127.0.0.1' - # get a port: - sock = socket.socket() - sock.bind(('127.0.0.1', 0)) - port = sock.getsockname()[1] - iface = "%s:%i" % (addr, port) - sock.close() - time.sleep(0.1) - - a = self.context.socket(zmq.PUSH) - b = self.context.socket(zmq.PULL) - self.sockets.extend([a,b]) - a.connect(iface) - time.sleep(0.1) - p1 = a.send(b'something', copy=False, track=True) - self.assertTrue(isinstance(p1, zmq.MessageTracker)) - self.assertFalse(p1.done) - p2 = a.send_multipart([b'something', b'else'], copy=False, track=True) - self.assert_(isinstance(p2, zmq.MessageTracker)) - self.assertEqual(p2.done, False) - self.assertEqual(p1.done, False) - - b.bind(iface) - msg = self.recv_multipart(b) - for i in range(10): - if p1.done: - break - time.sleep(0.1) - self.assertEqual(p1.done, True) - self.assertEqual(msg, [b'something']) - msg = self.recv_multipart(b) - for i in range(10): - if p2.done: - break - time.sleep(0.1) - self.assertEqual(p2.done, True) - self.assertEqual(msg, [b'something', b'else']) - m = zmq.Frame(b"again", track=True) - self.assertEqual(m.tracker.done, False) - p1 = a.send(m, copy=False) - p2 = a.send(m, copy=False) - self.assertEqual(m.tracker.done, False) - self.assertEqual(p1.done, False) - self.assertEqual(p2.done, False) - msg = self.recv_multipart(b) - self.assertEqual(m.tracker.done, False) - self.assertEqual(msg, [b'again']) - msg = self.recv_multipart(b) - self.assertEqual(m.tracker.done, False) - self.assertEqual(msg, [b'again']) - self.assertEqual(p1.done, False) - self.assertEqual(p2.done, False) - pm = m.tracker - del m - for i in range(10): - if p1.done: - break - time.sleep(0.1) - self.assertEqual(p1.done, True) - self.assertEqual(p2.done, True) - m = zmq.Frame(b'something', track=False) - self.assertRaises(ValueError, a.send, m, copy=False, track=True) - - def test_close(self): - ctx = self.Context() - s = ctx.socket(zmq.PUB) - s.close() - self.assertRaisesErrno(zmq.ENOTSOCK, s.bind, b'') - self.assertRaisesErrno(zmq.ENOTSOCK, s.connect, b'') - self.assertRaisesErrno(zmq.ENOTSOCK, s.setsockopt, zmq.SUBSCRIBE, b'') - self.assertRaisesErrno(zmq.ENOTSOCK, s.send, b'asdf') - self.assertRaisesErrno(zmq.ENOTSOCK, s.recv) - del ctx - - def test_attr(self): - """set setting/getting sockopts as attributes""" - s = self.context.socket(zmq.DEALER) - self.sockets.append(s) - linger = 10 - s.linger = linger - self.assertEqual(linger, s.linger) - self.assertEqual(linger, s.getsockopt(zmq.LINGER)) - self.assertEqual(s.fd, s.getsockopt(zmq.FD)) - - def test_bad_attr(self): - s = self.context.socket(zmq.DEALER) - self.sockets.append(s) - try: - s.apple='foo' - except AttributeError: - pass - else: - self.fail("bad setattr should have raised AttributeError") - try: - s.apple - except AttributeError: - pass - else: - self.fail("bad getattr should have raised AttributeError") - - def test_subclass(self): - """subclasses can assign attributes""" - class S(zmq.Socket): - a = None - def __init__(self, *a, **kw): - self.a=-1 - super(S, self).__init__(*a, **kw) - - s = S(self.context, zmq.REP) - self.sockets.append(s) - self.assertEqual(s.a, -1) - s.a=1 - self.assertEqual(s.a, 1) - a=s.a - self.assertEqual(a, 1) - - def test_recv_multipart(self): - a,b = self.create_bound_pair() - msg = b'hi' - for i in range(3): - a.send(msg) - time.sleep(0.1) - for i in range(3): - self.assertEqual(self.recv_multipart(b), [msg]) - - def test_close_after_destroy(self): - """s.close() after ctx.destroy() should be fine""" - ctx = self.Context() - s = ctx.socket(zmq.REP) - ctx.destroy() - # reaper is not instantaneous - time.sleep(1e-2) - s.close() - self.assertTrue(s.closed) - - def test_poll(self): - a,b = self.create_bound_pair() - tic = time.time() - evt = a.poll(50) - self.assertEqual(evt, 0) - evt = a.poll(50, zmq.POLLOUT) - self.assertEqual(evt, zmq.POLLOUT) - msg = b'hi' - a.send(msg) - evt = b.poll(50) - self.assertEqual(evt, zmq.POLLIN) - msg2 = self.recv(b) - evt = b.poll(50) - self.assertEqual(evt, 0) - self.assertEqual(msg2, msg) - - def test_ipc_path_max_length(self): - """IPC_PATH_MAX_LEN is a sensible value""" - if zmq.IPC_PATH_MAX_LEN == 0: - raise SkipTest("IPC_PATH_MAX_LEN undefined") - - msg = "Surprising value for IPC_PATH_MAX_LEN: %s" % zmq.IPC_PATH_MAX_LEN - self.assertTrue(zmq.IPC_PATH_MAX_LEN > 30, msg) - self.assertTrue(zmq.IPC_PATH_MAX_LEN < 1025, msg) - - def test_ipc_path_max_length_msg(self): - if zmq.IPC_PATH_MAX_LEN == 0: - raise SkipTest("IPC_PATH_MAX_LEN undefined") - - s = self.context.socket(zmq.PUB) - self.sockets.append(s) - try: - s.bind('ipc://{0}'.format('a' * (zmq.IPC_PATH_MAX_LEN + 1))) - except zmq.ZMQError as e: - self.assertTrue(str(zmq.IPC_PATH_MAX_LEN) in e.strerror) - - def test_hwm(self): - zmq3 = zmq.zmq_version_info()[0] >= 3 - for stype in (zmq.PUB, zmq.ROUTER, zmq.SUB, zmq.REQ, zmq.DEALER): - s = self.context.socket(stype) - s.hwm = 100 - self.assertEqual(s.hwm, 100) - if zmq3: - try: - self.assertEqual(s.sndhwm, 100) - except AttributeError: - pass - try: - self.assertEqual(s.rcvhwm, 100) - except AttributeError: - pass - s.close() - - def test_copy(self): - s = self.socket(zmq.PUB) - scopy = copy.copy(s) - sdcopy = copy.deepcopy(s) - self.assert_(scopy._shadow) - self.assert_(sdcopy._shadow) - self.assertEqual(s.underlying, scopy.underlying) - self.assertEqual(s.underlying, sdcopy.underlying) - s.close() - - def test_shadow(self): - p = self.socket(zmq.PUSH) - p.bind("tcp://127.0.0.1:5555") - p2 = zmq.Socket.shadow(p.underlying) - self.assertEqual(p.underlying, p2.underlying) - s = self.socket(zmq.PULL) - s2 = zmq.Socket.shadow(s.underlying) - self.assertNotEqual(s.underlying, p.underlying) - self.assertEqual(s.underlying, s2.underlying) - s2.connect("tcp://127.0.0.1:5555") - sent = b'hi' - p2.send(sent) - rcvd = self.recv(s2) - self.assertEqual(rcvd, sent) - - def test_shadow_pyczmq(self): - try: - from pyczmq import zctx, zsocket - except Exception: - raise SkipTest("Requires pyczmq") - - ctx = zctx.new() - ca = zsocket.new(ctx, zmq.PUSH) - cb = zsocket.new(ctx, zmq.PULL) - a = zmq.Socket.shadow(ca) - b = zmq.Socket.shadow(cb) - a.bind("inproc://a") - b.connect("inproc://a") - a.send(b'hi') - rcvd = self.recv(b) - self.assertEqual(rcvd, b'hi') - - def test_subscribe_method(self): - pub, sub = self.create_bound_pair(zmq.PUB, zmq.SUB) - sub.subscribe('prefix') - sub.subscribe = 'c' - p = zmq.Poller() - p.register(sub, zmq.POLLIN) - # wait for subscription handshake - for i in range(100): - pub.send(b'canary') - events = p.poll(250) - if events: - break - self.recv(sub) - pub.send(b'prefixmessage') - msg = self.recv(sub) - self.assertEqual(msg, b'prefixmessage') - sub.unsubscribe('prefix') - pub.send(b'prefixmessage') - events = p.poll(1000) - self.assertEqual(events, []) - - # Travis can't handle how much memory PyPy uses on this test - @mark.skipif( - ( - pypy and on_travis - ) or ( - sys.maxsize < 2**32 - ), - reason="only run on 64b and not on Travis." - ) - def test_large_send(self): - try: - buf = os.urandom(1) * (2**31 + 1) - except MemoryError: - raise SkipTest() - a, b = self.create_bound_pair() - a.send(buf, copy=False) - rcvd = b.recv() - assert rcvd == buf - - -if have_gevent: - import gevent - - class TestSocketGreen(GreenTest, TestSocket): - test_bad_attr = GreenTest.skip_green - test_close_after_destroy = GreenTest.skip_green - - def test_timeout(self): - a,b = self.create_bound_pair() - g = gevent.spawn_later(0.5, lambda: a.send(b'hi')) - timeout = gevent.Timeout(0.1) - timeout.start() - self.assertRaises(gevent.Timeout, b.recv) - g.kill() - - @mark.skipif(not hasattr(zmq, 'RCVTIMEO'), reason="requires RCVTIMEO") - def test_warn_set_timeo(self): - s = self.context.socket(zmq.REQ) - with warnings.catch_warnings(record=True) as w: - s.rcvtimeo = 5 - s.close() - self.assertEqual(len(w), 1) - self.assertEqual(w[0].category, UserWarning) - - - @mark.skipif(not hasattr(zmq, 'SNDTIMEO'), reason="requires SNDTIMEO") - def test_warn_get_timeo(self): - s = self.context.socket(zmq.REQ) - with warnings.catch_warnings(record=True) as w: - s.sndtimeo - s.close() - self.assertEqual(len(w), 1) - self.assertEqual(w[0].category, UserWarning) diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_ssh.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_ssh.py deleted file mode 100644 index b282c0065a..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_ssh.py +++ /dev/null @@ -1,8 +0,0 @@ -from zmq.ssh.tunnel import select_random_ports - -def test_random_ports(): - for i in range(4096): - ports = select_random_ports(10) - assert len(ports) == 10 - for p in ports: - assert ports.count(p) == 1 diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_stopwatch.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_stopwatch.py deleted file mode 100644 index 49fb79f258..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_stopwatch.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import sys -import time - -from unittest import TestCase - -from zmq import Stopwatch, ZMQError - -if sys.version_info[0] >= 3: - long = int - -class TestStopWatch(TestCase): - - def test_stop_long(self): - """Ensure stop returns a long int.""" - watch = Stopwatch() - watch.start() - us = watch.stop() - self.assertTrue(isinstance(us, long)) - - def test_stop_microseconds(self): - """Test that stop/sleep have right units.""" - watch = Stopwatch() - watch.start() - tic = time.time() - watch.sleep(1) - us = watch.stop() - toc = time.time() - self.assertAlmostEqual(us/1e6,(toc-tic),places=0) - - def test_double_stop(self): - """Test error raised on multiple calls to stop.""" - watch = Stopwatch() - watch.start() - watch.stop() - self.assertRaises(ZMQError, watch.stop) - self.assertRaises(ZMQError, watch.stop) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_version.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_version.py deleted file mode 100644 index 6ebebf3018..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_version.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -from unittest import TestCase -import zmq -from zmq.sugar import version - - -class TestVersion(TestCase): - - def test_pyzmq_version(self): - vs = zmq.pyzmq_version() - vs2 = zmq.__version__ - self.assertTrue(isinstance(vs, str)) - if zmq.__revision__: - self.assertEqual(vs, '@'.join(vs2, zmq.__revision__)) - else: - self.assertEqual(vs, vs2) - if version.VERSION_EXTRA: - self.assertTrue(version.VERSION_EXTRA in vs) - self.assertTrue(version.VERSION_EXTRA in vs2) - - def test_pyzmq_version_info(self): - info = zmq.pyzmq_version_info() - self.assertTrue(isinstance(info, tuple)) - for n in info[:3]: - self.assertTrue(isinstance(n, int)) - if version.VERSION_EXTRA: - self.assertEqual(len(info), 4) - self.assertEqual(info[-1], float('inf')) - else: - self.assertEqual(len(info), 3) - - def test_zmq_version_info(self): - info = zmq.zmq_version_info() - self.assertTrue(isinstance(info, tuple)) - for n in info[:3]: - self.assertTrue(isinstance(n, int)) - - def test_zmq_version(self): - v = zmq.zmq_version() - self.assertTrue(isinstance(v, str)) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_win32_shim.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_win32_shim.py deleted file mode 100644 index b1be15e0a5..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_win32_shim.py +++ /dev/null @@ -1,61 +0,0 @@ -from __future__ import print_function - -import os - -from functools import wraps -from zmq.tests import BaseZMQTestCase -from zmq.utils.win32 import allow_interrupt - - -def count_calls(f): - @wraps(f) - def _(*args, **kwds): - try: - return f(*args, **kwds) - finally: - _.__calls__ += 1 - _.__calls__ = 0 - return _ - - -class TestWindowsConsoleControlHandler(BaseZMQTestCase): - - def test_handler(self): - @count_calls - def interrupt_polling(): - print('Caught CTRL-C!') - - if os.name == 'nt': - """from ctypes import windll - from ctypes.wintypes import BOOL, DWORD - - kernel32 = windll.LoadLibrary('kernel32') - - # - GenerateConsoleCtrlEvent = kernel32.GenerateConsoleCtrlEvent - GenerateConsoleCtrlEvent.argtypes = (DWORD, DWORD) - GenerateConsoleCtrlEvent.restype = BOOL - - try: - # Simulate CTRL-C event while handler is active. - with allow_interrupt(interrupt_polling): - result = GenerateConsoleCtrlEvent(0, 0) - if result == 0: - raise WindowsError - except KeyboardInterrupt: - print("WE ARE HERE NOA") - pass - else: - self.fail('Expecting `KeyboardInterrupt` exception!') - - # Make sure our handler was called. - self.assertEqual(interrupt_polling.__calls__, 1)""" - # Skip test; calling Ctrl-C from a subprocess prompts the user with the following: - # "Terminate batch file (y/n): - # This test breaks the testing mechanism if pytests is called from a subprocess. - self.assertEqual("Oh Windows...", "Oh Windows...") - else: - # On non-Windows systems, this utility is just a no-op! - with allow_interrupt(interrupt_polling): - pass - self.assertEqual(interrupt_polling.__calls__, 0) diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_z85.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_z85.py deleted file mode 100644 index 8a73cb4d25..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_z85.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf8 -*- -"""Test Z85 encoding - -confirm values and roundtrip with test values from the reference implementation. -""" - -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - -from unittest import TestCase -from zmq.utils import z85 - - -class TestZ85(TestCase): - - def test_client_public(self): - client_public = \ - b"\xBB\x88\x47\x1D\x65\xE2\x65\x9B" \ - b"\x30\xC5\x5A\x53\x21\xCE\xBB\x5A" \ - b"\xAB\x2B\x70\xA3\x98\x64\x5C\x26" \ - b"\xDC\xA2\xB2\xFC\xB4\x3F\xC5\x18" - encoded = z85.encode(client_public) - - self.assertEqual(encoded, b"Yne@$w-vo}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7") - decoded = z85.decode(encoded) - self.assertEqual(decoded, server_public) - - def test_server_secret(self): - server_secret = \ - b"\x8E\x0B\xDD\x69\x76\x28\xB9\x1D" \ - b"\x8F\x24\x55\x87\xEE\x95\xC5\xB0" \ - b"\x4D\x48\x96\x3F\x79\x25\x98\x77" \ - b"\xB4\x9C\xD9\x06\x3A\xEA\xD3\xB7" - encoded = z85.encode(server_secret) - - self.assertEqual(encoded, b"JTKVSB%%)wK0E.X)V>+}o?pNmC{O&4W4b!Ni{Lh6") - decoded = z85.decode(encoded) - self.assertEqual(decoded, server_secret) - diff --git a/pyzmq/pyzmq-15.4.0/zmq/tests/test_zmqstream.py b/pyzmq/pyzmq-15.4.0/zmq/tests/test_zmqstream.py deleted file mode 100644 index cdb3a17124..0000000000 --- a/pyzmq/pyzmq-15.4.0/zmq/tests/test_zmqstream.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf8 -*- -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Modified BSD License. - - -import sys -import time - -from unittest import TestCase - -import zmq -from zmq.eventloop import ioloop, zmqstream - -class TestZMQStream(TestCase): - - def setUp(self): - self.context = zmq.Context() - self.socket = self.context.socket(zmq.REP) - self.loop = ioloop.IOLoop.instance() - self.stream = zmqstream.ZMQStream(self.socket) - - def tearDown(self): - self.socket.close() - self.context.term() - - def test_callable_check(self): - """Ensure callable check works (py3k).""" - - self.stream.on_send(lambda *args: None) - self.stream.on_recv(lambda *args: None) - self.assertRaises(AssertionError, self.stream.on_recv, 1) - self.assertRaises(AssertionError, self.stream.on_send, 1) - self.assertRaises(AssertionError, self.stream.on_recv, zmq) - diff --git a/xz/xz-5.2.2/tests/Makefile.am b/xz/xz-5.2.2/tests/Makefile.am deleted file mode 100644 index 86084e17c2..0000000000 --- a/xz/xz-5.2.2/tests/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -EXTRA_DIST = \ - files \ - tests.h \ - test_files.sh \ - test_compress.sh \ - test_scripts.sh \ - bcj_test.c \ - compress_prepared_bcj_sparc \ - compress_prepared_bcj_x86 \ - xzgrep_expected_output - -AM_CPPFLAGS = \ - -I$(top_srcdir)/src/common \ - -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib - -LDADD = $(top_builddir)/src/liblzma/liblzma.la - -if COND_GNULIB -LDADD += $(top_builddir)/lib/libgnu.a -endif - -LDADD += $(LTLIBINTL) - -check_PROGRAMS = \ - create_compress_files \ - test_check \ - test_stream_flags \ - test_filter_flags \ - test_block_header \ - test_index \ - test_bcj_exact_size - -TESTS = \ - test_check \ - test_stream_flags \ - test_filter_flags \ - test_block_header \ - test_index \ - test_bcj_exact_size \ - test_files.sh \ - test_compress.sh - -if COND_SCRIPTS -TESTS += test_scripts.sh -endif - -clean-local: - -rm -f compress_generated_* \ - xzgrep_test_output xzgrep_test_1.xz xzgrep_test_2.xz diff --git a/xz/xz-5.2.2/tests/Makefile.in b/xz/xz-5.2.2/tests/Makefile.in deleted file mode 100644 index efacda9351..0000000000 --- a/xz/xz-5.2.2/tests/Makefile.in +++ /dev/null @@ -1,845 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@COND_GNULIB_TRUE@am__append_1 = $(top_builddir)/lib/libgnu.a -check_PROGRAMS = create_compress_files$(EXEEXT) test_check$(EXEEXT) \ - test_stream_flags$(EXEEXT) test_filter_flags$(EXEEXT) \ - test_block_header$(EXEEXT) test_index$(EXEEXT) \ - test_bcj_exact_size$(EXEEXT) -TESTS = test_check$(EXEEXT) test_stream_flags$(EXEEXT) \ - test_filter_flags$(EXEEXT) test_block_header$(EXEEXT) \ - test_index$(EXEEXT) test_bcj_exact_size$(EXEEXT) test_files.sh \ - test_compress.sh $(am__append_2) -@COND_SCRIPTS_TRUE@am__append_2 = test_scripts.sh -subdir = tests -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/posix-shell.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/tuklib_common.m4 \ - $(top_srcdir)/m4/tuklib_cpucores.m4 \ - $(top_srcdir)/m4/tuklib_integer.m4 \ - $(top_srcdir)/m4/tuklib_mbstr.m4 \ - $(top_srcdir)/m4/tuklib_physmem.m4 \ - $(top_srcdir)/m4/tuklib_progname.m4 \ - $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -create_compress_files_SOURCES = create_compress_files.c -create_compress_files_OBJECTS = create_compress_files.$(OBJEXT) -create_compress_files_LDADD = $(LDADD) -am__DEPENDENCIES_1 = -create_compress_files_DEPENDENCIES = \ - $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \ - $(am__DEPENDENCIES_1) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -test_bcj_exact_size_SOURCES = test_bcj_exact_size.c -test_bcj_exact_size_OBJECTS = test_bcj_exact_size.$(OBJEXT) -test_bcj_exact_size_LDADD = $(LDADD) -test_bcj_exact_size_DEPENDENCIES = \ - $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \ - $(am__DEPENDENCIES_1) -test_block_header_SOURCES = test_block_header.c -test_block_header_OBJECTS = test_block_header.$(OBJEXT) -test_block_header_LDADD = $(LDADD) -test_block_header_DEPENDENCIES = \ - $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \ - $(am__DEPENDENCIES_1) -test_check_SOURCES = test_check.c -test_check_OBJECTS = test_check.$(OBJEXT) -test_check_LDADD = $(LDADD) -test_check_DEPENDENCIES = $(top_builddir)/src/liblzma/liblzma.la \ - $(am__append_1) $(am__DEPENDENCIES_1) -test_filter_flags_SOURCES = test_filter_flags.c -test_filter_flags_OBJECTS = test_filter_flags.$(OBJEXT) -test_filter_flags_LDADD = $(LDADD) -test_filter_flags_DEPENDENCIES = \ - $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \ - $(am__DEPENDENCIES_1) -test_index_SOURCES = test_index.c -test_index_OBJECTS = test_index.$(OBJEXT) -test_index_LDADD = $(LDADD) -test_index_DEPENDENCIES = $(top_builddir)/src/liblzma/liblzma.la \ - $(am__append_1) $(am__DEPENDENCIES_1) -test_stream_flags_SOURCES = test_stream_flags.c -test_stream_flags_OBJECTS = test_stream_flags.$(OBJEXT) -test_stream_flags_LDADD = $(LDADD) -test_stream_flags_DEPENDENCIES = \ - $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \ - $(am__DEPENDENCIES_1) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = create_compress_files.c test_bcj_exact_size.c \ - test_block_header.c test_check.c test_filter_flags.c \ - test_index.c test_stream_flags.c -DIST_SOURCES = create_compress_files.c test_bcj_exact_size.c \ - test_block_header.c test_check.c test_filter_flags.c \ - test_index.c test_stream_flags.c -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_CFLAGS = @AM_CFLAGS@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETOPT_H = @GETOPT_H@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GREP = @GREP@ -HAVE_VISIBILITY = @HAVE_VISIBILITY@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_EXEEXT = @LN_EXEEXT@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSIX_SHELL = @POSIX_SHELL@ -POSUB = @POSUB@ -PREFERABLY_POSIX_SHELL = @PREFERABLY_POSIX_SHELL@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -RC = @RC@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -xz = @xz@ -EXTRA_DIST = \ - files \ - tests.h \ - test_files.sh \ - test_compress.sh \ - test_scripts.sh \ - bcj_test.c \ - compress_prepared_bcj_sparc \ - compress_prepared_bcj_x86 \ - xzgrep_expected_output - -AM_CPPFLAGS = \ - -I$(top_srcdir)/src/common \ - -I$(top_srcdir)/src/liblzma/api \ - -I$(top_builddir)/lib - -LDADD = $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \ - $(LTLIBINTL) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign tests/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -create_compress_files$(EXEEXT): $(create_compress_files_OBJECTS) $(create_compress_files_DEPENDENCIES) $(EXTRA_create_compress_files_DEPENDENCIES) - @rm -f create_compress_files$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(create_compress_files_OBJECTS) $(create_compress_files_LDADD) $(LIBS) - -test_bcj_exact_size$(EXEEXT): $(test_bcj_exact_size_OBJECTS) $(test_bcj_exact_size_DEPENDENCIES) $(EXTRA_test_bcj_exact_size_DEPENDENCIES) - @rm -f test_bcj_exact_size$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_bcj_exact_size_OBJECTS) $(test_bcj_exact_size_LDADD) $(LIBS) - -test_block_header$(EXEEXT): $(test_block_header_OBJECTS) $(test_block_header_DEPENDENCIES) $(EXTRA_test_block_header_DEPENDENCIES) - @rm -f test_block_header$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_block_header_OBJECTS) $(test_block_header_LDADD) $(LIBS) - -test_check$(EXEEXT): $(test_check_OBJECTS) $(test_check_DEPENDENCIES) $(EXTRA_test_check_DEPENDENCIES) - @rm -f test_check$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_check_OBJECTS) $(test_check_LDADD) $(LIBS) - -test_filter_flags$(EXEEXT): $(test_filter_flags_OBJECTS) $(test_filter_flags_DEPENDENCIES) $(EXTRA_test_filter_flags_DEPENDENCIES) - @rm -f test_filter_flags$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_filter_flags_OBJECTS) $(test_filter_flags_LDADD) $(LIBS) - -test_index$(EXEEXT): $(test_index_OBJECTS) $(test_index_DEPENDENCIES) $(EXTRA_test_index_DEPENDENCIES) - @rm -f test_index$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_index_OBJECTS) $(test_index_LDADD) $(LIBS) - -test_stream_flags$(EXEEXT): $(test_stream_flags_OBJECTS) $(test_stream_flags_DEPENDENCIES) $(EXTRA_test_stream_flags_DEPENDENCIES) - @rm -f test_stream_flags$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_stream_flags_OBJECTS) $(test_stream_flags_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create_compress_files.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bcj_exact_size.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_block_header.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_check.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_filter_flags.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_index.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_flags.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ - else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -clean-local: - -rm -f compress_generated_* \ - xzgrep_test_output xzgrep_test_1.xz xzgrep_test_2.xz - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/xz/xz-5.2.2/tests/bcj_test.c b/xz/xz-5.2.2/tests/bcj_test.c deleted file mode 100644 index 05de38a28a..0000000000 --- a/xz/xz-5.2.2/tests/bcj_test.c +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file bcj_test.c -/// \brief Source code of compress_prepared_bcj_* -/// -/// This is a simple program that should make the compiler to generate -/// PC-relative branches, jumps, and calls. The compiled files can then -/// be used to test the branch conversion filters. Note that this program -/// itself does nothing useful. -/// -/// Compiling: gcc -std=c99 -fPIC -c bcj_test.c -/// Don't optimize or strip. -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -extern int jump(int a, int b); - - -extern int -call(int a, int b) -{ - if (a < b) - a = jump(a, b); - - return a; -} - - -extern int -jump(int a, int b) -{ - // The loop generates conditional jump backwards. - while (1) { - if (a < b) { - a *= 2; - a += 3 * b; - break; - } else { - // Put enough code here to prevent JMP SHORT on x86. - a += b; - a /= 2; - b += b % 5; - a -= b / 3; - b = 2 * b + a - 1; - a *= b + a + 1; - b += a - 1; - a += b * 2 - a / 5; - } - } - - return a; -} - - -int -main(int argc, char **argv) -{ - int a = call(argc, argc + 1); - return a == 0; -} diff --git a/xz/xz-5.2.2/tests/compress_prepared_bcj_sparc b/xz/xz-5.2.2/tests/compress_prepared_bcj_sparc deleted file mode 100644 index 86ea7ddb11b7505373d86b6fbf17c88e4eb88a30..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1240 zcma)6&ui0g6n|MdTXd5sV<;XLL0QLamaP@%JXmRUIfw`%co;Nk474L@OOg&ftxGQ+ z%Z>#hpnrh)4|Me6#e;bCBzW=A!}K4h?|t+AmReBu;N|;%ect=@eUlzOeEdk7lVBne z%%MFMkWW~yz@Ax1V@?ZdLFk886|~TK6{7#zW1fimj%)Fh-Sj-C5fb|Ck3sKrH7@^N zjg4>VxI9e9M(15oTJAuG27bZVSBw?WCO=XjGsJqVD}PWxI{NfIbM*7SeJ&D?>LVyh zgvB`q_E{t!b&=*qa*|Uz@PO(C7ZE4Fd(T|y>gEc?y4xn}g?)`4@;Fx1`6A*7+b51R z1AF5aOFH;WZoTrmjA_+&Yg5nV zD}`Luw;FbB9U~RLWrejh&hM-T?H^Y?5&EKUPrT%HCiem=)t(~<1ves%5|ces+@|}X z{|Zt%Uf`pLN_mY<42 z>9OSI|Dh+(NfT=EAj!pZ4+<^h5G81kLY&#`Gb<=MFgstrH#2W`c3-gAj3h}!kVItC zwFrs$I+2JYMu|%LoOmzT8vi_R)rXEx+wJztG6HR;+-BIBT9%oOCKWG=*17$0Jg;*1|M#^&M-hWHK3> zHNKzJe(=LmYlMFcAMkw3X06hZPi8ItKD^JhmK|?Nan;VNJYR=Xi<+k4DWlG7Hml>g z4{)v##3d}bMK0zXO6C9}bxZlh^7@`(p1#Z!!qyInz&;Sx9&QA1(e#9B5 zxFm2W-I7jZ2#Owob`}`tg*^mZ-J7oofm!ei68VHJq}T5!U)sWtQvR(n+TI(Z4KK+< zGQmGbmt^M+cx|x-9UuOUR5v^hauDiycWThrOGdlLoqOH^8?oP9{4_`kmtd|(SWU)MQMbo0*ws3;M$3RE+6lJ#TCiBe9lsI`_fyorApnFl_9@ T56w - - -// Avoid re-creating the test files every time the tests are run. -#define create_test(name) \ -do { \ - if (!file_exists("compress_generated_" #name)) { \ - FILE *file = file_create("compress_generated_" #name); \ - write_ ## name(file); \ - file_finish(file, "compress_generated_" #name); \ - } \ -} while (0) - - -static bool -file_exists(const char *filename) -{ - // Trying to be somewhat portable by avoiding stat(). - FILE *file = fopen(filename, "rb"); - bool ret; - - if (file != NULL) { - fclose(file); - ret = true; - } else { - ret = false; - } - - return ret; -} - - -static FILE * -file_create(const char *filename) -{ - FILE *file = fopen(filename, "wb"); - - if (file == NULL) { - perror(filename); - exit(1); - } - - return file; -} - - -static void -file_finish(FILE *file, const char *filename) -{ - const bool ferror_fail = ferror(file); - const bool fclose_fail = fclose(file); - - if (ferror_fail || fclose_fail) { - perror(filename); - exit(1); - } -} - - -// File that repeats "abc\n" a few thousand times. This is targeted -// especially at Subblock filter's run-length encoder. -static void -write_abc(FILE *file) -{ - for (size_t i = 0; i < 12345; ++i) - if (fwrite("abc\n", 4, 1, file) != 1) - exit(1); -} - - -// File that doesn't compress. We always use the same random seed to -// generate identical files on all systems. -static void -write_random(FILE *file) -{ - uint32_t n = 5; - - for (size_t i = 0; i < 123456; ++i) { - n = 101771 * n + 71777; - - putc(n & 0xFF, file); - putc((n >> 8) & 0xFF, file); - putc((n >> 16) & 0xFF, file); - putc(n >> 24, file); - } -} - - -// Text file -static void -write_text(FILE *file) -{ - static const char *lorem[] = { - "Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", - "adipisicing", "elit,", "sed", "do", "eiusmod", "tempor", - "incididunt", "ut", "labore", "et", "dolore", "magna", - "aliqua.", "Ut", "enim", "ad", "minim", "veniam,", "quis", - "nostrud", "exercitation", "ullamco", "laboris", "nisi", - "ut", "aliquip", "ex", "ea", "commodo", "consequat.", - "Duis", "aute", "irure", "dolor", "in", "reprehenderit", - "in", "voluptate", "velit", "esse", "cillum", "dolore", - "eu", "fugiat", "nulla", "pariatur.", "Excepteur", "sint", - "occaecat", "cupidatat", "non", "proident,", "sunt", "in", - "culpa", "qui", "officia", "deserunt", "mollit", "anim", - "id", "est", "laborum." - }; - - // Let the first paragraph be the original text. - for (size_t w = 0; w < ARRAY_SIZE(lorem); ++w) { - fprintf(file, "%s ", lorem[w]); - - if (w % 7 == 6) - fprintf(file, "\n"); - } - - // The rest shall be (hopefully) meaningless combinations of - // the same words. - uint32_t n = 29; - - for (size_t p = 0; p < 500; ++p) { - fprintf(file, "\n\n"); - - for (size_t w = 0; w < ARRAY_SIZE(lorem); ++w) { - n = 101771 * n + 71777; - - fprintf(file, "%s ", lorem[n % ARRAY_SIZE(lorem)]); - - if (w % 7 == 6) - fprintf(file, "\n"); - } - } -} - - -int -main(void) -{ - create_test(abc); - create_test(random); - create_test(text); - return 0; -} diff --git a/xz/xz-5.2.2/tests/files/README b/xz/xz-5.2.2/tests/files/README deleted file mode 100644 index 53950edb49..0000000000 --- a/xz/xz-5.2.2/tests/files/README +++ /dev/null @@ -1,240 +0,0 @@ - -.xz Test Files ----------------- - -0. Introduction - - This directory contains bunch of files to test handling of .xz files - in .xz decoder implementations. Many of the files have been created - by hand with a hex editor, thus there is no better "source code" than - the files themselves. All the test files (*.xz) and this README have - been put into the public domain. - - -1. File Types - - Good files (good-*.xz) must decode successfully without requiring - a lot of CPU time or RAM. - - Unsupported files (unsupported-*.xz) are good files, but headers - indicate features not supported by the current file format - specification. - - Bad files (bad-*.xz) must cause the decoder to give an error. Like - with the good files, these files must not require a lot of CPU time - or RAM before they get detected to be broken. - - -2. Descriptions of Individual Files - -2.1. Good Files - - good-0-empty.xz has one Stream with no Blocks. - - good-0pad-empty.xz has one Stream with no Blocks followed by - four-byte Stream Padding. - - good-0cat-empty.xz has two zero-Block Streams concatenated without - Stream Padding. - - good-0catpad-empty.xz has two zero-Block Streams concatenated with - four-byte Stream Padding between the Streams. - - good-1-check-none.xz has one Stream with one Block with two - uncompressed LZMA2 chunks and no integrity check. - - good-1-check-crc32.xz has one Stream with one Block with two - uncompressed LZMA2 chunks and CRC32 check. - - good-1-check-crc64.xz is like good-1-check-crc32.xz but with CRC64. - - good-1-check-sha256.xz is like good-1-check-crc32.xz but with - SHA256. - - good-2-lzma2.xz has one Stream with two Blocks with one uncompressed - LZMA2 chunk in each Block. - - good-1-block_header-1.xz has both Compressed Size and Uncompressed - Size in the Block Header. This has also four extra bytes of Header - Padding. - - good-1-block_header-2.xz has known Compressed Size. - - good-1-block_header-3.xz has known Uncompressed Size. - - good-1-delta-lzma2.tiff.xz is an image file that compresses - better with Delta+LZMA2 than with plain LZMA2. - - good-1-x86-lzma2.xz uses the x86 filter (BCJ) and LZMA2. The - uncompressed file is compress_prepared_bcj_x86 found from the tests - directory. - - good-1-sparc-lzma2.xz uses the SPARC filter and LZMA. The - uncompressed file is compress_prepared_bcj_sparc found from the tests - directory. - - good-1-lzma2-1.xz has two LZMA2 chunks, of which the second sets - new properties. - - good-1-lzma2-2.xz has two LZMA2 chunks, of which the second resets - the state without specifying new properties. - - good-1-lzma2-3.xz has two LZMA2 chunks, of which the first is - uncompressed and the second is LZMA. The first chunk resets dictionary - and the second sets new properties. - - good-1-lzma2-4.xz has three LZMA2 chunks: First is LZMA, second is - uncompressed with dictionary reset, and third is LZMA with new - properties but without dictionary reset. - - good-1-lzma2-5.xz has an empty LZMA2 stream with only the end of - payload marker. XZ Utils 5.0.1 and older incorrectly see this file - as corrupt. - - good-1-3delta-lzma2.xz has three Delta filters and LZMA2. - - -2.2. Unsupported Files - - unsupported-check.xz uses Check ID 0x02 which isn't supported by - the current version of the file format. It is implementation-defined - how this file handled (it may reject it, or decode it possibly with - a warning). - - unsupported-block_header.xz has a non-null byte in Header Padding, - which may indicate presence of a new unsupported field. - - unsupported-filter_flags-1.xz has unsupported Filter ID 0x7F. - - unsupported-filter_flags-2.xz specifies only Delta filter in the - List of Filter Flags, but Delta isn't allowed as the last filter in - the chain. It could be a little more correct to detect this file as - corrupt instead of unsupported, but saying it is unsupported is - simpler in case of liblzma. - - unsupported-filter_flags-3.xz specifies two LZMA2 filters in the - List of Filter Flags. LZMA2 is allowed only as the last filter in the - chain. It could be a little more correct to detect this file as - corrupt instead of unsupported, but saying it is unsupported is - simpler in case of liblzma. - - -2.3. Bad Files - - bad-0pad-empty.xz has one Stream with no Blocks followed by - five-byte Stream Padding. Stream Padding must be a multiple of four - bytes, thus this file is corrupt. - - bad-0catpad-empty.xz has two zero-Block Streams concatenated with - five-byte Stream Padding between the Streams. - - bad-0cat-alone.xz is good-0-empty.xz concatenated with an empty - LZMA_Alone file. - - bad-0cat-header_magic.xz is good-0cat-empty.xz but with one byte - wrong in the Header Magic Bytes field of the second Stream. liblzma - gives LZMA_DATA_ERROR for this. (LZMA_FORMAT_ERROR is used only if - the first Stream of a file has invalid Header Magic Bytes.) - - bad-0-header_magic.xz is good-0-empty.xz but with one byte wrong - in the Header Magic Bytes field. liblzma gives LZMA_FORMAT_ERROR for - this. - - bad-0-footer_magic.xz is good-0-empty.xz but with one byte wrong - in the Footer Magic Bytes field. liblzma gives LZMA_DATA_ERROR for - this. - - bad-0-empty-truncated.xz is good-0-empty.xz without the last byte - of the file. - - bad-0-nonempty_index.xz has no Blocks but Index claims that there is - one Block. - - bad-0-backward_size.xz has wrong Backward Size in Stream Footer. - - bad-1-stream_flags-1.xz has different Stream Flags in Stream Header - and Stream Footer. - - bad-1-stream_flags-2.xz has wrong CRC32 in Stream Header. - - bad-1-stream_flags-3.xz has wrong CRC32 in Stream Footer. - - bad-1-vli-1.xz has two-byte variable-length integer in the - Uncompressed Size field in Block Header while one-byte would be enough - for that value. It's important that the file gets rejected due to too - big integer encoding instead of due to Uncompressed Size not matching - the value stored in the Block Header. That is, the decoder must not - try to decode the Compressed Data field. - - bad-1-vli-2.xz has ten-byte variable-length integer as Uncompressed - Size in Block Header. It's important that the file gets rejected due - to too big integer encoding instead of due to Uncompressed Size not - matching the value stored in the Block Header. That is, the decoder - must not try to decode the Compressed Data field. - - bad-1-block_header-1.xz has Block Header that ends in the middle of - the Filter Flags field. - - bad-1-block_header-2.xz has Block Header that has Compressed Size and - Uncompressed Size but no List of Filter Flags field. - - bad-1-block_header-3.xz has wrong CRC32 in Block Header. - - bad-1-block_header-4.xz has too big Compressed Size in Block Header - (2^63 - 1 bytes while maximum is a little less, because the whole - Block must stay smaller than 2^63). It's important that the file - gets rejected due to invalid Compressed Size value; the decoder - must not try decoding the Compressed Data field. - - bad-1-block_header-5.xz has zero as Compressed Size in Block Header. - - bad-1-block_header-6.xz has corrupt Block Header which may crash - xz -lvv in XZ Utils 5.0.3 and earlier. It was fixed in the commit - c0297445064951807803457dca1611b3c47e7f0f. - - bad-2-index-1.xz has wrong Unpadded Sizes in Index. - - bad-2-index-2.xz has wrong Uncompressed Sizes in Index. - - bad-2-index-3.xz has non-null byte in Index Padding. - - bad-2-index-4.xz wrong CRC32 in Index. - - bad-2-index-5.xz has zero as Unpadded Size. It is important that the - file gets rejected specifically due to Unpadded Size having an invalid - value. - - bad-2-compressed_data_padding.xz has non-null byte in the padding of - the Compressed Data field of the first Block. - - bad-1-check-crc32.xz has wrong Check (CRC32). - - bad-1-check-crc64.xz has wrong Check (CRC64). - - bad-1-check-sha256.xz has wrong Check (SHA-256). - - bad-1-lzma2-1.xz has LZMA2 stream whose first chunk (uncompressed) - doesn't reset the dictionary. - - bad-1-lzma2-2.xz has two LZMA2 chunks, of which the second chunk - indicates dictionary reset, but the LZMA compressed data tries to - repeat data from the previous chunk. - - bad-1-lzma2-3.xz sets new invalid properties (lc=8, lp=0, pb=0) in - the middle of Block. - - bad-1-lzma2-4.xz has two LZMA2 chunks, of which the first is - uncompressed and the second is LZMA. The first chunk resets dictionary - as it should, but the second chunk tries to reset state without - specifying properties for LZMA. - - bad-1-lzma2-5.xz is like bad-1-lzma2-4.xz but doesn't try to reset - anything in the header of the second chunk. - - bad-1-lzma2-6.xz has reserved LZMA2 control byte value (0x03). - - bad-1-lzma2-7.xz has EOPM at LZMA level. - - bad-1-lzma2-8.xz is like good-1-lzma2-4.xz but doesn't set new - properties in the third LZMA2 chunk. - diff --git a/xz/xz-5.2.2/tests/files/bad-0-backward_size.xz b/xz/xz-5.2.2/tests/files/bad-0-backward_size.xz deleted file mode 100644 index 2b46fa937b3e6e770f12973398f01d124f9220f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 kcmexsUKJ6=z`&TPbkB?d2xRWND4I?@dJM#7V2q3c0GX-?W&i*H diff --git a/xz/xz-5.2.2/tests/files/bad-0-empty-truncated.xz b/xz/xz-5.2.2/tests/files/bad-0-empty-truncated.xz deleted file mode 100644 index f879af84ac473517a186f80510091273d9ea9676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 jcmexsUKJ6=z`&TPbkB?d2xRWNC{A#i$;$}hFh&9ZipmEx diff --git a/xz/xz-5.2.2/tests/files/bad-0-footer_magic.xz b/xz/xz-5.2.2/tests/files/bad-0-footer_magic.xz deleted file mode 100644 index 5d9e3894bc2d112e987aee4788bde03f26ef98b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 kcmexsUKJ6=z`&TPbkB?d2xRWNC{A#i$;$}hFh)iI0FqV*i~s-t diff --git a/xz/xz-5.2.2/tests/files/bad-0-header_magic.xz b/xz/xz-5.2.2/tests/files/bad-0-header_magic.xz deleted file mode 100644 index 5984a453bf873ee0cbadc55efa71f26f0fa3da24..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 kcmexsUKJ6^z`&TPbkB?d2xRWNC{A#i$;$}hFh)iJ0FpchjQ{`u diff --git a/xz/xz-5.2.2/tests/files/bad-0-nonempty_index.xz b/xz/xz-5.2.2/tests/files/bad-0-nonempty_index.xz deleted file mode 100644 index ed6e81fa0465f28bd06c400814c08d88e28d16b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 lcmexsUKJ6=z`&TPbkB@|k%2*bYn#FZr$N&V4kx>8{+z+q- diff --git a/xz/xz-5.2.2/tests/files/bad-1-block_header-2.xz b/xz/xz-5.2.2/tests/files/bad-1-block_header-2.xz deleted file mode 100644 index ae42ecf0f9be468d902c4d8aecef27b541169b7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 64 zcmexsUKJ6=z`&TPbkB_O01I!!^e!Pr23C*MoSb|vCI+_f{Gyx`MJ@*C#fwB47*%); SH14mT;53t$kpT!8BclLH;1H(( diff --git a/xz/xz-5.2.2/tests/files/bad-1-block_header-3.xz b/xz/xz-5.2.2/tests/files/bad-1-block_header-3.xz deleted file mode 100644 index 606cbd20e25534d911005f29c6842963f81810e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^nS1FJ`BPEI}-69Zd#eo;<}A{T@6;zgni Xj4Hea8u!;vaGJ@>2vp0!7#RfsB{>g^ diff --git a/xz/xz-5.2.2/tests/files/bad-1-block_header-4.xz b/xz/xz-5.2.2/tests/files/bad-1-block_header-4.xz deleted file mode 100644 index e72dfbfc39468dee45f7c6b3981a072d56241f82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 76 zcmexsUKJ6=z`&TPbkB^%;Xf4AD>8C0FeE>+Dqv*b@kq_d$>$2sFUm<#UL?xE VsLER?d1TuJr2vp0!7#RfsAA}ET diff --git a/xz/xz-5.2.2/tests/files/bad-1-check-crc64.xz b/xz/xz-5.2.2/tests/files/bad-1-check-crc64.xz deleted file mode 100644 index cdb77093db1c301b8978b5b2b79ad9d4093ae3fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72 zcmexsUKJ6=z`*kC+7>q^21P~=1_p*3{K~?N46GihIXU@UObl${`9(P?id+ou^*RLS b+D|*pz^K7%lb*#azwL7^BTzj9OJo!P#6=R> diff --git a/xz/xz-5.2.2/tests/files/bad-1-check-sha256.xz b/xz/xz-5.2.2/tests/files/bad-1-check-sha256.xz deleted file mode 100644 index def7bff174f11dc55521bae849b28beb3310add5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 96 zcmexsUKJ6=z`*tJH_t*Q21P~=1_p*3{K~?N46GihIXU@UObl${`9(P?id+nRk*3cd z8fToH*72|3W5Lv*$>~{4qDc`tbuGQ?AKGtlXJB;To!sWPPGYwAEJmO?3|x^>0G}8h Au>b%7 diff --git a/xz/xz-5.2.2/tests/files/bad-1-lzma2-1.xz b/xz/xz-5.2.2/tests/files/bad-1-lzma2-1.xz deleted file mode 100644 index 640f592e80359e942a1ec60fc64b274770b353cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 64 zcmexsUKJ6=z`*cd=%ynRgCZjbkbQ$+S(u4|)gv`0C!dRnfh|10C?`dci-Cbrf!E~i R=F@CN^Qstu>KGUzqX7MX4<-Nr diff --git a/xz/xz-5.2.2/tests/files/bad-1-lzma2-2.xz b/xz/xz-5.2.2/tests/files/bad-1-lzma2-2.xz deleted file mode 100644 index 69ab07d4577b6ff71f7521fe53759c6543192a2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 424 zcmV;Z0ayP0H+ooF0004LBHlIv03iVg0002k4vH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>pa+auyeS}tVjcOv8tDZfOfGx*f3=&e)KL-eV9He*i6Sx<^ z?va5xvxo5i0JCaRLG3QE@?@8!nx12!t{HRDzhLwWI`Eq@>)$`vuccLzMg>?R36H2?2n(a>KD@LR+sC7#z!udM zry}St=(Nyx7sZR@^1Ex+@0x)$P95CrHs(ZfzbUmm1uvH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>pa+auyeS}tVjcOv8tDZfOfGx*f3=&e)KL-eV9He*i6Sx<^ z?va5xvxo5i0JCaRLG3QE@?@8!nx12!t{HRDzhLwWI`Eq@>)$`vuccLzMg>?R36H2?2n(a>KD@LR+sC7#z!udM zry}St=(Nyx7sZR@^1Ex+@0x)$P95CrHs(ZfzbUmm1ufCOZ6IWCY;STP zb7^!SVQpn}EFfcVZgXX0bY*mPav))3X>e(CX=7<_XCMlo0h0kF05Y2iY*g1Sm2CO< zH`N^CMgoF$`$=|T@N9l2BVfO zx0jsod;a1Qj4e^{+je(-qH7ud^_P!g>Dw^7v~WEZcmsDji+a_#_(~@w^^U3} z6s9RCYcF%)p>ec(q<~OB%J18>mHoTHjE-QJ+sl6;?Z6Om8hy*n3DDX9ZGgaMeLu#O z&s*J55z))kAlEB|PN+q@LU6C diff --git a/xz/xz-5.2.2/tests/files/bad-1-lzma2-5.xz b/xz/xz-5.2.2/tests/files/bad-1-lzma2-5.xz deleted file mode 100644 index 700464d51efa1e813c04e52263f6692aff20afd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 408 zcmV;J0cZaGH+ooF0004LBHlIv03iVg0002k4fCOZ6IWCY;STP zb7^!SVQpn}EFfcVZgXX0bY*mPav))3X>e(CX=7<_XCMlI0h0kF05Y2iY*g1Sm2CO< zH`N^CMgoF$`$=|T@N9l2BVfO zx0jsod;a1Qj4e^{+je(-qH7ud^_P!g>Dw^7v~WEZcmsDji+a_#_(~@w^^U3} z6s9RCYcF%)p>ec(q<~OB%J18>mHoTHjE-QJ+sl6;?Z6Om8hy*n3DDX9ZGgaMeLu#O z&s*J55z))kAlEB|PN+q@LU2vp0!7#RfsAG{B2 diff --git a/xz/xz-5.2.2/tests/files/bad-1-lzma2-7.xz b/xz/xz-5.2.2/tests/files/bad-1-lzma2-7.xz deleted file mode 100644 index 8cc711c19ed67c7416a811fe0fdf71210487c23a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 408 zcmV;J0cZaGH+ooF000E$*0e?f03iVg0002k4vH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>p5`0a~5vk*40WO9~hLS=uQj{(bU$>5r{q-BhCIRrXySr}1 zdY0ke$TY+CPlE<1QGsOnfNF6^(Bh`n4P-ITiZEjPb2Um31;ozpwEokDHsI-J!0@%9 z9#U9T-9T3OoAX)m*5G;uRy;ku6@j}t>xB*ysa{hlP)@$!-3+>l!|)^*_VDD)+r1|%x2wUGVz9q}m8b{;f6>+}ca0ow&ZXJfUDM`^ zwdZ+3rqiB%C%j3Sg$wZxMIQSq_ty@5&+zn8NEmw&OYym>f$1j-H^WuEv{l=!x8Hf6 zMzxhod3zDrEfeDi)uDu-K|5{{(>D2fRa6k)2H{NCS4q8QX?+`@;e%)h9iaU*hMo<< zARA?M-8)}%%EE*H|LAH_*Z=^s2Sn)?GfRX30rLXM0{{Tu^N=I4#Ao{g000001X)@# C3&N=Y diff --git a/xz/xz-5.2.2/tests/files/bad-1-lzma2-8.xz b/xz/xz-5.2.2/tests/files/bad-1-lzma2-8.xz deleted file mode 100644 index f21a71b63f38651fb1b520670337785589e2afd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmV;>0WbdjH+ooF000E$*0e?f03iVg0002k4vH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>pa+auyeS}tVjcOv8tDZfOfGx*f3=&e)KL-eV9He*i6Sx<^ z?vZoKywB@2W~@k?Y1xwpuFg=eXbCS{h#$fTqAXZNu>WES>+aiQPjBG!AI}mun3hiV z^0NDGuS5dkBHq>JG?zJ}MK7+IFL`N?={Jc;{>*;rsVJ?(=G?j3suq3$048i%TbRc1DX>oOFa3E!PAZ1}7V{dJ3Z)9&E3ZMYx0KEV)o5~r*RP44?=dpdn zSDtK%tx9bc*gOT45Ehv@A)~p)fdBmN)YU)TjMqJncI=3%GOK0OIPdrQiof^xrB>H% z*FS{|o zgXk%sXUJwcebRwi>Q{oBCCdBuhzgtEK?808000282Sn)?GfRX30jdMZ0{{R}gK;&n#Ao{g00000 G1X)^h4%Vsw diff --git a/xz/xz-5.2.2/tests/files/bad-1-stream_flags-1.xz b/xz/xz-5.2.2/tests/files/bad-1-stream_flags-1.xz deleted file mode 100644 index 6511773ec695f6387404d73716bba123a1e670f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-69Zd#eo;<}A{T@6;zgni Xj4Hea8u!<02~U{92vp0!6d45o9W)PB diff --git a/xz/xz-5.2.2/tests/files/bad-1-stream_flags-2.xz b/xz/xz-5.2.2/tests/files/bad-1-stream_flags-2.xz deleted file mode 100644 index 0c66b364b0ed17c01149741c824d81a5cb175ef7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbgztwL6MPzfq~%$zp^kR1FJ`BPEI}-69Zd#eo;<}A{T@6;zgni Xj4Hea8u!;vaGJ@>2vp0!7#RfsE!hvN diff --git a/xz/xz-5.2.2/tests/files/bad-1-stream_flags-3.xz b/xz/xz-5.2.2/tests/files/bad-1-stream_flags-3.xz deleted file mode 100644 index a9b1f98365fda585c356b1e7c2db47a44b54c596..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-69Zd#eo;<}A{T@6;zgni Xj4Hea8u!;vaGJr(2vp0!7#RfsACC`e diff --git a/xz/xz-5.2.2/tests/files/bad-1-vli-1.xz b/xz/xz-5.2.2/tests/files/bad-1-vli-1.xz deleted file mode 100644 index 6514ab129469ec4558db32d6fefd816c00e1064f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72 zcmexsUKJ6=z`&TPbkB^rp_f6Ck%IvQ7I>@_XJp{UL?xE VsLER?d1TuJr$2sFUm<# h^6te`!3<1NY|`uu3~YCv$J!b2b~6FZU|@`l0swRj64d|z diff --git a/xz/xz-5.2.2/tests/files/bad-2-index-1.xz b/xz/xz-5.2.2/tests/files/bad-2-index-1.xz deleted file mode 100644 index f51ed214d16b9652b2c1522561d481eac75ea390..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-kS}IB%@9?NEj+&{Cq)q` gdH3R}UHYs)nhGQA*dUgi9-Aq6|42+Rc0BU9u5dZ)H diff --git a/xz/xz-5.2.2/tests/files/bad-2-index-2.xz b/xz/xz-5.2.2/tests/files/bad-2-index-2.xz deleted file mode 100644 index d7d00ff343fea9fd49896c2ef605a71023f06249..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-kS}IB%@9?NEj+&{Cq)q` fdH3R}UglDb_x>W diff --git a/xz/xz-5.2.2/tests/files/bad-2-index-3.xz b/xz/xz-5.2.2/tests/files/bad-2-index-3.xz deleted file mode 100644 index 62428b87223690e63b08a793bed03d02762fa300..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-kS}IB%@9?NEj+&{Cq)q` hdH3R}UFfc|&0RVb?6Ey$; diff --git a/xz/xz-5.2.2/tests/files/bad-2-index-4.xz b/xz/xz-5.2.2/tests/files/bad-2-index-4.xz deleted file mode 100644 index 9cf2df65da5ffed8efae5a28128d4408088f89b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-kS}IB%@9?NEj+&{Cq)q` gdH3R}U!--7r>uC`TPwI1El7!X|ZCSN0&px zFGr)J^#oeLn>_){TRQr)!c3h{SN*%MQ~w74^`}u@q?}{4v|{&1pipkF;|o&5r#HY< zNddXE|2tmwZ8yUJ^Q+|Uc32$NxO8Zp-%n0rcCj_ zRA%p_tx+K35AF;Cq+>h(sK-_Uuiddw!DshN@3dM+2De|MO{(J;WxJ>_2DMUPr}Xg` z75PD}w>lNL>YrxEQPE);?FhX8TXFGkdS{LWrd678{+yx&U10mCw(?F7M=dFx>EAL@10)4R_I;( z1fpA0{kN)Hu{Krk>y9EkKRQZh;&ACC{yaY4=000282Sn)?GfRX30qFzD0{{S$ S`@Oue#Ao{g000001X)_0Yy40E diff --git a/xz/xz-5.2.2/tests/files/good-1-block_header-1.xz b/xz/xz-5.2.2/tests/files/good-1-block_header-1.xz deleted file mode 100644 index fea5ad2f9980d5d9145700561a980e6e106b4e32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72 zcmexsUKJ6=z`&TPbkB_WfFQ3TBL@Qr)Zepw&B(yxk(!f}&lR3ul#`;!1rm2&yhxOR VQI)q)^2oLcPBVEKL4u5tQ2?t(5zGJp diff --git a/xz/xz-5.2.2/tests/files/good-1-block_header-2.xz b/xz/xz-5.2.2/tests/files/good-1-block_header-2.xz deleted file mode 100644 index 6b5dcb347b24d1a5abf4150b1e3c9039b1b65a0d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^*K~RyAgMq=yr{f_b1CK{)PEI~ocz#h%iXs;S5I8ShB+9_3 U$Xj}6#ia>OGkF<7f{c+-0BF(?ZvX%Q diff --git a/xz/xz-5.2.2/tests/files/good-1-block_header-3.xz b/xz/xz-5.2.2/tests/files/good-1-block_header-3.xz deleted file mode 100644 index 156531206342a87baa8029915aae0c940301c5ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^bfme}{gMlGXurZR6fyW~?CnujPJijO>MUjgE2%Hx$5@ldi U2vp0!7#RfsADItp diff --git a/xz/xz-5.2.2/tests/files/good-1-check-crc64.xz b/xz/xz-5.2.2/tests/files/good-1-check-crc64.xz deleted file mode 100644 index 5a9915d2f9fc4711b26ed2d399027583bf824340..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72 zcmexsUKJ6=z`*kC+7>q^21P~=1_p*3{K~?N46GihIXU@UObl${`9(P?id+ou^*RLS b+D|*hz^K7%lb*#azwL7^BTzj9OJo!P#4r-r diff --git a/xz/xz-5.2.2/tests/files/good-1-check-none.xz b/xz/xz-5.2.2/tests/files/good-1-check-none.xz deleted file mode 100644 index 1e85faf3d06eff1bc420925a1af096762b00db51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 64 zcmexsUKJ6=z`*cd=%ynRgCZjbkbQ$+S(uT5)gv`0C!dRnfh|10C?`dci-Cbrf!E~i R=F@CN^Qstu>KGUzqX7L^4~{4qDc`tbuGQ?AKGtlV_0G|UM AumAu6 diff --git a/xz/xz-5.2.2/tests/files/good-1-delta-lzma2.tiff.xz b/xz/xz-5.2.2/tests/files/good-1-delta-lzma2.tiff.xz deleted file mode 100644 index 1f033bc52b5d3e8950a34ed118b8837c964771b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 51316 zcmV(jK=!}=H+ooF0004LBHlIv0RsU7ApsD_O|Gr(Epf;-0{|r9pd(3lQsrPvPy>Zs zcOWIa&BRoh{mcsSld+V6@60sNFVwf8V2;?$xWo6}29-rV*)3o_DhnJL!5s*9FDfD$;cT$-rTREE zz*j8)!K|gmmUgQ8?H=^jw7s%FUkB};R#(@O3_N1Zeu*TOO9t_tiku}PP za6}1b0kH!luSmY7X28pyRMppK@Gdw6E~#W6mq8(ky5vv4qs>TS=?_P=coD&h_b;mJ zrKZSinZkX8d?q}xza6;e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)yw%&u62A>}3J+$OJ93 zLv{Anbl8wRNxOyt(x2gW)1TAG$eJ4lRSqko#P-U?Z&8WzF!v{*vnD?P&eAIs)BkpD zALgt()a1xq5N+&Gq4!O8+^Ujt7RbN~b}Q=>1bg{(m_X`tYbI<(9 zO2-`1QXmXVO$^&Sd_qfwRDE7{G*VA#e0#0t3_@e}Uh`ea7tOs&F4DmH&MYS0&vSTZ zjwfO)Vth2)E=U1jWvq?o4)H&Qd3XLa#tt3Pa7vq~-{*hE>dO{fRdwPwo3p8Ag+nhi zVKJtHXk8GH?mVhVSB=liS&cKd98_`P&_-+!u*U)f4^0&|eX$E51m6mk<;S3%@GAkR z3MiZ(`^J7>4u)J)cGIWbvH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>pa+auyeS}tVjcOv8tDZfOfGx*f3=&e)KL-eV9He*i6Sx<^ z?va5xvxo5i0JCaRLG3QE@?@8!nx12!t{HRDzhLwWI`Eq@>)$`vuccLzMg>?R36H2?2n(a>KD@LR+sC7#z!udM zry}St=(Nyx7sZR@^1Ex+@0x)$P95CrHs(ZfzbUmm1uvH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>pa+auyeS}tVjcOv8tDZfOfGx*f3=&e)KL-eV9He*i6Sx<^ z?va5xvxo5i0JCaRLG3QE@?@8!nx12!t{HRF!iN;a*~>rB7^clCOI@hPUjb(*Of2Ng)l#05 z0)7x(^#ie(FDC7VdscrFd03A`5ZT!emgzgcwYb_V;nsoi$p8TRM@ZWM0fPg{0{{T7 S*U}X}Fb#_W000000a;o&?Zkcn diff --git a/xz/xz-5.2.2/tests/files/good-1-lzma2-3.xz b/xz/xz-5.2.2/tests/files/good-1-lzma2-3.xz deleted file mode 100644 index c4c72be6561465781670b5a9b6067b1cfa016f7a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 408 zcmV;J0cZaGH+ooF0004LBHlIv03iVg0002k4fCOZ6IWCY;STP zb7^!SVQpn}EFfcVZgXX0bY*mPav))3X>e(CX=7<_XCMl|0h0kFT>vth32ao?E|qNg z_czrX;zk03b^A$njdN4B{cYRI+u1}5u`a$7wz{a|^X+w1+(97BzcyPSnOzSdp$4Ot zEw`7P@O%E^5{xZT@Y{BGeWZKSmFfEh=Jl74V(Hs3yR>jU7I*`9I*WSMxcEvZCH0P~ zBowA8C~Gfs;GuD}d!&F+K+5miw3Yq4!HkYzm)pyKA??5raT}jB^kOtXvnab% zHr;v-95y95SO)kNqs|z}{gxhSDFeg3C-diz+jF!lPdHd4zk?Jxesk{r&&s{?A!;aq z$c|ls$GjKNER(eemAVd+f@ZG&xB~$DM@ZWM0rUdN0{{SL!<9ZhFb#_W000000a;q- Ccebnm diff --git a/xz/xz-5.2.2/tests/files/good-1-lzma2-4.xz b/xz/xz-5.2.2/tests/files/good-1-lzma2-4.xz deleted file mode 100644 index e0d623a001ce5dbf48b55cff0168d01e1b012272..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmV;>0WbdjH+ooF000E$*0e?f03iVg0002k4vH<%0_2e@^`p>hS)*d z1vSlsrF;^l1>2ClFBH>pa+auyeS}tVjcOv8tDZfOfGx*f3=&e)KL-eV9He*i6Sx<^ z?vZoKywB@2W~@k?Y1xwpuFg=eXbCS{h#$fTqAXZNu>WES>+aiQPjBG!AI}mun3hiV z^0NDGuS5dkBHq>JG?zJ}MK7+IFL`N?={Jc;{>*;rsVJ?(=G?j3suq3$048i%TbRc1DX>oOFa3E!PAZ1}7V{dJ3Z)9&E3cvv60KHuRF`LR6#Z>IJROhjM z#8;kdiLFX)7T7!mln@q~I3c6C#eo0(?$p&k-Hg{gk9O>csxqr()Hv_=`HH{y_@!3Y zZP!1A3!XpXM`$7l1vR)qa{1f7w~mItLrabgLoY#T-(d{I=r;&T-okbkxJXW(xl>Rd zGlS?Upl8TtI)5S(V*5wry!25I6^KdL$_pinUg+BWIKa+Ka~uEAo9Ilp6Zkio;@X@q zwd%N~jp|o|nw9kMTBTHiU|rqP*<4q zy+h3=>BhIS_~FMS3&JYf15Z3o zyondruX%`tHjHl7JTz)4phYKzLsG9%o=aYyG{OIl!M))O)*(<{6gw$YWhjtxPAz3o zHIOBCw_%E(@Dz19s;+ext0~(y_O8YPIy#dDY=xtaRqzJGH#U&Fo18HLYuujtZ!Y+u z#L8|bd~_cu=z4ZP!;&N+j?)Xm6ZI0#I~o~RmHM4O-WJk$5CIxO5!rjdjx2be%R{g3 zR->*1aJLh)h&) z96V|7(S12}MZ`&3hN6B&xsEv=jiVF|m4Ca`-r&;!q?mn1g4W@U~wYPXwrg_J?F!F1N)NX5XRZ z(1}y(Ml850zHt_lK_F;o3Sl`))VC-%27MTVFn-r;9;VghK){x)ipy@zV|LuklqG;P z!rNYWc5e{wW?h9(9)n_Va&L&6_w!)jpwsjs>F?1ZsDlZc6H}}b>SNBxs5(#a$ynNH y0{I&%5|0loy-2><}$swDcc#Ao{g000001X)@K86SNB diff --git a/xz/xz-5.2.2/tests/files/good-1-x86-lzma2.xz b/xz/xz-5.2.2/tests/files/good-1-x86-lzma2.xz deleted file mode 100644 index 8053917bad7d4f43169312c43713afcd4cf51bec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 716 zcmV;-0yF*nH+ooF000E$*0e?f0R#Xc0SExnxpd3m1#1F|T>w9kMTBTO-rlH71K2fF zq>*!@eAV{Ae?1%0dPRjv;AqaK52~C5` z#1O&XZ{}_(no)!cXEany3*BG3=({7HK2SR}f@TKWA!=eaD}u!er+XteMni# zlx-j18Iprum`|dPwFOxHhPD{hja?DcjZ5=vHv@)q&`TSIA#l z_133ZPo`QuX|ch8IU8q&UhQ}{21O2q^AW;v0FtC;8ywtk#aO59jBm|Nm#*f%QeK>2 z8r}vY+8zdtc55>RYwV;n{m}Mu%moSC(cT86GWRjbVidoO^VjY-+JxHXiu z>=vy%8-AKCrG$+9vrRt+Q;>aAJ{Zwuu#uCOSA3q+uBmNO*w5&E^2M{9_y1Mz8<1Mz z1HvGOjE?aDdJ0D3a-}E0Z->q|yE{__=Sq6ph)$m3iGgE?@^U#2J8qL_N%2}!6la1&^clV*sX3g*TXb0 zZ&XK)oap%OJ|FS~>!a9Mh2nLH4iws-W?+1p^Kd7ktj3%Q;jf#raGq@^7d%;(AWpmj y-+M9950;Kv`Q?PC0002Y{;&Ts9Ye4H0j34)3IG5I(#}<}#Ao{g000001X)^L%US6F diff --git a/xz/xz-5.2.2/tests/files/good-2-lzma2.xz b/xz/xz-5.2.2/tests/files/good-2-lzma2.xz deleted file mode 100644 index bed5085c1f6c30d42970ddceef99d846986b527c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmexsUKJ6=z`&TPbkB^5L6MPzfq~%$zp^kR1FJ`BPEI}-kS}IB%@9?NEj+&{Cq)q` gdH3R}U(BXU<=PL%1Ke=VsKu(NR)w5 Vh1Wpi{`v_{GkF;qfPgVF3IH7?4`cuU diff --git a/xz/xz-5.2.2/tests/files/unsupported-check.xz b/xz/xz-5.2.2/tests/files/unsupported-check.xz deleted file mode 100644 index c28355e7474b7350e7297f73a89a197d8ac426c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`%65`1*P#21P~=1_p*3{K~?N46GihIXU@UObl${`9(P?id+oNix-J9 XFskqxXxv|~B|KpYBTy{^Q)CnXVowl* diff --git a/xz/xz-5.2.2/tests/files/unsupported-filter_flags-1.xz b/xz/xz-5.2.2/tests/files/unsupported-filter_flags-1.xz deleted file mode 100644 index 48b93731c52b4c0fb2bc5724a38e16e5ea37b8e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^5p`HN@(u?mhGO&82=H%paF)^@(=NILqC~`44FJ2_dz^KA& SpmBfw1gDw2j3C8~kx>9kA`n^t diff --git a/xz/xz-5.2.2/tests/files/unsupported-filter_flags-2.xz b/xz/xz-5.2.2/tests/files/unsupported-filter_flags-2.xz deleted file mode 100644 index c283359d56204cd1fa673fb54d4642b30cf36155..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^5ftm3?0|UeF)^ARX46GihIXU@UObl${`9(P?id+oNix-J9 XFskqxXxv{v!D%KhBTy{^V`LNnmDmyA diff --git a/xz/xz-5.2.2/tests/files/unsupported-filter_flags-3.xz b/xz/xz-5.2.2/tests/files/unsupported-filter_flags-3.xz deleted file mode 100644 index 26084984f97da6e03bd6e326d6ef4b333cd47045..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmexsUKJ6=z`&TPbkB^5QIU}Yh)ztDp3TU>>XDk0lh4J(z!sigl#`;!#o)YnkthSB V3a^32{q+-^X7VyJ00CoU6aZ6m5QqQ( diff --git a/xz/xz-5.2.2/tests/test_bcj_exact_size.c b/xz/xz-5.2.2/tests/test_bcj_exact_size.c deleted file mode 100644 index 4a11a9c68a..0000000000 --- a/xz/xz-5.2.2/tests/test_bcj_exact_size.c +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file test_bcj_exact_size.c -/// \brief Tests BCJ decoding when the output size is known -/// -/// These tests fail with XZ Utils 5.0.3 and earlier. -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tests.h" - - -/// Something to be compressed -static const uint8_t in[16] = "0123456789ABCDEF"; - -/// in[] after compression -static uint8_t compressed[1024]; -static size_t compressed_size = 0; - -/// Output buffer for decompressing compressed[] -static uint8_t out[sizeof(in)]; - - -static void -compress(void) -{ - // Compress with PowerPC BCJ and LZMA2. PowerPC BCJ is used because - // it has fixed 4-byte alignment which makes triggering the potential - // bug easy. - lzma_options_lzma opt_lzma2; - succeed(lzma_lzma_preset(&opt_lzma2, 0)); - - lzma_filter filters[3] = { - { .id = LZMA_FILTER_POWERPC, .options = NULL }, - { .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 }, - { .id = LZMA_VLI_UNKNOWN, .options = NULL }, - }; - - expect(lzma_stream_buffer_encode(filters, LZMA_CHECK_CRC32, NULL, - in, sizeof(in), - compressed, &compressed_size, sizeof(compressed)) - == LZMA_OK); -} - - -static void -decompress(void) -{ - lzma_stream strm = LZMA_STREAM_INIT; - expect(lzma_stream_decoder(&strm, 10 << 20, 0) == LZMA_OK); - - strm.next_in = compressed; - strm.next_out = out; - - while (true) { - if (strm.total_in < compressed_size) - strm.avail_in = 1; - - const lzma_ret ret = lzma_code(&strm, LZMA_RUN); - if (ret == LZMA_STREAM_END) { - expect(strm.total_in == compressed_size); - expect(strm.total_out == sizeof(in)); - lzma_end(&strm); - return; - } - - expect(ret == LZMA_OK); - - if (strm.total_out < sizeof(in)) - strm.avail_out = 1; - } -} - - -static void -decompress_empty(void) -{ - // An empty file with one Block using PowerPC BCJ and LZMA2. - static const uint8_t empty_bcj_lzma2[] = { - 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x01, - 0x69, 0x22, 0xDE, 0x36, 0x02, 0x01, 0x05, 0x00, - 0x21, 0x01, 0x00, 0x00, 0x7F, 0xE0, 0xF1, 0xC8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x11, 0x00, 0x3B, 0x96, 0x5F, 0x73, - 0x90, 0x42, 0x99, 0x0D, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x59, 0x5A - }; - - // Decompress without giving any output space. - uint64_t memlimit = 1 << 20; - size_t in_pos = 0; - size_t out_pos = 0; - expect(lzma_stream_buffer_decode(&memlimit, 0, NULL, - empty_bcj_lzma2, &in_pos, sizeof(empty_bcj_lzma2), - out, &out_pos, 0) == LZMA_OK); - expect(in_pos == sizeof(empty_bcj_lzma2)); - expect(out_pos == 0); -} - - -extern int -main(void) -{ - compress(); - decompress(); - decompress_empty(); - return 0; -} diff --git a/xz/xz-5.2.2/tests/test_block_header.c b/xz/xz-5.2.2/tests/test_block_header.c deleted file mode 100644 index 3d9b5d9314..0000000000 --- a/xz/xz-5.2.2/tests/test_block_header.c +++ /dev/null @@ -1,240 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file test_block_header.c -/// \brief Tests Block Header coders -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tests.h" - - -static uint8_t buf[LZMA_BLOCK_HEADER_SIZE_MAX]; -static lzma_block known_options; -static lzma_block decoded_options; - -static lzma_options_lzma opt_lzma; - -static lzma_filter filters_none[1] = { - { - .id = LZMA_VLI_UNKNOWN, - }, -}; - - -static lzma_filter filters_one[2] = { - { - .id = LZMA_FILTER_LZMA2, - .options = &opt_lzma, - }, { - .id = LZMA_VLI_UNKNOWN, - } -}; - - -static lzma_filter filters_four[5] = { - { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_LZMA2, - .options = &opt_lzma, - }, { - .id = LZMA_VLI_UNKNOWN, - } -}; - - -static lzma_filter filters_five[6] = { - { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_X86, - .options = NULL, - }, { - .id = LZMA_FILTER_LZMA2, - .options = &opt_lzma, - }, { - .id = LZMA_VLI_UNKNOWN, - } -}; - - -static void -code(void) -{ - expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK); - - lzma_filter filters[LZMA_FILTERS_MAX + 1]; - memcrap(filters, sizeof(filters)); - memcrap(&decoded_options, sizeof(decoded_options)); - - decoded_options.header_size = known_options.header_size; - decoded_options.check = known_options.check; - decoded_options.filters = filters; - expect(lzma_block_header_decode(&decoded_options, NULL, buf) - == LZMA_OK); - - expect(known_options.compressed_size - == decoded_options.compressed_size); - expect(known_options.uncompressed_size - == decoded_options.uncompressed_size); - - for (size_t i = 0; known_options.filters[i].id - != LZMA_VLI_UNKNOWN; ++i) - expect(known_options.filters[i].id == filters[i].id); - - for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) - free(decoded_options.filters[i].options); -} - - -static void -test1(void) -{ - known_options = (lzma_block){ - .check = LZMA_CHECK_NONE, - .compressed_size = LZMA_VLI_UNKNOWN, - .uncompressed_size = LZMA_VLI_UNKNOWN, - .filters = NULL, - }; - - expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR); - - known_options.filters = filters_none; - expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR); - - known_options.filters = filters_five; - expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR); - - known_options.filters = filters_one; - expect(lzma_block_header_size(&known_options) == LZMA_OK); - - known_options.check = 999; // Some invalid value, which gets ignored. - expect(lzma_block_header_size(&known_options) == LZMA_OK); - - known_options.compressed_size = 5; - expect(lzma_block_header_size(&known_options) == LZMA_OK); - - known_options.compressed_size = 0; // Cannot be zero. - expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR); - - // LZMA_VLI_MAX is too big to keep the total size of the Block - // a valid VLI, but lzma_block_header_size() is not meant - // to validate it. (lzma_block_header_encode() must validate it.) - known_options.compressed_size = LZMA_VLI_MAX; - expect(lzma_block_header_size(&known_options) == LZMA_OK); - - known_options.compressed_size = LZMA_VLI_UNKNOWN; - known_options.uncompressed_size = 0; - expect(lzma_block_header_size(&known_options) == LZMA_OK); - - known_options.uncompressed_size = LZMA_VLI_MAX + 1; - expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR); -} - - -static void -test2(void) -{ - known_options = (lzma_block){ - .check = LZMA_CHECK_CRC32, - .compressed_size = LZMA_VLI_UNKNOWN, - .uncompressed_size = LZMA_VLI_UNKNOWN, - .filters = filters_four, - }; - - expect(lzma_block_header_size(&known_options) == LZMA_OK); - code(); - - known_options.compressed_size = 123456; - known_options.uncompressed_size = 234567; - expect(lzma_block_header_size(&known_options) == LZMA_OK); - code(); - - // We can make the sizes smaller while keeping the header size - // the same. - known_options.compressed_size = 12; - known_options.uncompressed_size = 23; - code(); -} - - -static void -test3(void) -{ - known_options = (lzma_block){ - .check = LZMA_CHECK_CRC32, - .compressed_size = LZMA_VLI_UNKNOWN, - .uncompressed_size = LZMA_VLI_UNKNOWN, - .filters = filters_one, - }; - - expect(lzma_block_header_size(&known_options) == LZMA_OK); - known_options.header_size += 4; - expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK); - - lzma_filter filters[LZMA_FILTERS_MAX + 1]; - decoded_options.header_size = known_options.header_size; - decoded_options.check = known_options.check; - decoded_options.filters = filters; - - // Wrong size - ++buf[0]; - expect(lzma_block_header_decode(&decoded_options, NULL, buf) - == LZMA_PROG_ERROR); - --buf[0]; - - // Wrong CRC32 - buf[known_options.header_size - 1] ^= 1; - expect(lzma_block_header_decode(&decoded_options, NULL, buf) - == LZMA_DATA_ERROR); - buf[known_options.header_size - 1] ^= 1; - - // Unsupported filter - // NOTE: This may need updating when new IDs become supported. - buf[2] ^= 0x1F; - unaligned_write32le(buf + known_options.header_size - 4, - lzma_crc32(buf, known_options.header_size - 4, 0)); - expect(lzma_block_header_decode(&decoded_options, NULL, buf) - == LZMA_OPTIONS_ERROR); - buf[2] ^= 0x1F; - - // Non-nul Padding - buf[known_options.header_size - 4 - 1] ^= 1; - unaligned_write32le(buf + known_options.header_size - 4, - lzma_crc32(buf, known_options.header_size - 4, 0)); - expect(lzma_block_header_decode(&decoded_options, NULL, buf) - == LZMA_OPTIONS_ERROR); - buf[known_options.header_size - 4 - 1] ^= 1; -} - - -int -main(void) -{ - succeed(lzma_lzma_preset(&opt_lzma, 1)); - - test1(); - test2(); - test3(); - - return 0; -} diff --git a/xz/xz-5.2.2/tests/test_check.c b/xz/xz-5.2.2/tests/test_check.c deleted file mode 100644 index 7d4a36078c..0000000000 --- a/xz/xz-5.2.2/tests/test_check.c +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file test_check.c -/// \brief Tests integrity checks -/// -/// \todo Add SHA256 -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tests.h" - - -static const uint8_t test_string[9] = "123456789"; -static const uint8_t test_unaligned[12] = "xxx123456789"; - - -static bool -test_crc32(void) -{ - static const uint32_t test_vector = 0xCBF43926; - - // Test 1 - uint32_t crc = lzma_crc32(test_string, sizeof(test_string), 0); - if (crc != test_vector) - return true; - - // Test 2 - crc = lzma_crc32(test_unaligned + 3, sizeof(test_string), 0); - if (crc != test_vector) - return true; - - // Test 3 - crc = 0; - for (size_t i = 0; i < sizeof(test_string); ++i) - crc = lzma_crc32(test_string + i, 1, crc); - if (crc != test_vector) - return true; - - return false; -} - - -static bool -test_crc64(void) -{ - static const uint64_t test_vector = 0x995DC9BBDF1939FA; - - // Test 1 - uint64_t crc = lzma_crc64(test_string, sizeof(test_string), 0); - if (crc != test_vector) - return true; - - // Test 2 - crc = lzma_crc64(test_unaligned + 3, sizeof(test_string), 0); - if (crc != test_vector) - return true; - - // Test 3 - crc = 0; - for (size_t i = 0; i < sizeof(test_string); ++i) - crc = lzma_crc64(test_string + i, 1, crc); - if (crc != test_vector) - return true; - - return false; -} - - -int -main(void) -{ - bool error = false; - - error |= test_crc32(); - error |= test_crc64(); - - return error ? 1 : 0; -} diff --git a/xz/xz-5.2.2/tests/test_compress.sh b/xz/xz-5.2.2/tests/test_compress.sh deleted file mode 100755 index 62da0f921a..0000000000 --- a/xz/xz-5.2.2/tests/test_compress.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh - -############################################################################### -# -# Author: Lasse Collin -# -# This file has been put into the public domain. -# You can do whatever you want with this file. -# -############################################################################### - -# If xz wasn't built, this test is skipped. -if test -x ../src/xz/xz ; then - : -else - (exit 77) - exit 77 -fi - -# Find out if our shell supports functions. -eval 'unset foo ; foo() { return 42; } ; foo' -if test $? != 42 ; then - echo "/bin/sh doesn't support functions, skipping this test." - (exit 77) - exit 77 -fi - -test_xz() { - if $XZ -c "$@" "$FILE" > tmp_compressed; then - : - else - echo "Compressing failed: $* $FILE" - (exit 1) - exit 1 - fi - - if $XZ -cd tmp_compressed > tmp_uncompressed ; then - : - else - echo "Decompressing failed: $* $FILE" - (exit 1) - exit 1 - fi - - if cmp tmp_uncompressed "$FILE" ; then - : - else - echo "Decompressed file does not match" \ - "the original: $* $FILE" - (exit 1) - exit 1 - fi - - if test -n "$XZDEC" ; then - if $XZDEC tmp_compressed > tmp_uncompressed ; then - : - else - echo "Decompressing failed: $* $FILE" - (exit 1) - exit 1 - fi - - if cmp tmp_uncompressed "$FILE" ; then - : - else - echo "Decompressed file does not match" \ - "the original: $* $FILE" - (exit 1) - exit 1 - fi - fi - - # Show progress: - echo . | tr -d '\n\r' -} - -XZ="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \ - --no-adjust --threads=1 --check=crc64" -XZDEC="../src/xzdec/xzdec" # No memory usage limiter available -test -x ../src/xzdec/xzdec || XZDEC= - -# Create the required input files. -if ./create_compress_files ; then - : -else - rm -f compress_* - echo "Failed to create files to test compression." - (exit 1) - exit 1 -fi - -# Remove temporary now (in case they are something weird), and on exit. -rm -f tmp_compressed tmp_uncompressed -trap 'rm -f tmp_compressed tmp_uncompressed' 0 - -# Compress and decompress each file with various filter configurations. -# This takes quite a bit of time. -echo "test_compress.sh:" -for FILE in compress_generated_* "$srcdir"/compress_prepared_* -do - MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'` - echo " $MSG" | tr -d '\n\r' - - # Don't test with empty arguments; it breaks some ancient - # proprietary /bin/sh versions due to $@ used in test_xz(). - test_xz -1 - test_xz -2 - test_xz -3 - test_xz -4 - - # Disabled until Subblock format is stable. -# --subblock \ -# --subblock=size=1 \ -# --subblock=size=1,rle=1 \ -# --subblock=size=1,rle=4 \ -# --subblock=size=4,rle=4 \ -# --subblock=size=8,rle=4 \ -# --subblock=size=8,rle=8 \ -# --subblock=size=4096,rle=12 \ -# - for ARGS in \ - --delta=dist=1 \ - --delta=dist=4 \ - --delta=dist=256 \ - --x86 \ - --powerpc \ - --ia64 \ - --arm \ - --armthumb \ - --sparc - do - test_xz $ARGS --lzma2=dict=64KiB,nice=32,mode=fast - - # Disabled until Subblock format is stable. - # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast - done - - echo -done - -(exit 0) -exit 0 diff --git a/xz/xz-5.2.2/tests/test_files.sh b/xz/xz-5.2.2/tests/test_files.sh deleted file mode 100755 index 0f8a64d562..0000000000 --- a/xz/xz-5.2.2/tests/test_files.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -############################################################################### -# -# Author: Lasse Collin -# -# This file has been put into the public domain. -# You can do whatever you want with this file. -# -############################################################################### - -# If both xz and xzdec were not build, skip this test. -XZ=../src/xz/xz -XZDEC=../src/xzdec/xzdec -test -x "$XZ" || XZ= -test -x "$XZDEC" || XZDEC= -if test -z "$XZ$XZDEC"; then - (exit 77) - exit 77 -fi - -for I in "$srcdir"/files/good-*.xz -do - if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then - : - else - echo "Good file failed: $I" - (exit 1) - exit 1 - fi - - if test -z "$XZDEC" || "$XZDEC" "$I" > /dev/null; then - : - else - echo "Good file failed: $I" - (exit 1) - exit 1 - fi -done - -for I in "$srcdir"/files/bad-*.xz -do - if test -n "$XZ" && "$XZ" -dc "$I" > /dev/null 2>&1; then - echo "Bad file succeeded: $I" - (exit 1) - exit 1 - fi - - if test -n "$XZDEC" && "$XZDEC" "$I" > /dev/null 2>&1; then - echo "Bad file succeeded: $I" - (exit 1) - exit 1 - fi -done - -(exit 0) -exit 0 diff --git a/xz/xz-5.2.2/tests/test_filter_flags.c b/xz/xz-5.2.2/tests/test_filter_flags.c deleted file mode 100644 index ccd9ae98d3..0000000000 --- a/xz/xz-5.2.2/tests/test_filter_flags.c +++ /dev/null @@ -1,258 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file test_filter_flags.c -/// \brief Tests Filter Flags coders -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tests.h" - - -static uint8_t buffer[4096]; -static lzma_filter known_flags; -static lzma_filter decoded_flags; -static lzma_stream strm = LZMA_STREAM_INIT; - - -static bool -encode(uint32_t known_size) -{ - memcrap(buffer, sizeof(buffer)); - - uint32_t tmp; - if (lzma_filter_flags_size(&tmp, &known_flags) != LZMA_OK) - return true; - - if (tmp != known_size) - return true; - - size_t out_pos = 0; - if (lzma_filter_flags_encode(&known_flags, - buffer, &out_pos, known_size) != LZMA_OK) - return true; - - if (out_pos != known_size) - return true; - - return false; -} - - -static bool -decode_ret(uint32_t known_size, lzma_ret expected_ret) -{ - memcrap(&decoded_flags, sizeof(decoded_flags)); - - size_t pos = 0; - if (lzma_filter_flags_decode(&decoded_flags, NULL, - buffer, &pos, known_size) != expected_ret - || pos != known_size) - return true; - - return false; -} - - -static bool -decode(uint32_t known_size) -{ - if (decode_ret(known_size, LZMA_OK)) - return true; - - if (known_flags.id != decoded_flags.id) - return true; - - return false; -} - - -#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86) -static void -test_bcj(void) -{ - // Test 1 - known_flags.id = LZMA_FILTER_X86; - known_flags.options = NULL; - - expect(!encode(2)); - expect(!decode(2)); - expect(decoded_flags.options == NULL); - - // Test 2 - lzma_options_bcj options; - options.start_offset = 0; - known_flags.options = &options; - expect(!encode(2)); - expect(!decode(2)); - expect(decoded_flags.options == NULL); - - // Test 3 - options.start_offset = 123456; - known_flags.options = &options; - expect(!encode(6)); - expect(!decode(6)); - expect(decoded_flags.options != NULL); - - lzma_options_bcj *decoded = decoded_flags.options; - expect(decoded->start_offset == options.start_offset); - - free(decoded); -} -#endif - - -#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA) -static void -test_delta(void) -{ - // Test 1 - known_flags.id = LZMA_FILTER_DELTA; - known_flags.options = NULL; - expect(encode(99)); - - // Test 2 - lzma_options_delta options = { - .type = LZMA_DELTA_TYPE_BYTE, - .dist = 0 - }; - known_flags.options = &options; - expect(encode(99)); - - // Test 3 - options.dist = LZMA_DELTA_DIST_MIN; - expect(!encode(3)); - expect(!decode(3)); - expect(((lzma_options_delta *)(decoded_flags.options))->dist - == options.dist); - - free(decoded_flags.options); - - // Test 4 - options.dist = LZMA_DELTA_DIST_MAX; - expect(!encode(3)); - expect(!decode(3)); - expect(((lzma_options_delta *)(decoded_flags.options))->dist - == options.dist); - - free(decoded_flags.options); - - // Test 5 - options.dist = LZMA_DELTA_DIST_MAX + 1; - expect(encode(99)); -} -#endif - -/* -#ifdef HAVE_FILTER_LZMA -static void -validate_lzma(void) -{ - const lzma_options_lzma *known = known_flags.options; - const lzma_options_lzma *decoded = decoded_flags.options; - - expect(known->dictionary_size <= decoded->dictionary_size); - - if (known->dictionary_size == 1) - expect(decoded->dictionary_size == 1); - else - expect(known->dictionary_size + known->dictionary_size / 2 - > decoded->dictionary_size); - - expect(known->literal_context_bits == decoded->literal_context_bits); - expect(known->literal_pos_bits == decoded->literal_pos_bits); - expect(known->pos_bits == decoded->pos_bits); -} - - -static void -test_lzma(void) -{ - // Test 1 - known_flags.id = LZMA_FILTER_LZMA1; - known_flags.options = NULL; - expect(encode(99)); - - // Test 2 - lzma_options_lzma options = { - .dictionary_size = 0, - .literal_context_bits = 0, - .literal_pos_bits = 0, - .pos_bits = 0, - .preset_dictionary = NULL, - .preset_dictionary_size = 0, - .mode = LZMA_MODE_INVALID, - .fast_bytes = 0, - .match_finder = LZMA_MF_INVALID, - .match_finder_cycles = 0, - }; - - // Test 3 (empty dictionary not allowed) - known_flags.options = &options; - expect(encode(99)); - - // Test 4 (brute-force test some valid dictionary sizes) - options.dictionary_size = LZMA_DICTIONARY_SIZE_MIN; - while (options.dictionary_size != LZMA_DICTIONARY_SIZE_MAX) { - if (++options.dictionary_size == 5000) - options.dictionary_size = LZMA_DICTIONARY_SIZE_MAX - 5; - - expect(!encode(4)); - expect(!decode(4)); - validate_lzma(); - - free(decoded_flags.options); - } - - // Test 5 (too big dictionary size) - options.dictionary_size = LZMA_DICTIONARY_SIZE_MAX + 1; - expect(encode(99)); - - // Test 6 (brute-force test lc/lp/pb) - options.dictionary_size = LZMA_DICTIONARY_SIZE_MIN; - for (uint32_t lc = LZMA_LITERAL_CONTEXT_BITS_MIN; - lc <= LZMA_LITERAL_CONTEXT_BITS_MAX; ++lc) { - for (uint32_t lp = LZMA_LITERAL_POS_BITS_MIN; - lp <= LZMA_LITERAL_POS_BITS_MAX; ++lp) { - for (uint32_t pb = LZMA_POS_BITS_MIN; - pb <= LZMA_POS_BITS_MAX; ++pb) { - if (lc + lp > LZMA_LITERAL_BITS_MAX) - continue; - - options.literal_context_bits = lc; - options.literal_pos_bits = lp; - options.pos_bits = pb; - - expect(!encode(4)); - expect(!decode(4)); - validate_lzma(); - - free(decoded_flags.options); - } - } - } -} -#endif -*/ - -int -main(void) -{ -#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86) - test_bcj(); -#endif -#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA) - test_delta(); -#endif -// #ifdef HAVE_FILTER_LZMA -// test_lzma(); -// #endif - - lzma_end(&strm); - - return 0; -} diff --git a/xz/xz-5.2.2/tests/test_index.c b/xz/xz-5.2.2/tests/test_index.c deleted file mode 100644 index 06b4d6ba99..0000000000 --- a/xz/xz-5.2.2/tests/test_index.c +++ /dev/null @@ -1,659 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file test_index.c -/// \brief Tests functions handling the lzma_index structure -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tests.h" - -#define MEMLIMIT (LZMA_VLI_C(1) << 20) - -#define SMALL_COUNT 3 -#define BIG_COUNT 5555 - - -static lzma_index * -create_empty(void) -{ - lzma_index *i = lzma_index_init(NULL); - expect(i != NULL); - return i; -} - - -static lzma_index * -create_small(void) -{ - lzma_index *i = lzma_index_init(NULL); - expect(i != NULL); - expect(lzma_index_append(i, NULL, 101, 555) == LZMA_OK); - expect(lzma_index_append(i, NULL, 602, 777) == LZMA_OK); - expect(lzma_index_append(i, NULL, 804, 999) == LZMA_OK); - return i; -} - - -static lzma_index * -create_big(void) -{ - lzma_index *i = lzma_index_init(NULL); - expect(i != NULL); - - lzma_vli total_size = 0; - lzma_vli uncompressed_size = 0; - - // Add pseudo-random sizes (but always the same size values). - uint32_t n = 11; - for (size_t j = 0; j < BIG_COUNT; ++j) { - n = 7019 * n + 7607; - const uint32_t t = n * 3011; - expect(lzma_index_append(i, NULL, t, n) == LZMA_OK); - total_size += (t + 3) & ~LZMA_VLI_C(3); - uncompressed_size += n; - } - - expect(lzma_index_block_count(i) == BIG_COUNT); - expect(lzma_index_total_size(i) == total_size); - expect(lzma_index_uncompressed_size(i) == uncompressed_size); - expect(lzma_index_total_size(i) + lzma_index_size(i) - + 2 * LZMA_STREAM_HEADER_SIZE - == lzma_index_stream_size(i)); - - return i; -} - - -static bool -is_equal(const lzma_index *a, const lzma_index *b) -{ - // Compare only the Stream and Block sizes and offsets. - lzma_index_iter ra, rb; - lzma_index_iter_init(&ra, a); - lzma_index_iter_init(&rb, b); - - while (true) { - bool reta = lzma_index_iter_next(&ra, LZMA_INDEX_ITER_ANY); - bool retb = lzma_index_iter_next(&rb, LZMA_INDEX_ITER_ANY); - if (reta) - return !(reta ^ retb); - - if (ra.stream.number != rb.stream.number - || ra.stream.block_count - != rb.stream.block_count - || ra.stream.compressed_offset - != rb.stream.compressed_offset - || ra.stream.uncompressed_offset - != rb.stream.uncompressed_offset - || ra.stream.compressed_size - != rb.stream.compressed_size - || ra.stream.uncompressed_size - != rb.stream.uncompressed_size - || ra.stream.padding - != rb.stream.padding) - return false; - - if (ra.stream.block_count == 0) - continue; - - if (ra.block.number_in_file != rb.block.number_in_file - || ra.block.compressed_file_offset - != rb.block.compressed_file_offset - || ra.block.uncompressed_file_offset - != rb.block.uncompressed_file_offset - || ra.block.number_in_stream - != rb.block.number_in_stream - || ra.block.compressed_stream_offset - != rb.block.compressed_stream_offset - || ra.block.uncompressed_stream_offset - != rb.block.uncompressed_stream_offset - || ra.block.uncompressed_size - != rb.block.uncompressed_size - || ra.block.unpadded_size - != rb.block.unpadded_size - || ra.block.total_size - != rb.block.total_size) - return false; - } -} - - -static void -test_equal(void) -{ - lzma_index *a = create_empty(); - lzma_index *b = create_small(); - lzma_index *c = create_big(); - expect(a && b && c); - - expect(is_equal(a, a)); - expect(is_equal(b, b)); - expect(is_equal(c, c)); - - expect(!is_equal(a, b)); - expect(!is_equal(a, c)); - expect(!is_equal(b, c)); - - lzma_index_end(a, NULL); - lzma_index_end(b, NULL); - lzma_index_end(c, NULL); -} - - -static void -test_overflow(void) -{ - // Integer overflow tests - lzma_index *i = create_empty(); - - expect(lzma_index_append(i, NULL, LZMA_VLI_MAX - 5, 1234) - == LZMA_DATA_ERROR); - - // TODO - - lzma_index_end(i, NULL); -} - - -static void -test_copy(const lzma_index *i) -{ - lzma_index *d = lzma_index_dup(i, NULL); - expect(d != NULL); - expect(is_equal(i, d)); - lzma_index_end(d, NULL); -} - - -static void -test_read(lzma_index *i) -{ - lzma_index_iter r; - lzma_index_iter_init(&r, i); - - // Try twice so we see that rewinding works. - for (size_t j = 0; j < 2; ++j) { - lzma_vli total_size = 0; - lzma_vli uncompressed_size = 0; - lzma_vli stream_offset = LZMA_STREAM_HEADER_SIZE; - lzma_vli uncompressed_offset = 0; - uint32_t count = 0; - - while (!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)) { - ++count; - - total_size += r.block.total_size; - uncompressed_size += r.block.uncompressed_size; - - expect(r.block.compressed_file_offset - == stream_offset); - expect(r.block.uncompressed_file_offset - == uncompressed_offset); - - stream_offset += r.block.total_size; - uncompressed_offset += r.block.uncompressed_size; - } - - expect(lzma_index_total_size(i) == total_size); - expect(lzma_index_uncompressed_size(i) == uncompressed_size); - expect(lzma_index_block_count(i) == count); - - lzma_index_iter_rewind(&r); - } -} - - -static void -test_code(lzma_index *i) -{ - const size_t alloc_size = 128 * 1024; - uint8_t *buf = malloc(alloc_size); - expect(buf != NULL); - - // Encode - lzma_stream strm = LZMA_STREAM_INIT; - expect(lzma_index_encoder(&strm, i) == LZMA_OK); - const lzma_vli index_size = lzma_index_size(i); - succeed(coder_loop(&strm, NULL, 0, buf, index_size, - LZMA_STREAM_END, LZMA_RUN)); - - // Decode - lzma_index *d; - expect(lzma_index_decoder(&strm, &d, MEMLIMIT) == LZMA_OK); - expect(d == NULL); - succeed(decoder_loop(&strm, buf, index_size)); - - expect(is_equal(i, d)); - - lzma_index_end(d, NULL); - lzma_end(&strm); - - // Decode with hashing - lzma_index_hash *h = lzma_index_hash_init(NULL, NULL); - expect(h != NULL); - lzma_index_iter r; - lzma_index_iter_init(&r, i); - while (!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)) - expect(lzma_index_hash_append(h, r.block.unpadded_size, - r.block.uncompressed_size) == LZMA_OK); - size_t pos = 0; - while (pos < index_size - 1) - expect(lzma_index_hash_decode(h, buf, &pos, pos + 1) - == LZMA_OK); - expect(lzma_index_hash_decode(h, buf, &pos, pos + 1) - == LZMA_STREAM_END); - - lzma_index_hash_end(h, NULL); - - // Encode buffer - size_t buf_pos = 1; - expect(lzma_index_buffer_encode(i, buf, &buf_pos, index_size) - == LZMA_BUF_ERROR); - expect(buf_pos == 1); - - succeed(lzma_index_buffer_encode(i, buf, &buf_pos, index_size + 1)); - expect(buf_pos == index_size + 1); - - // Decode buffer - buf_pos = 1; - uint64_t memlimit = MEMLIMIT; - expect(lzma_index_buffer_decode(&d, &memlimit, NULL, buf, &buf_pos, - index_size) == LZMA_DATA_ERROR); - expect(buf_pos == 1); - expect(d == NULL); - - succeed(lzma_index_buffer_decode(&d, &memlimit, NULL, buf, &buf_pos, - index_size + 1)); - expect(buf_pos == index_size + 1); - expect(is_equal(i, d)); - - lzma_index_end(d, NULL); - - free(buf); -} - - -static void -test_many(lzma_index *i) -{ - test_copy(i); - test_read(i); - test_code(i); -} - - -static void -test_cat(void) -{ - lzma_index *a, *b, *c; - lzma_index_iter r; - - // Empty Indexes - a = create_empty(); - b = create_empty(); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_block_count(a) == 0); - expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8); - expect(lzma_index_file_size(a) - == 2 * (2 * LZMA_STREAM_HEADER_SIZE + 8)); - lzma_index_iter_init(&r, a); - expect(lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)); - - b = create_empty(); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_block_count(a) == 0); - expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8); - expect(lzma_index_file_size(a) - == 3 * (2 * LZMA_STREAM_HEADER_SIZE + 8)); - - b = create_empty(); - c = create_empty(); - expect(lzma_index_stream_padding(b, 4) == LZMA_OK); - expect(lzma_index_cat(b, c, NULL) == LZMA_OK); - expect(lzma_index_block_count(b) == 0); - expect(lzma_index_stream_size(b) == 2 * LZMA_STREAM_HEADER_SIZE + 8); - expect(lzma_index_file_size(b) - == 2 * (2 * LZMA_STREAM_HEADER_SIZE + 8) + 4); - - expect(lzma_index_stream_padding(a, 8) == LZMA_OK); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_block_count(a) == 0); - expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8); - expect(lzma_index_file_size(a) - == 5 * (2 * LZMA_STREAM_HEADER_SIZE + 8) + 4 + 8); - - expect(lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)); - lzma_index_iter_rewind(&r); - expect(lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)); - lzma_index_end(a, NULL); - - // Small Indexes - a = create_small(); - lzma_vli stream_size = lzma_index_stream_size(a); - lzma_index_iter_init(&r, a); - for (int i = SMALL_COUNT; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - b = create_small(); - expect(lzma_index_stream_padding(a, 4) == LZMA_OK); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_file_size(a) == stream_size * 2 + 4); - expect(lzma_index_stream_size(a) > stream_size); - expect(lzma_index_stream_size(a) < stream_size * 2); - for (int i = SMALL_COUNT; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - lzma_index_iter_rewind(&r); - for (int i = SMALL_COUNT * 2; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - b = create_small(); - c = create_small(); - expect(lzma_index_stream_padding(b, 8) == LZMA_OK); - expect(lzma_index_cat(b, c, NULL) == LZMA_OK); - expect(lzma_index_stream_padding(a, 12) == LZMA_OK); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_file_size(a) == stream_size * 4 + 4 + 8 + 12); - - expect(lzma_index_block_count(a) == SMALL_COUNT * 4); - for (int i = SMALL_COUNT * 2; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - lzma_index_iter_rewind(&r); - for (int i = SMALL_COUNT * 4; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - lzma_index_end(a, NULL); - - // Mix of empty and small - a = create_empty(); - b = create_small(); - expect(lzma_index_stream_padding(a, 4) == LZMA_OK); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - lzma_index_iter_init(&r, a); - for (int i = SMALL_COUNT; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - lzma_index_end(a, NULL); - - // Big Indexes - a = create_big(); - stream_size = lzma_index_stream_size(a); - b = create_big(); - expect(lzma_index_stream_padding(a, 4) == LZMA_OK); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_file_size(a) == stream_size * 2 + 4); - expect(lzma_index_stream_size(a) > stream_size); - expect(lzma_index_stream_size(a) < stream_size * 2); - - b = create_big(); - c = create_big(); - expect(lzma_index_stream_padding(b, 8) == LZMA_OK); - expect(lzma_index_cat(b, c, NULL) == LZMA_OK); - expect(lzma_index_stream_padding(a, 12) == LZMA_OK); - expect(lzma_index_cat(a, b, NULL) == LZMA_OK); - expect(lzma_index_file_size(a) == stream_size * 4 + 4 + 8 + 12); - - lzma_index_iter_init(&r, a); - for (int i = BIG_COUNT * 4; i >= 0; --i) - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK) - ^ (i == 0)); - - lzma_index_end(a, NULL); -} - - -static void -test_locate(void) -{ - lzma_index *i = lzma_index_init(NULL); - expect(i != NULL); - lzma_index_iter r; - lzma_index_iter_init(&r, i); - - // Cannot locate anything from an empty Index. - expect(lzma_index_iter_locate(&r, 0)); - expect(lzma_index_iter_locate(&r, 555)); - - // One empty Record: nothing is found since there's no uncompressed - // data. - expect(lzma_index_append(i, NULL, 16, 0) == LZMA_OK); - expect(lzma_index_iter_locate(&r, 0)); - - // Non-empty Record and we can find something. - expect(lzma_index_append(i, NULL, 32, 5) == LZMA_OK); - expect(!lzma_index_iter_locate(&r, 0)); - expect(r.block.total_size == 32); - expect(r.block.uncompressed_size == 5); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 16); - expect(r.block.uncompressed_file_offset == 0); - - // Still cannot find anything past the end. - expect(lzma_index_iter_locate(&r, 5)); - - // Add the third Record. - expect(lzma_index_append(i, NULL, 40, 11) == LZMA_OK); - - expect(!lzma_index_iter_locate(&r, 0)); - expect(r.block.total_size == 32); - expect(r.block.uncompressed_size == 5); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 16); - expect(r.block.uncompressed_file_offset == 0); - - expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)); - expect(r.block.total_size == 40); - expect(r.block.uncompressed_size == 11); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 16 + 32); - expect(r.block.uncompressed_file_offset == 5); - - expect(!lzma_index_iter_locate(&r, 2)); - expect(r.block.total_size == 32); - expect(r.block.uncompressed_size == 5); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 16); - expect(r.block.uncompressed_file_offset == 0); - - expect(!lzma_index_iter_locate(&r, 5)); - expect(r.block.total_size == 40); - expect(r.block.uncompressed_size == 11); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 16 + 32); - expect(r.block.uncompressed_file_offset == 5); - - expect(!lzma_index_iter_locate(&r, 5 + 11 - 1)); - expect(r.block.total_size == 40); - expect(r.block.uncompressed_size == 11); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 16 + 32); - expect(r.block.uncompressed_file_offset == 5); - - expect(lzma_index_iter_locate(&r, 5 + 11)); - expect(lzma_index_iter_locate(&r, 5 + 15)); - - // Large Index - lzma_index_end(i, NULL); - i = lzma_index_init(NULL); - expect(i != NULL); - lzma_index_iter_init(&r, i); - - for (size_t n = 4; n <= 4 * 5555; n += 4) - expect(lzma_index_append(i, NULL, n + 8, n) == LZMA_OK); - - expect(lzma_index_block_count(i) == 5555); - - // First Record - expect(!lzma_index_iter_locate(&r, 0)); - expect(r.block.total_size == 4 + 8); - expect(r.block.uncompressed_size == 4); - expect(r.block.compressed_file_offset == LZMA_STREAM_HEADER_SIZE); - expect(r.block.uncompressed_file_offset == 0); - - expect(!lzma_index_iter_locate(&r, 3)); - expect(r.block.total_size == 4 + 8); - expect(r.block.uncompressed_size == 4); - expect(r.block.compressed_file_offset == LZMA_STREAM_HEADER_SIZE); - expect(r.block.uncompressed_file_offset == 0); - - // Second Record - expect(!lzma_index_iter_locate(&r, 4)); - expect(r.block.total_size == 2 * 4 + 8); - expect(r.block.uncompressed_size == 2 * 4); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + 4 + 8); - expect(r.block.uncompressed_file_offset == 4); - - // Last Record - expect(!lzma_index_iter_locate( - &r, lzma_index_uncompressed_size(i) - 1)); - expect(r.block.total_size == 4 * 5555 + 8); - expect(r.block.uncompressed_size == 4 * 5555); - expect(r.block.compressed_file_offset == lzma_index_total_size(i) - + LZMA_STREAM_HEADER_SIZE - 4 * 5555 - 8); - expect(r.block.uncompressed_file_offset - == lzma_index_uncompressed_size(i) - 4 * 5555); - - // Allocation chunk boundaries. See INDEX_GROUP_SIZE in - // liblzma/common/index.c. - const size_t group_multiple = 256 * 4; - const size_t radius = 8; - const size_t start = group_multiple - radius; - lzma_vli ubase = 0; - lzma_vli tbase = 0; - size_t n; - for (n = 1; n < start; ++n) { - ubase += n * 4; - tbase += n * 4 + 8; - } - - while (n < start + 2 * radius) { - expect(!lzma_index_iter_locate(&r, ubase + n * 4)); - - expect(r.block.compressed_file_offset == tbase + n * 4 + 8 - + LZMA_STREAM_HEADER_SIZE); - expect(r.block.uncompressed_file_offset == ubase + n * 4); - - tbase += n * 4 + 8; - ubase += n * 4; - ++n; - - expect(r.block.total_size == n * 4 + 8); - expect(r.block.uncompressed_size == n * 4); - } - - // Do it also backwards. - while (n > start) { - expect(!lzma_index_iter_locate(&r, ubase + (n - 1) * 4)); - - expect(r.block.total_size == n * 4 + 8); - expect(r.block.uncompressed_size == n * 4); - - --n; - tbase -= n * 4 + 8; - ubase -= n * 4; - - expect(r.block.compressed_file_offset == tbase + n * 4 + 8 - + LZMA_STREAM_HEADER_SIZE); - expect(r.block.uncompressed_file_offset == ubase + n * 4); - } - - // Test locating in concatenated Index. - lzma_index_end(i, NULL); - i = lzma_index_init(NULL); - expect(i != NULL); - lzma_index_iter_init(&r, i); - for (n = 0; n < group_multiple; ++n) - expect(lzma_index_append(i, NULL, 8, 0) == LZMA_OK); - expect(lzma_index_append(i, NULL, 16, 1) == LZMA_OK); - expect(!lzma_index_iter_locate(&r, 0)); - expect(r.block.total_size == 16); - expect(r.block.uncompressed_size == 1); - expect(r.block.compressed_file_offset - == LZMA_STREAM_HEADER_SIZE + group_multiple * 8); - expect(r.block.uncompressed_file_offset == 0); - - lzma_index_end(i, NULL); -} - - -static void -test_corrupt(void) -{ - const size_t alloc_size = 128 * 1024; - uint8_t *buf = malloc(alloc_size); - expect(buf != NULL); - lzma_stream strm = LZMA_STREAM_INIT; - - lzma_index *i = create_empty(); - expect(lzma_index_append(i, NULL, 0, 1) == LZMA_PROG_ERROR); - lzma_index_end(i, NULL); - - // Create a valid Index and corrupt it in different ways. - i = create_small(); - expect(lzma_index_encoder(&strm, i) == LZMA_OK); - succeed(coder_loop(&strm, NULL, 0, buf, 20, - LZMA_STREAM_END, LZMA_RUN)); - lzma_index_end(i, NULL); - - // Wrong Index Indicator - buf[0] ^= 1; - expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK); - succeed(decoder_loop_ret(&strm, buf, 1, LZMA_DATA_ERROR)); - buf[0] ^= 1; - - // Wrong Number of Records and thus CRC32 fails. - --buf[1]; - expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK); - succeed(decoder_loop_ret(&strm, buf, 10, LZMA_DATA_ERROR)); - ++buf[1]; - - // Padding not NULs - buf[15] ^= 1; - expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK); - succeed(decoder_loop_ret(&strm, buf, 16, LZMA_DATA_ERROR)); - - lzma_end(&strm); - free(buf); -} - - -int -main(void) -{ - test_equal(); - - test_overflow(); - - lzma_index *i = create_empty(); - test_many(i); - lzma_index_end(i, NULL); - - i = create_small(); - test_many(i); - lzma_index_end(i, NULL); - - i = create_big(); - test_many(i); - lzma_index_end(i, NULL); - - test_cat(); - - test_locate(); - - test_corrupt(); - - return 0; -} diff --git a/xz/xz-5.2.2/tests/test_scripts.sh b/xz/xz-5.2.2/tests/test_scripts.sh deleted file mode 100755 index 48a9308a2d..0000000000 --- a/xz/xz-5.2.2/tests/test_scripts.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh - -############################################################################### -# -# Author: Jonathan Nieder -# -# This file has been put into the public domain. -# You can do whatever you want with this file. -# -############################################################################### - -# If scripts weren't built, this test is skipped. -XZ=../src/xz/xz -XZDIFF=../src/scripts/xzdiff -XZGREP=../src/scripts/xzgrep - -for i in XZ XZDIFF XZGREP; do - eval test -x "\$$i" && continue - (exit 77) - exit 77 -done - -PATH=`pwd`/../src/xz:$PATH -export PATH - -test -z "$srcdir" && srcdir=. -preimage=$srcdir/files/good-1-check-crc32.xz -samepostimage=$srcdir/files/good-1-check-crc64.xz -otherpostimage=$srcdir/files/good-1-lzma2-1.xz - -"$XZDIFF" "$preimage" "$samepostimage" >/dev/null -status=$? -if test "$status" != 0 ; then - echo "xzdiff with no changes exited with status $status != 0" - (exit 1) - exit 1 -fi - -"$XZDIFF" "$preimage" "$otherpostimage" >/dev/null -status=$? -if test "$status" != 1 ; then - echo "xzdiff with changes exited with status $status != 1" - (exit 1) - exit 1 -fi - -"$XZDIFF" "$preimage" "$srcdir/files/missing.xz" >/dev/null 2>&1 -status=$? -if test "$status" != 2 ; then - echo "xzdiff with missing operand exited with status $status != 2" - (exit 1) - exit 1 -fi - -# The exit status must be 0 when a match was found at least from one file, -# and 1 when no match was found in any file. -cp "$srcdir/files/good-1-lzma2-1.xz" xzgrep_test_1.xz -cp "$srcdir/files/good-2-lzma2.xz" xzgrep_test_2.xz -for pattern in el Hello NOMATCH; do - for opts in "" "-l" "-h" "-H"; do - echo "=> xzgrep $opts $pattern <=" - "$XZGREP" $opts $pattern xzgrep_test_1.xz xzgrep_test_2.xz - echo retval $? - done -done > xzgrep_test_output 2>&1 - -if cmp -s "$srcdir/xzgrep_expected_output" xzgrep_test_output ; then - : -else - echo "unexpected output from xzgrep" - (exit 1) - exit 1 -fi - -(exit 0) -exit 0 diff --git a/xz/xz-5.2.2/tests/test_stream_flags.c b/xz/xz-5.2.2/tests/test_stream_flags.c deleted file mode 100644 index 9611459e1b..0000000000 --- a/xz/xz-5.2.2/tests/test_stream_flags.c +++ /dev/null @@ -1,180 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file test_stream_flags.c -/// \brief Tests Stream Header and Stream Footer coders -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tests.h" - - -static lzma_stream_flags known_flags; -static lzma_stream_flags decoded_flags; -static uint8_t buffer[LZMA_STREAM_HEADER_SIZE]; - - -static bool -validate(void) -{ - // TODO: This could require the specific error type as an argument. - // We could also test that lzma_stream_flags_compare() gives - // the correct return values in different situations. - return lzma_stream_flags_compare(&known_flags, &decoded_flags) - != LZMA_OK; -} - - -static bool -test_header_decoder(lzma_ret expected_ret) -{ - memcrap(&decoded_flags, sizeof(decoded_flags)); - - if (lzma_stream_header_decode(&decoded_flags, buffer) != expected_ret) - return true; - - if (expected_ret != LZMA_OK) - return false; - - // Header doesn't have Backward Size, so make - // lzma_stream_flags_compare() ignore it. - decoded_flags.backward_size = LZMA_VLI_UNKNOWN; - return validate(); -} - - -static void -test_header(void) -{ - memcrap(buffer, sizeof(buffer)); - expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK); - succeed(test_header_decoder(LZMA_OK)); -} - - -static bool -test_footer_decoder(lzma_ret expected_ret) -{ - memcrap(&decoded_flags, sizeof(decoded_flags)); - - if (lzma_stream_footer_decode(&decoded_flags, buffer) != expected_ret) - return true; - - if (expected_ret != LZMA_OK) - return false; - - return validate(); -} - - -static void -test_footer(void) -{ - memcrap(buffer, sizeof(buffer)); - expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK); - succeed(test_footer_decoder(LZMA_OK)); -} - - -static void -test_encode_invalid(void) -{ - known_flags.check = LZMA_CHECK_ID_MAX + 1; - known_flags.backward_size = 1024; - - expect(lzma_stream_header_encode(&known_flags, buffer) - == LZMA_PROG_ERROR); - - expect(lzma_stream_footer_encode(&known_flags, buffer) - == LZMA_PROG_ERROR); - - known_flags.check = (lzma_check)(-1); - - expect(lzma_stream_header_encode(&known_flags, buffer) - == LZMA_PROG_ERROR); - - expect(lzma_stream_footer_encode(&known_flags, buffer) - == LZMA_PROG_ERROR); - - known_flags.check = LZMA_CHECK_NONE; - known_flags.backward_size = 0; - - // Header encoder ignores backward_size. - expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK); - - expect(lzma_stream_footer_encode(&known_flags, buffer) - == LZMA_PROG_ERROR); - - known_flags.backward_size = LZMA_VLI_MAX; - - expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK); - - expect(lzma_stream_footer_encode(&known_flags, buffer) - == LZMA_PROG_ERROR); -} - - -static void -test_decode_invalid(void) -{ - known_flags.check = LZMA_CHECK_NONE; - known_flags.backward_size = 1024; - - expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK); - - // Test 1 (invalid Magic Bytes) - buffer[5] ^= 1; - succeed(test_header_decoder(LZMA_FORMAT_ERROR)); - buffer[5] ^= 1; - - // Test 2a (valid CRC32) - uint32_t crc = lzma_crc32(buffer + 6, 2, 0); - unaligned_write32le(buffer + 8, crc); - succeed(test_header_decoder(LZMA_OK)); - - // Test 2b (invalid Stream Flags with valid CRC32) - buffer[6] ^= 0x20; - crc = lzma_crc32(buffer + 6, 2, 0); - unaligned_write32le(buffer + 8, crc); - succeed(test_header_decoder(LZMA_OPTIONS_ERROR)); - - // Test 3 (invalid CRC32) - expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK); - buffer[9] ^= 1; - succeed(test_header_decoder(LZMA_DATA_ERROR)); - - // Test 4 (invalid Stream Flags with valid CRC32) - expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK); - buffer[9] ^= 0x40; - crc = lzma_crc32(buffer + 4, 6, 0); - unaligned_write32le(buffer, crc); - succeed(test_footer_decoder(LZMA_OPTIONS_ERROR)); - - // Test 5 (invalid Magic Bytes) - expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK); - buffer[11] ^= 1; - succeed(test_footer_decoder(LZMA_FORMAT_ERROR)); -} - - -int -main(void) -{ - // Valid headers - known_flags.backward_size = 1024; - for (lzma_check check = LZMA_CHECK_NONE; - check <= LZMA_CHECK_ID_MAX; ++check) { - test_header(); - test_footer(); - } - - // Invalid headers - test_encode_invalid(); - test_decode_invalid(); - - return 0; -} diff --git a/xz/xz-5.2.2/tests/tests.h b/xz/xz-5.2.2/tests/tests.h deleted file mode 100644 index 8f3c745d8e..0000000000 --- a/xz/xz-5.2.2/tests/tests.h +++ /dev/null @@ -1,124 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file tests.h -/// \brief Common definitions for test applications -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef LZMA_TESTS_H -#define LZMA_TESTS_H - -#include "sysdefs.h" -#include "tuklib_integer.h" -#include "lzma.h" - -#include - -#define memcrap(buf, size) memset(buf, 0xFD, size) - -#define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%d: %s\n", \ - __FILE__, __LINE__, #test), abort(), 0)) - -#define succeed(test) expect(!(test)) - -#define fail(test) expect(test) - - -static inline const char * -lzma_ret_sym(lzma_ret ret) -{ - if ((unsigned int)(ret) > LZMA_PROG_ERROR) - return "UNKNOWN_ERROR"; - - static const char *msgs[] = { - "LZMA_OK", - "LZMA_STREAM_END", - "LZMA_NO_CHECK", - "LZMA_UNSUPPORTED_CHECK", - "LZMA_GET_CHECK", - "LZMA_MEM_ERROR", - "LZMA_MEMLIMIT_ERROR", - "LZMA_FORMAT_ERROR", - "LZMA_OPTIONS_ERROR", - "LZMA_DATA_ERROR", - "LZMA_BUF_ERROR", - "LZMA_PROG_ERROR" - }; - - return msgs[ret]; -} - - -static inline bool -coder_loop(lzma_stream *strm, uint8_t *in, size_t in_size, - uint8_t *out, size_t out_size, - lzma_ret expected_ret, lzma_action finishing_action) -{ - size_t in_left = in_size; - size_t out_left = out_size > 0 ? out_size + 1 : 0; - lzma_action action = LZMA_RUN; - lzma_ret ret; - - strm->next_in = NULL; - strm->avail_in = 0; - strm->next_out = NULL; - strm->avail_out = 0; - - while (true) { - if (in_left > 0) { - if (--in_left == 0) - action = finishing_action; - - strm->next_in = in++; - strm->avail_in = 1; - } - - if (out_left > 0) { - --out_left; - strm->next_out = out++; - strm->avail_out = 1; - } - - ret = lzma_code(strm, action); - if (ret != LZMA_OK) - break; - } - - bool error = false; - - if (ret != expected_ret) - error = true; - - if (expected_ret == LZMA_STREAM_END) { - if (strm->total_in != in_size || strm->total_out != out_size) - error = true; - } else { - if (strm->total_in != in_size || strm->total_out != out_size) - error = true; - } - - return error; -} - - -static inline bool -decoder_loop_ret(lzma_stream *strm, uint8_t *in, size_t in_size, - lzma_ret expected_ret) -{ - return coder_loop(strm, in, in_size, NULL, 0, expected_ret, LZMA_RUN); -} - - -static inline bool -decoder_loop(lzma_stream *strm, uint8_t *in, size_t in_size) -{ - return coder_loop(strm, in, in_size, NULL, 0, - LZMA_STREAM_END, LZMA_RUN); -} - -#endif diff --git a/xz/xz-5.2.2/tests/xzgrep_expected_output b/xz/xz-5.2.2/tests/xzgrep_expected_output deleted file mode 100644 index e531d93160..0000000000 --- a/xz/xz-5.2.2/tests/xzgrep_expected_output +++ /dev/null @@ -1,39 +0,0 @@ -=> xzgrep el <= -xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut -xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu -xzgrep_test_2.xz:Hello -retval 0 -=> xzgrep -l el <= -xzgrep_test_1.xz -xzgrep_test_2.xz -retval 0 -=> xzgrep -h el <= -elit, sed do eiusmod tempor incididunt ut -in voluptate velit esse cillum dolore eu -Hello -retval 0 -=> xzgrep -H el <= -xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut -xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu -xzgrep_test_2.xz:Hello -retval 0 -=> xzgrep Hello <= -xzgrep_test_2.xz:Hello -retval 0 -=> xzgrep -l Hello <= -xzgrep_test_2.xz -retval 0 -=> xzgrep -h Hello <= -Hello -retval 0 -=> xzgrep -H Hello <= -xzgrep_test_2.xz:Hello -retval 0 -=> xzgrep NOMATCH <= -retval 1 -=> xzgrep -l NOMATCH <= -retval 1 -=> xzgrep -h NOMATCH <= -retval 1 -=> xzgrep -H NOMATCH <= -retval 1 diff --git a/zeromq/zeromq-4.1.4/tests/test_abstract_ipc.cpp b/zeromq/zeromq-4.1.4/tests/test_abstract_ipc.cpp deleted file mode 100644 index bb7e9ff19f..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_abstract_ipc.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_DEALER); - assert (sb); - int rc = zmq_bind (sb, "ipc://@tmp-tester"); - assert (rc == 0); - - char endpoint[200]; - size_t size = sizeof(endpoint); - rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &size); - assert (rc == 0); - rc = strncmp(endpoint, "ipc://@tmp-tester", size); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_DEALER); - assert (sc); - rc = zmq_connect (sc, "ipc://@tmp-tester"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_bind_src_address.cpp b/zeromq/zeromq-4.1.4/tests/test_bind_src_address.cpp deleted file mode 100644 index 15a5ab3792..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_bind_src_address.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sock = zmq_socket (ctx, ZMQ_PUB); - assert (sock); - - int rc = zmq_connect (sock, "tcp://127.0.0.1:0;localhost:1234"); - assert (rc == 0); - - rc = zmq_connect (sock, "tcp://localhost:5555;localhost:1235"); - assert (rc == 0); - - rc = zmq_connect (sock, "tcp://lo:5555;localhost:1235"); - assert (rc == 0); - - rc = zmq_close (sock); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_capabilities.cpp b/zeromq/zeromq-4.1.4/tests/test_capabilities.cpp deleted file mode 100644 index f31881646b..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_capabilities.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ -#if !defined (ZMQ_HAVE_WINDOWS) && !defined (ZMQ_HAVE_OPENVMS) - assert (zmq_has ("ipc")); -#else - assert (!zmq_has ("ipc")); -#endif - -#if defined (ZMQ_HAVE_OPENPGM) - assert (zmq_has ("pgm")); -#else - assert (!zmq_has ("pgm")); -#endif - -#if defined (ZMQ_HAVE_TIPC) - assert (zmq_has ("tipc")); -#else - assert (!zmq_has ("tipc")); -#endif - -#if defined (ZMQ_HAVE_NORM) - assert (zmq_has ("norm")); -#else - assert (!zmq_has ("norm")); -#endif - -#if defined (HAVE_LIBSODIUM) - assert (zmq_has ("curve")); -#else - assert (!zmq_has ("curve")); -#endif - -#if defined (HAVE_LIBGSSAPI_KRB5) - assert (zmq_has ("gssapi")); -#else - assert (!zmq_has ("gssapi")); -#endif - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_conflate.cpp b/zeromq/zeromq-4.1.4/tests/test_conflate.cpp deleted file mode 100644 index 9acb7cb58a..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_conflate.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (int, char *[]) -{ - const char *bind_to = "tcp://127.0.0.1:5555"; - - int rc; - - void* ctx = zmq_init (1); - assert (ctx); - - void* s_in = zmq_socket (ctx, ZMQ_PULL); - assert (s_in); - - int conflate = 1; - rc = zmq_setsockopt (s_in, ZMQ_CONFLATE, &conflate, sizeof(conflate)); - assert (rc == 0); - - rc = zmq_bind (s_in, bind_to); - assert (rc == 0); - - void* s_out = zmq_socket (ctx, ZMQ_PUSH); - assert (s_out); - - rc = zmq_connect (s_out, bind_to); - assert (rc == 0); - - int message_count = 20; - for (int j = 0; j < message_count; ++j) { - rc = zmq_send(s_out, (void*)&j, sizeof(int), 0); - if (rc < 0) { - printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno)); - return -1; - } - } - msleep (SETTLE_TIME); - - int payload_recved = 0; - rc = zmq_recv (s_in, (void*)&payload_recved, sizeof(int), 0); - assert (rc > 0); - assert (payload_recved == message_count - 1); - - rc = zmq_close (s_in); - assert (rc == 0); - - rc = zmq_close (s_out); - assert (rc == 0); - - rc = zmq_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_connect_delay_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_connect_delay_tipc.cpp deleted file mode 100644 index 1c455d5c30..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_connect_delay_tipc.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "../include/zmq.h" -#include -#include -#include -#include -#include - -#undef NDEBUG -#include - -#include "testutil.hpp" - -int main (void) -{ - int val; - int rc; - char buffer[16]; - // TEST 1. - // First we're going to attempt to send messages to two - // pipes, one connected, the other not. We should see - // the PUSH load balancing to both pipes, and hence half - // of the messages getting queued, as connect() creates a - // pipe immediately. - - void *context = zmq_ctx_new(); - assert (context); - void *to = zmq_socket(context, ZMQ_PULL); - assert (to); - - // Bind the one valid receiver - val = 0; - rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val)); - assert (rc == 0); - rc = zmq_bind (to, "tipc://{6555,0,0}"); - assert (rc == 0); - - // Create a socket pushing to two endpoints - only 1 message should arrive. - void *from = zmq_socket (context, ZMQ_PUSH); - assert(from); - - val = 0; - zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof (val)); - // This pipe will not connect - rc = zmq_connect (from, "tipc://{5556,0}"); - assert (rc == 0); - // This pipe will - rc = zmq_connect (from, "tipc://{6555,0}"); - assert (rc == 0); - - // We send 10 messages, 5 should just get stuck in the queue - // for the not-yet-connected pipe - for (int i = 0; i < 10; ++i) { - rc = zmq_send (from, "Hello", 5, 0); - assert (rc == 5); - } - - // We now consume from the connected pipe - // - we should see just 5 - int timeout = 250; - rc = zmq_setsockopt (to, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - int seen = 0; - while (true) { - rc = zmq_recv (to, &buffer, sizeof (buffer), 0); - if (rc == -1) - break; // Break when we didn't get a message - seen++; - } - assert (seen == 5); - - rc = zmq_close (from); - assert (rc == 0); - - rc = zmq_close (to); - assert (rc == 0); - - rc = zmq_term (context); - assert (rc == 0); - - // TEST 2 - // This time we will do the same thing, connect two pipes, - // one of which will succeed in connecting to a bound - // receiver, the other of which will fail. However, we will - // also set the delay attach on connect flag, which should - // cause the pipe attachment to be delayed until the connection - // succeeds. - context = zmq_ctx_new(); - - // Bind the valid socket - to = zmq_socket (context, ZMQ_PULL); - assert (to); - rc = zmq_bind (to, "tipc://{5560,0,0}"); - assert (rc == 0); - - val = 0; - rc = zmq_setsockopt (to, ZMQ_LINGER, &val, sizeof(val)); - assert (rc == 0); - - // Create a socket pushing to two endpoints - all messages should arrive. - from = zmq_socket (context, ZMQ_PUSH); - assert (from); - - val = 0; - rc = zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val)); - assert (rc == 0); - - // Set the key flag - val = 1; - rc = zmq_setsockopt (from, ZMQ_DELAY_ATTACH_ON_CONNECT, &val, sizeof(val)); - assert (rc == 0); - - // Connect to the invalid socket - rc = zmq_connect (from, "tipc://{5561,0}"); - assert (rc == 0); - // Connect to the valid socket - rc = zmq_connect (from, "tipc://{5560,0}"); - assert (rc == 0); - - // Send 10 messages, all should be routed to the connected pipe - for (int i = 0; i < 10; ++i) { - rc = zmq_send (from, "Hello", 5, 0); - assert (rc == 5); - } - rc = zmq_setsockopt (to, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - seen = 0; - while (true) { - rc = zmq_recv (to, &buffer, sizeof (buffer), 0); - if (rc == -1) - break; // Break when we didn't get a message - seen++; - } - assert (seen == 10); - - rc = zmq_close (from); - assert (rc == 0); - - rc = zmq_close (to); - assert (rc == 0); - - rc = zmq_term (context); - assert (rc == 0); - - // TEST 3 - // This time we want to validate that the same blocking behaviour - // occurs with an existing connection that is broken. We will send - // messages to a connected pipe, disconnect and verify the messages - // block. Then we reconnect and verify messages flow again. - context = zmq_ctx_new (); - - void *backend = zmq_socket (context, ZMQ_DEALER); - assert (backend); - void *frontend = zmq_socket (context, ZMQ_DEALER); - assert (frontend); - int zero = 0; - rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_setsockopt (frontend, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - - // Frontend connects to backend using DELAY_ATTACH_ON_CONNECT - int on = 1; - rc = zmq_setsockopt (frontend, ZMQ_DELAY_ATTACH_ON_CONNECT, &on, sizeof (on)); - assert (rc == 0); - rc = zmq_bind (backend, "tipc://{5560,0,0}"); - assert (rc == 0); - rc = zmq_connect (frontend, "tipc://{5560,0}"); - assert (rc == 0); - - // Ping backend to frontend so we know when the connection is up - rc = zmq_send (backend, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (frontend, buffer, 255, 0); - assert (rc == 5); - - // Send message from frontend to backend - rc = zmq_send (frontend, "Hello", 5, ZMQ_DONTWAIT); - assert (rc == 5); - - rc = zmq_close (backend); - assert (rc == 0); - - // Give time to process disconnect - msleep (SETTLE_TIME); - - // Send a message, should fail - rc = zmq_send (frontend, "Hello", 5, ZMQ_DONTWAIT); - assert (rc == -1); - - // Recreate backend socket - backend = zmq_socket (context, ZMQ_DEALER); - assert (backend); - rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_bind (backend, "tipc://{5560,0,0}"); - assert (rc == 0); - - // Ping backend to frontend so we know when the connection is up - rc = zmq_send (backend, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (frontend, buffer, 255, 0); - assert (rc == 5); - - // After the reconnect, should succeed - rc = zmq_send (frontend, "Hello", 5, ZMQ_DONTWAIT); - assert (rc == 5); - - rc = zmq_close (backend); - assert (rc == 0); - - rc = zmq_close (frontend); - assert (rc == 0); - - rc = zmq_term (context); - assert (rc == 0); -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_connect_resolve.cpp b/zeromq/zeromq-4.1.4/tests/test_connect_resolve.cpp deleted file mode 100644 index cb5353fbed..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_connect_resolve.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sock = zmq_socket (ctx, ZMQ_PUB); - assert (sock); - - int rc = zmq_connect (sock, "tcp://localhost:1234"); - assert (rc == 0); - - rc = zmq_connect (sock, "tcp://[::1]:4506"); - assert (rc == 0); - - rc = zmq_connect (sock, "tcp://localhost:invalid"); - assert (rc == -1); - - rc = zmq_connect (sock, "tcp://in val id:1234"); - assert (rc == -1); - - rc = zmq_connect (sock, "tcp://"); - assert (rc == -1); - - rc = zmq_connect (sock, "tcp://192.168.0.200:*"); - assert (rc == -1); - - rc = zmq_connect (sock, "invalid://localhost:1234"); - assert (rc == -1); - assert (errno == EPROTONOSUPPORT); - - rc = zmq_close (sock); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_connect_rid.cpp b/zeromq/zeromq-4.1.4/tests/test_connect_rid.cpp deleted file mode 100644 index 827e4375a0..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_connect_rid.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - - -void test_stream_2_stream(){ - void *rbind, *rconn1; - int ret; - char buff[256]; - char msg[] = "hi 1"; - const char *bindip = "tcp://127.0.0.1:5556"; - int zero = 0; - void *ctx = zmq_ctx_new (); - - // Set up listener STREAM. - rbind = zmq_socket (ctx, ZMQ_STREAM); - assert (rbind); - ret = zmq_setsockopt (rbind, ZMQ_LINGER, &zero, sizeof (zero)); - assert (0 == ret); - ret = zmq_bind (rbind, bindip); - assert(0 == ret); - - // Set up connection stream. - rconn1 = zmq_socket (ctx, ZMQ_STREAM); - assert (rconn1); - ret = zmq_setsockopt (rconn1, ZMQ_LINGER, &zero, sizeof (zero)); - assert (0 == ret); - - // Do the connection. - ret = zmq_setsockopt (rconn1, ZMQ_CONNECT_RID, "conn1", 6); - assert (0 == ret); - ret = zmq_connect (rconn1, bindip); - -/* Uncomment to test assert on duplicate rid. - // Test duplicate connect attempt. - ret = zmq_setsockopt (rconn1, ZMQ_CONNECT_RID, "conn1", 6); - assert (0 == ret); - ret = zmq_connect (rconn1, bindip); - assert (0 == ret); -*/ - // Send data to the bound stream. - ret = zmq_send (rconn1, "conn1", 6, ZMQ_SNDMORE); - assert (6 == ret); - ret = zmq_send (rconn1, msg, 5, 0); - assert (5 == ret); - - // Accept data on the bound stream. - ret = zmq_recv (rbind, buff, 256, 0); - assert (ret && 0 == buff[0]); - assert (0 == buff[0]); - ret = zmq_recv (rbind, buff, 256, 0); - assert (0 == ret); - - // Handle close of the socket. - ret = zmq_recv (rbind, buff, 256, 0); - assert (ret); - assert (0 == buff[0]); - ret = zmq_recv (rbind, buff+128, 128, 0); - assert (5 == ret); - assert ('h' == buff[128]); - - ret = zmq_unbind (rbind, bindip); - assert(0 == ret); - ret = zmq_close (rbind); - assert(0 == ret); - ret = zmq_close (rconn1); - assert(0 == ret); - - zmq_ctx_destroy (ctx); -} - -void test_router_2_router(bool named){ - void *rbind, *rconn1; - int ret; - char buff[256]; - char msg[] = "hi 1"; - const char *bindip = "tcp://127.0.0.1:5556"; - int zero = 0; - void *ctx = zmq_ctx_new (); - - // Create bind socket. - rbind = zmq_socket (ctx, ZMQ_ROUTER); - assert (rbind); - ret = zmq_setsockopt (rbind, ZMQ_LINGER, &zero, sizeof (zero)); - assert (0 == ret); - ret = zmq_bind (rbind, bindip); - assert (0 == ret); - - // Create connection socket. - rconn1 = zmq_socket (ctx, ZMQ_ROUTER); - assert (rconn1); - ret = zmq_setsockopt (rconn1, ZMQ_LINGER, &zero, sizeof (zero)); - assert (0 == ret); - - // If we're in named mode, set some identities. - if (named) { - ret = zmq_setsockopt (rbind, ZMQ_IDENTITY, "X", 1); - ret = zmq_setsockopt (rconn1, ZMQ_IDENTITY, "Y", 1); - } - - // Make call to connect using a connect_rid. - ret = zmq_setsockopt (rconn1, ZMQ_CONNECT_RID, "conn1", 6); - assert (0 == ret); - ret = zmq_connect (rconn1, bindip); - assert (0 == ret); -/* Uncomment to test assert on duplicate rid - // Test duplicate connect attempt. - ret = zmq_setsockopt (rconn1, ZMQ_CONNECT_RID, "conn1", 6); - assert (0 == ret); - ret = zmq_connect (rconn1, bindip); - assert (0 == ret); -*/ - // Send some data. - ret = zmq_send (rconn1, "conn1", 6, ZMQ_SNDMORE); - assert (6 == ret); - ret = zmq_send (rconn1, msg, 5, 0); - assert (5 == ret); - - // Receive the name. - ret = zmq_recv (rbind, buff, 256, 0); - if (named) - assert (ret && 'Y' == buff[0]); - else - assert (ret && 0 == buff[0]); - - // Receive the data. - ret = zmq_recv (rbind, buff+128, 128, 0); - assert(5 == ret && 'h' == buff[128]); - - // Send some data back. - if (named) { - ret = zmq_send (rbind, buff, 1, ZMQ_SNDMORE); - assert (1 == ret); - } - else { - ret = zmq_send (rbind, buff, 5, ZMQ_SNDMORE); - assert (5 == ret); - } - ret = zmq_send_const (rbind, "ok", 3, 0); - assert (3 == ret); - - // If bound socket identity naming a problem, we'll likely see something funky here. - ret = zmq_recv (rconn1, buff, 256, 0); - assert ('c' == buff[0] && 6 == ret); - ret = zmq_recv (rconn1, buff+128, 128, 0); - assert (3 == ret && 'o' == buff[128]); - - ret = zmq_unbind (rbind, bindip); - assert(0 == ret); - ret = zmq_close (rbind); - assert(0 == ret); - ret = zmq_close (rconn1); - assert(0 == ret); - - zmq_ctx_destroy (ctx); -} - -int main (void) -{ - setup_test_environment (); - - test_stream_2_stream (); - test_router_2_router (false); - test_router_2_router (true); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_ctx_destroy.cpp b/zeromq/zeromq-4.1.4/tests/test_ctx_destroy.cpp deleted file mode 100644 index 5152c71338..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_ctx_destroy.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -static void receiver (void *socket) -{ - char buffer[16]; - int rc = zmq_recv (socket, &buffer, sizeof (buffer), 0); - assert(rc == -1); -} - -void test_ctx_destroy() -{ - int rc; - - // Set up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *socket = zmq_socket (ctx, ZMQ_PULL); - assert (socket); - - // Close the socket - rc = zmq_close (socket); - assert (rc == 0); - - // Destroy the context - rc = zmq_ctx_destroy (ctx); - assert (rc == 0); -} - -void test_ctx_shutdown() -{ - int rc; - - // Set up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *socket = zmq_socket (ctx, ZMQ_PULL); - assert (socket); - - // Spawn a thread to receive on socket - void *receiver_thread = zmq_threadstart (&receiver, socket); - - // Wait for thread to start up and block - msleep (SETTLE_TIME); - - // Shutdown context, if we used destroy here we would deadlock. - rc = zmq_ctx_shutdown (ctx); - assert (rc == 0); - - // Wait for thread to finish - zmq_threadclose (receiver_thread); - - // Close the socket. - rc = zmq_close (socket); - assert (rc == 0); - - // Destory the context, will now not hang as we have closed the socket. - rc = zmq_ctx_destroy (ctx); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - - test_ctx_destroy(); - test_ctx_shutdown(); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_ctx_options.cpp b/zeromq/zeromq-4.1.4/tests/test_ctx_options.cpp deleted file mode 100644 index a84ef0493e..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_ctx_options.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - int rc; - - // Set up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - assert (zmq_ctx_get (ctx, ZMQ_MAX_SOCKETS) == ZMQ_MAX_SOCKETS_DFLT); -#if defined(ZMQ_USE_SELECT) - assert (zmq_ctx_get (ctx, ZMQ_SOCKET_LIMIT) == FD_SETSIZE - 1); -#elif defined(ZMQ_USE_POLL) || defined(ZMQ_USE_EPOLL) \ - || defined(ZMQ_USE_DEVPOLL) || defined(ZMQ_USE_KQUEUE) - assert (zmq_ctx_get (ctx, ZMQ_SOCKET_LIMIT) == 65535); -#endif - assert (zmq_ctx_get (ctx, ZMQ_IO_THREADS) == ZMQ_IO_THREADS_DFLT); - assert (zmq_ctx_get (ctx, ZMQ_IPV6) == 0); - - rc = zmq_ctx_set (ctx, ZMQ_IPV6, true); - assert (zmq_ctx_get (ctx, ZMQ_IPV6) == 1); - - void *router = zmq_socket (ctx, ZMQ_ROUTER); - int ipv6; - size_t optsize = sizeof (int); - rc = zmq_getsockopt (router, ZMQ_IPV6, &ipv6, &optsize); - assert (rc == 0); - assert (ipv6); - - rc = zmq_close (router); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_diffserv.cpp b/zeromq/zeromq-4.1.4/tests/test_diffserv.cpp deleted file mode 100644 index accee26aa9..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_diffserv.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - int rc; - int tos = 0x28; - int o_tos; - size_t tos_size = sizeof(tos); - - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PAIR); - assert (sb); - rc = zmq_setsockopt (sb, ZMQ_TOS, &tos, tos_size); - assert (rc == 0); - rc = zmq_bind (sb, "tcp://127.0.0.1:5560"); - assert (rc == 0); - rc = zmq_getsockopt (sb, ZMQ_TOS, &o_tos, &tos_size); - assert (rc == 0); - assert (o_tos == tos); - - void *sc = zmq_socket (ctx, ZMQ_PAIR); - assert (sc); - tos = 0x58; - rc = zmq_setsockopt (sc, ZMQ_TOS, &tos, tos_size); - assert (rc == 0); - rc = zmq_connect (sc, "tcp://127.0.0.1:5560"); - assert (rc == 0); - rc = zmq_getsockopt (sc, ZMQ_TOS, &o_tos, &tos_size); - assert (rc == 0); - assert (o_tos == tos); - - // Wireshark can be used to verify that the server socket is - // using DSCP 0x28 in packets to the client while the client - // is using 0x58 in packets to the server. - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; - -} diff --git a/zeromq/zeromq-4.1.4/tests/test_disconnect_inproc.cpp b/zeromq/zeromq-4.1.4/tests/test_disconnect_inproc.cpp deleted file mode 100644 index 28eacf8fce..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_disconnect_inproc.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -/// Initialize a zeromq message with a given null-terminated string -#define ZMQ_PREPARE_STRING(msg, data, size) \ -zmq_msg_init(&msg) && printf("zmq_msg_init: %s\n", zmq_strerror(errno)); \ -zmq_msg_init_size (&msg, size + 1) && printf("zmq_msg_init_size: %s\n",zmq_strerror(errno)); \ -memcpy(zmq_msg_data(&msg), data, size + 1); - -int publicationsReceived = 0; -bool isSubscribed = false; - -int main(int, char**) { - setup_test_environment(); - void* context = zmq_ctx_new(); - void* pubSocket; - void* subSocket; - - (pubSocket = zmq_socket(context, ZMQ_XPUB)) || printf("zmq_socket: %s\n", zmq_strerror(errno)); - (subSocket = zmq_socket(context, ZMQ_SUB)) || printf("zmq_socket: %s\n", zmq_strerror(errno)); - zmq_setsockopt(subSocket, ZMQ_SUBSCRIBE, "foo", 3) && printf("zmq_setsockopt: %s\n",zmq_strerror(errno)); - - zmq_bind(pubSocket, "inproc://someInProcDescriptor") && printf("zmq_bind: %s\n", zmq_strerror(errno)); - //zmq_bind(pubSocket, "tcp://127.0.0.1:30010") && printf("zmq_bind: %s\n", zmq_strerror(errno)); - - int more; - size_t more_size = sizeof(more); - int iteration = 0; - - while (1) { - zmq_pollitem_t items [] = { - { subSocket, 0, ZMQ_POLLIN, 0 }, // read publications - { pubSocket, 0, ZMQ_POLLIN, 0 }, // read subscriptions - }; - int rc = zmq_poll (items, 2, 100); - - if (items [1].revents & ZMQ_POLLIN) { - while (1) { - zmq_msg_t msg; - zmq_msg_init (&msg); - zmq_msg_recv (&msg, pubSocket, 0); - char* buffer = (char*)zmq_msg_data(&msg); - - if (buffer[0] == 0) { - assert(isSubscribed); - isSubscribed = false; - } - else { - assert(!isSubscribed); - isSubscribed = true; - } - - zmq_getsockopt (pubSocket, ZMQ_RCVMORE, &more, &more_size); - zmq_msg_close (&msg); - - if (!more) - break; // Last message part - } - } - - if (items[0].revents & ZMQ_POLLIN) { - while (1) { - zmq_msg_t msg; - zmq_msg_init (&msg); - zmq_msg_recv (&msg, subSocket, 0); - zmq_getsockopt (subSocket, ZMQ_RCVMORE, &more, &more_size); - zmq_msg_close (&msg); - - if (!more) { - publicationsReceived++; - break; // Last message part - } - } - } - if (iteration == 1) { - zmq_connect(subSocket, "inproc://someInProcDescriptor") && printf("zmq_connect: %s\n", zmq_strerror(errno)); - //zmq_connect(subSocket, "tcp://127.0.0.1:30010") && printf("zmq_connect: %s\n", zmq_strerror(errno)); - } - if (iteration == 4) { - zmq_disconnect(subSocket, "inproc://someInProcDescriptor") && printf("zmq_disconnect(%d): %s\n", errno, zmq_strerror(errno)); - //zmq_disconnect(subSocket, "tcp://127.0.0.1:30010") && printf("zmq_disconnect: %s\n", zmq_strerror(errno)); - } - if (iteration > 4 && rc == 0) - break; - - zmq_msg_t channelEnvlp; - ZMQ_PREPARE_STRING(channelEnvlp, "foo", 3); - zmq_msg_send (&channelEnvlp, pubSocket, ZMQ_SNDMORE) >= 0 || printf("zmq_msg_send: %s\n",zmq_strerror(errno)); - zmq_msg_close(&channelEnvlp) && printf("zmq_msg_close: %s\n",zmq_strerror(errno)); - - zmq_msg_t message; - ZMQ_PREPARE_STRING(message, "this is foo!", 12); - zmq_msg_send (&message, pubSocket, 0) >= 0 || printf("zmq_msg_send: %s\n",zmq_strerror(errno)); - zmq_msg_close(&message) && printf("zmq_msg_close: %s\n",zmq_strerror(errno)); - - iteration++; - } - assert(publicationsReceived == 3); - assert(!isSubscribed); - - zmq_close(pubSocket) && printf("zmq_close: %s", zmq_strerror(errno)); - zmq_close(subSocket) && printf("zmq_close: %s", zmq_strerror(errno)); - - zmq_ctx_term(context); - return 0; -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_filter_ipc.cpp b/zeromq/zeromq-4.1.4/tests/test_filter_ipc.cpp deleted file mode 100644 index c6e1c96dd6..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_filter_ipc.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include -#include - -#include -#include - -#include "testutil.hpp" - -static void bounce_fail (void *server, void *client) -{ - const char *content = "12345678ABCDEFGH12345678abcdefgh"; - char buffer [32]; - - // Send message from client to server - int rc = zmq_send (client, content, 32, ZMQ_SNDMORE); - assert (rc == 32); - rc = zmq_send (client, content, 32, 0); - assert (rc == 32); - - // Receive message at server side (should not succeed) - int timeout = 250; - rc = zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_recv (server, buffer, 32, 0); - assert (rc == -1); - assert (zmq_errno () == EAGAIN); - - // Send message from server to client to test other direction - rc = zmq_setsockopt (server, ZMQ_SNDTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_send (server, content, 32, ZMQ_SNDMORE); - assert (rc == -1); - assert (zmq_errno () == EAGAIN); -} - -template -static void run_test (int opt, T optval, int expected_error, int bounce_test) -{ - int rc; - - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_DEALER); - assert (sb); - - if (opt) { - rc = zmq_setsockopt(sb, opt, &optval, sizeof (optval)); - if (expected_error) { - assert (rc == -1); - assert (zmq_errno () == expected_error); - } else { - assert (rc == 0); - } - } - - void *sc = zmq_socket (ctx, ZMQ_DEALER); - assert (sc); - - // If a test fails, don't hang for too long - int timeout = 2500; - rc = zmq_setsockopt (sb, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_setsockopt (sb, ZMQ_SNDTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_setsockopt (sc, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_setsockopt (sc, ZMQ_SNDTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - int interval = -1; - rc = zmq_setsockopt (sc, ZMQ_RECONNECT_IVL, &interval, sizeof (int)); - assert (rc == 0); - - if (bounce_test) { - const char* endpoint = "ipc://test_filter_ipc.sock"; - int rc = zmq_bind (sb, endpoint); - assert (rc == 0); - - rc = zmq_connect (sc, endpoint); - assert (rc == 0); - - if (bounce_test > 0) - bounce (sb, sc); - else - bounce_fail (sb, sc); - } - - close_zero_linger (sc); - close_zero_linger (sb); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - - // No filters - run_test (0, 0, 0, 1); - -#if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED - // Get the group and supplimental groups of the process owner - gid_t groups[100]; - int ngroups = getgroups(100, groups); - assert (ngroups != -1 && ngroups != 0); - gid_t group = getgid(), supgroup = groups[0], notgroup = groups[ngroups - 1] + 1; - for (int i = 0; i < ngroups; i++) { - if (supgroup == group && group != groups[i]) - supgroup = groups[i]; - if (notgroup <= groups[i]) - notgroup = groups[i] + 1; - } - - // Test filter with UID of process owner - run_test (ZMQ_IPC_FILTER_UID, getuid(), 0, 1); - // Test filter with UID of another (possibly non-existent) user - run_test (ZMQ_IPC_FILTER_UID, getuid() + 1, 0, -1); - // Test filter with GID of process owner - run_test (ZMQ_IPC_FILTER_GID, group, 0, 1); - // Test filter with supplimental group of process owner - run_test (ZMQ_IPC_FILTER_GID, supgroup, 0, 1); - // Test filter with GID of another (possibly non-existent) group - run_test (ZMQ_IPC_FILTER_GID, notgroup, 0, -1); -# if defined ZMQ_HAVE_SO_PEERCRED - // Test filter with PID of current process - run_test (ZMQ_IPC_FILTER_PID, getpid(), 0, 1); - // Test filter with PID of another (possibly non-existent) process - run_test (ZMQ_IPC_FILTER_PID, getpid() + 1, 0, -1); -# else - // Setup of PID filter should fail with operation not supported error - run_test (ZMQ_IPC_FILTER_PID, getpid(), EINVAL, 0); -# endif -#else - run_test (ZMQ_IPC_FILTER_UID, 0, EINVAL, 0); - run_test (ZMQ_IPC_FILTER_GID, 0, EINVAL, 0); - run_test (ZMQ_IPC_FILTER_PID, 0, EINVAL, 0); -#endif // defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED - - return 0 ; -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_fork.cpp b/zeromq/zeromq-4.1.4/tests/test_fork.cpp deleted file mode 100644 index 52304cd598..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_fork.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const char *address = "tcp://127.0.0.1:6571"; - -#define NUM_MESSAGES 5 - -int main (void) -{ - setup_test_environment (); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Create and bind pull socket to receive messages - void *pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - int rc = zmq_bind (pull, address); - assert (rc == 0); - - int pid = fork (); - if (pid == 0) { - // Child process - // Immediately close parent sockets and context - zmq_close (pull); - zmq_term (ctx); - - // Create new context, socket, connect and send some messages - void *child_ctx = zmq_ctx_new (); - assert (child_ctx); - void *push = zmq_socket (child_ctx, ZMQ_PUSH); - assert (push); - rc = zmq_connect (push, address); - assert (rc == 0); - int count; - for (count = 0; count < NUM_MESSAGES; count++) - zmq_send (push, "Hello", 5, 0); - - zmq_close (push); - zmq_ctx_destroy (child_ctx); - exit (0); - } - else { - // Parent process - int count; - for (count = 0; count < NUM_MESSAGES; count++) { - char buffer [5]; - int num_bytes = zmq_recv (pull, buffer, 5, 0); - assert (num_bytes == 5); - } - int child_status; - while (true) { - rc = waitpid (pid, &child_status, 0); - if (rc == -1 && errno == EINTR) - continue; - assert (rc > 0); - // Verify the status code of the child was zero - assert (WEXITSTATUS (child_status) == 0); - break; - } - exit (0); - } - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_getsockopt_memset.cpp b/zeromq/zeromq-4.1.4/tests/test_getsockopt_memset.cpp deleted file mode 100644 index e81ae55bd8..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_getsockopt_memset.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - int64_t more; - size_t more_size = sizeof(more); - - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PUB); - assert (sb); - int rc = zmq_bind (sb, "inproc://a"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_SUB); - assert (sc); - rc = zmq_connect (sc, "inproc://a"); - assert (rc == 0); - - memset(&more, 0xFF, sizeof(int64_t)); - zmq_getsockopt(sc, ZMQ_RCVMORE, &more, &more_size); - assert (more_size == sizeof(int)); - assert (more == 0); - - - // Cleanup - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_hwm.cpp b/zeromq/zeromq-4.1.4/tests/test_hwm.cpp deleted file mode 100644 index 50f95bbd0e..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_hwm.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const int MAX_SENDS = 10000; - -enum TestType { BIND_FIRST, CONNECT_FIRST }; - -int test_defaults () -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - // Set up bind socket - void *bind_socket = zmq_socket (ctx, ZMQ_PULL); - assert (bind_socket); - rc = zmq_bind (bind_socket, "inproc://a"); - assert (rc == 0); - - // Set up connect socket - void *connect_socket = zmq_socket (ctx, ZMQ_PUSH); - assert (connect_socket); - rc = zmq_connect (connect_socket, "inproc://a"); - assert (rc == 0); - - // Send until we block - int send_count = 0; - while (send_count < MAX_SENDS && zmq_send (connect_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++send_count; - - // Now receive all sent messages - int recv_count = 0; - while (zmq_recv (bind_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++recv_count; - - assert (send_count == recv_count); - - // Clean up - rc = zmq_close (connect_socket); - assert (rc == 0); - - rc = zmq_close (bind_socket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return send_count; -} - -int count_msg (int send_hwm, int recv_hwm, TestType testType) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - void *bind_socket; - void *connect_socket; - if (testType == BIND_FIRST) - { - // Set up bind socket - bind_socket = zmq_socket (ctx, ZMQ_PULL); - assert (bind_socket); - rc = zmq_setsockopt (bind_socket, ZMQ_RCVHWM, &recv_hwm, sizeof (recv_hwm)); - assert (rc == 0); - rc = zmq_bind (bind_socket, "inproc://a"); - assert (rc == 0); - - // Set up connect socket - connect_socket = zmq_socket (ctx, ZMQ_PUSH); - assert (connect_socket); - rc = zmq_setsockopt (connect_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm)); - assert (rc == 0); - rc = zmq_connect (connect_socket, "inproc://a"); - assert (rc == 0); - } - else - { - // Set up connect socket - connect_socket = zmq_socket (ctx, ZMQ_PUSH); - assert (connect_socket); - rc = zmq_setsockopt (connect_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm)); - assert (rc == 0); - rc = zmq_connect (connect_socket, "inproc://a"); - assert (rc == 0); - - // Set up bind socket - bind_socket = zmq_socket (ctx, ZMQ_PULL); - assert (bind_socket); - rc = zmq_setsockopt (bind_socket, ZMQ_RCVHWM, &recv_hwm, sizeof (recv_hwm)); - assert (rc == 0); - rc = zmq_bind (bind_socket, "inproc://a"); - assert (rc == 0); - } - - // Send until we block - int send_count = 0; - while (send_count < MAX_SENDS && zmq_send (connect_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++send_count; - - // Now receive all sent messages - int recv_count = 0; - while (zmq_recv (bind_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++recv_count; - - assert (send_count == recv_count); - - // Now it should be possible to send one more. - rc = zmq_send (connect_socket, NULL, 0, 0); - assert (rc == 0); - - // Consume the remaining message. - rc = zmq_recv (bind_socket, NULL, 0, 0); - assert (rc == 0); - - // Clean up - rc = zmq_close (connect_socket); - assert (rc == 0); - - rc = zmq_close (bind_socket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return send_count; -} - -int test_inproc_bind_first (int send_hwm, int recv_hwm) -{ - return count_msg(send_hwm, recv_hwm, BIND_FIRST); -} - -int test_inproc_connect_first (int send_hwm, int recv_hwm) -{ - return count_msg(send_hwm, recv_hwm, CONNECT_FIRST); -} - -int test_inproc_connect_and_close_first (int send_hwm, int recv_hwm) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - // Set up connect socket - void *connect_socket = zmq_socket (ctx, ZMQ_PUSH); - assert (connect_socket); - rc = zmq_setsockopt (connect_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm)); - assert (rc == 0); - rc = zmq_connect (connect_socket, "inproc://a"); - assert (rc == 0); - - // Send until we block - int send_count = 0; - while (send_count < MAX_SENDS && zmq_send (connect_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++send_count; - - // Close connect - rc = zmq_close (connect_socket); - assert (rc == 0); - - // Set up bind socket - void *bind_socket = zmq_socket (ctx, ZMQ_PULL); - assert (bind_socket); - rc = zmq_setsockopt (bind_socket, ZMQ_RCVHWM, &recv_hwm, sizeof (recv_hwm)); - assert (rc == 0); - rc = zmq_bind (bind_socket, "inproc://a"); - assert (rc == 0); - - // Now receive all sent messages - int recv_count = 0; - while (zmq_recv (bind_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++recv_count; - - assert (send_count == recv_count); - - // Clean up - rc = zmq_close (bind_socket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return send_count; -} - -int test_inproc_bind_and_close_first (int send_hwm, int /* recv_hwm */) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - // Set up bind socket - void *bind_socket = zmq_socket (ctx, ZMQ_PUSH); - assert (bind_socket); - rc = zmq_setsockopt (bind_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm)); - assert (rc == 0); - rc = zmq_bind (bind_socket, "inproc://a"); - assert (rc == 0); - - // Send until we block - int send_count = 0; - while (send_count < MAX_SENDS && zmq_send (bind_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++send_count; - - // Close bind - rc = zmq_close (bind_socket); - assert (rc == 0); - - /* Can't currently do connect without then wiring up a bind as things hang, this needs top be fixed. - // Set up connect socket - void *connect_socket = zmq_socket (ctx, ZMQ_PULL); - assert (connect_socket); - rc = zmq_setsockopt (connect_socket, ZMQ_RCVHWM, &recv_hwm, sizeof (recv_hwm)); - assert (rc == 0); - rc = zmq_connect (connect_socket, "inproc://a"); - assert (rc == 0); - - // Now receive all sent messages - int recv_count = 0; - while (zmq_recv (connect_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++recv_count; - - assert (send_count == recv_count); - */ - - // Clean up - //rc = zmq_close (connect_socket); - //assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return send_count; -} - -int main (void) -{ - setup_test_environment(); - - int count; - - // Default values are 1000 on send and 1000 one receive, so 2000 total - count = test_defaults (); - assert (count == 2000); - - // Infinite send and receive buffer - count = test_inproc_bind_first (0, 0); - assert (count == MAX_SENDS); - count = test_inproc_connect_first (0, 0); - assert (count == MAX_SENDS); - - // Infinite send buffer - count = test_inproc_bind_first (1, 0); - assert (count == MAX_SENDS); - count = test_inproc_connect_first (1, 0); - assert (count == MAX_SENDS); - - // Infinite receive buffer - count = test_inproc_bind_first (0, 1); - assert (count == MAX_SENDS); - count = test_inproc_connect_first (0, 1); - assert (count == MAX_SENDS); - - // Send and recv buffers hwm 1, so total that can be queued is 2 - count = test_inproc_bind_first (1, 1); - assert (count == 2); - count = test_inproc_connect_first (1, 1); - assert (count == 2); - - // Send hwm of 1, send before bind so total that can be queued is 1 - count = test_inproc_connect_and_close_first (1, 0); - assert (count == 1); - - // Send hwm of 1, send from bind side before connect so total that can be queued should be 1, - // however currently all messages get thrown away before the connect. BUG? - count = test_inproc_bind_and_close_first (1, 0); - //assert (count == 1); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_hwm_pubsub.cpp b/zeromq/zeromq-4.1.4/tests/test_hwm_pubsub.cpp deleted file mode 100644 index a46fadf2c8..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_hwm_pubsub.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -// const int MAX_SENDS = 10000; - -int test_defaults (int send_hwm, int msgCnt) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - // Set up bind socket - void *pub_socket = zmq_socket (ctx, ZMQ_PUB); - assert (pub_socket); - rc = zmq_bind (pub_socket, "inproc://a"); - assert (rc == 0); - - // Set up connect socket - void *sub_socket = zmq_socket (ctx, ZMQ_SUB); - assert (sub_socket); - rc = zmq_connect (sub_socket, "inproc://a"); - assert (rc == 0); - - //set a hwm on publisher - rc = zmq_setsockopt (pub_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm)); - rc = zmq_setsockopt( sub_socket, ZMQ_SUBSCRIBE, 0, 0); - - // Send until we block - int send_count = 0; - while (send_count < msgCnt && zmq_send (pub_socket, NULL, 0, ZMQ_DONTWAIT) == 0) - ++send_count; - - // Now receive all sent messages - int recv_count = 0; - while (0 == zmq_recv (sub_socket, NULL, 0, ZMQ_DONTWAIT)) - { - ++recv_count; - } - - assert (send_hwm == recv_count); - - // Clean up - rc = zmq_close (sub_socket); - assert (rc == 0); - - rc = zmq_close (pub_socket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return recv_count; -} - -int receive( void* socket) -{ - int recv_count = 0; - // Now receive all sent messages - while (0 == zmq_recv (socket, NULL, 0, ZMQ_DONTWAIT)) - { - ++recv_count; - } - - return recv_count; - -} - - -int test_blocking (int send_hwm, int msgCnt) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - // Set up bind socket - void *pub_socket = zmq_socket (ctx, ZMQ_PUB); - assert (pub_socket); - rc = zmq_bind (pub_socket, "inproc://a"); - assert (rc == 0); - - // Set up connect socket - void *sub_socket = zmq_socket (ctx, ZMQ_SUB); - assert (sub_socket); - rc = zmq_connect (sub_socket, "inproc://a"); - assert (rc == 0); - - //set a hwm on publisher - rc = zmq_setsockopt (pub_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm)); - int wait = 1; - rc = zmq_setsockopt (pub_socket, ZMQ_XPUB_NODROP, &wait, sizeof(wait)); - rc = zmq_setsockopt( sub_socket, ZMQ_SUBSCRIBE, 0, 0); - - // Send until we block - int send_count = 0; - int recv_count = 0; - while (send_count < msgCnt ) - { - rc = zmq_send (pub_socket, NULL, 0, ZMQ_DONTWAIT); - if( rc == 0) - { - ++send_count; - } - else if( -1 == rc) - { - assert(EAGAIN == errno); - recv_count += receive(sub_socket); - assert(recv_count == send_count); - } - } - - recv_count += receive(sub_socket); - - // Clean up - rc = zmq_close (sub_socket); - assert (rc == 0); - - rc = zmq_close (pub_socket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return recv_count; -} - - - -int main (void) -{ - setup_test_environment(); - - int count; - - // send 1000 msg on hwm 1000, receive 1000 - count = test_defaults (1000,1000); - assert (count == 1000); - - // send 6000 msg on hwm 2000, drops above hwm, only receive hwm - count = test_blocking (2000,6000); - assert (count == 6000); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_immediate.cpp b/zeromq/zeromq-4.1.4/tests/test_immediate.cpp deleted file mode 100644 index 7af67f10a2..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_immediate.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - int val; - int rc; - char buffer[16]; - // TEST 1. - // First we're going to attempt to send messages to two - // pipes, one connected, the other not. We should see - // the PUSH load balancing to both pipes, and hence half - // of the messages getting queued, as connect() creates a - // pipe immediately. - - void *context = zmq_ctx_new(); - assert (context); - void *to = zmq_socket(context, ZMQ_PULL); - assert (to); - - // Bind the one valid receiver - val = 0; - rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val)); - assert (rc == 0); - rc = zmq_bind (to, "tcp://127.0.0.1:6555"); - assert (rc == 0); - - // Create a socket pushing to two endpoints - only 1 message should arrive. - void *from = zmq_socket (context, ZMQ_PUSH); - assert(from); - - val = 0; - zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof (val)); - // This pipe will not connect - rc = zmq_connect (from, "tcp://localhost:5556"); - assert (rc == 0); - // This pipe will - rc = zmq_connect (from, "tcp://localhost:6555"); - assert (rc == 0); - - // We send 10 messages, 5 should just get stuck in the queue - // for the not-yet-connected pipe - for (int i = 0; i < 10; ++i) { - rc = zmq_send (from, "Hello", 5, 0); - assert (rc == 5); - } - - // We now consume from the connected pipe - // - we should see just 5 - int timeout = 250; - rc = zmq_setsockopt (to, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - int seen = 0; - while (true) { - rc = zmq_recv (to, &buffer, sizeof (buffer), 0); - if (rc == -1) - break; // Break when we didn't get a message - seen++; - } - assert (seen == 5); - - rc = zmq_close (from); - assert (rc == 0); - - rc = zmq_close (to); - assert (rc == 0); - - rc = zmq_ctx_term (context); - assert (rc == 0); - - // TEST 2 - // This time we will do the same thing, connect two pipes, - // one of which will succeed in connecting to a bound - // receiver, the other of which will fail. However, we will - // also set the delay attach on connect flag, which should - // cause the pipe attachment to be delayed until the connection - // succeeds. - context = zmq_ctx_new(); - - // Bind the valid socket - to = zmq_socket (context, ZMQ_PULL); - assert (to); - rc = zmq_bind (to, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - val = 0; - rc = zmq_setsockopt (to, ZMQ_LINGER, &val, sizeof(val)); - assert (rc == 0); - - // Create a socket pushing to two endpoints - all messages should arrive. - from = zmq_socket (context, ZMQ_PUSH); - assert (from); - - val = 0; - rc = zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val)); - assert (rc == 0); - - // Set the key flag - val = 1; - rc = zmq_setsockopt (from, ZMQ_IMMEDIATE, &val, sizeof(val)); - assert (rc == 0); - - // Connect to the invalid socket - rc = zmq_connect (from, "tcp://localhost:5561"); - assert (rc == 0); - // Connect to the valid socket - rc = zmq_connect (from, "tcp://localhost:5560"); - assert (rc == 0); - - // Send 10 messages, all should be routed to the connected pipe - for (int i = 0; i < 10; ++i) { - rc = zmq_send (from, "Hello", 5, 0); - assert (rc == 5); - } - rc = zmq_setsockopt (to, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - seen = 0; - while (true) { - rc = zmq_recv (to, &buffer, sizeof (buffer), 0); - if (rc == -1) - break; // Break when we didn't get a message - seen++; - } - assert (seen == 10); - - rc = zmq_close (from); - assert (rc == 0); - - rc = zmq_close (to); - assert (rc == 0); - - rc = zmq_ctx_term (context); - assert (rc == 0); - - // TEST 3 - // This time we want to validate that the same blocking behaviour - // occurs with an existing connection that is broken. We will send - // messages to a connected pipe, disconnect and verify the messages - // block. Then we reconnect and verify messages flow again. - context = zmq_ctx_new (); - - void *backend = zmq_socket (context, ZMQ_DEALER); - assert (backend); - void *frontend = zmq_socket (context, ZMQ_DEALER); - assert (frontend); - int zero = 0; - rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_setsockopt (frontend, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - - // Frontend connects to backend using IMMEDIATE - int on = 1; - rc = zmq_setsockopt (frontend, ZMQ_IMMEDIATE, &on, sizeof (on)); - assert (rc == 0); - rc = zmq_bind (backend, "tcp://127.0.0.1:5560"); - assert (rc == 0); - rc = zmq_connect (frontend, "tcp://localhost:5560"); - assert (rc == 0); - - // Ping backend to frontend so we know when the connection is up - rc = zmq_send (backend, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (frontend, buffer, 255, 0); - assert (rc == 5); - - // Send message from frontend to backend - rc = zmq_send (frontend, "Hello", 5, ZMQ_DONTWAIT); - assert (rc == 5); - - rc = zmq_close (backend); - assert (rc == 0); - - // Give time to process disconnect - msleep (SETTLE_TIME * 10); - - // Send a message, should fail - rc = zmq_send (frontend, "Hello", 5, ZMQ_DONTWAIT); - assert (rc == -1); - - // Recreate backend socket - backend = zmq_socket (context, ZMQ_DEALER); - assert (backend); - rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_bind (backend, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Ping backend to frontend so we know when the connection is up - rc = zmq_send (backend, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (frontend, buffer, 255, 0); - assert (rc == 5); - - // After the reconnect, should succeed - rc = zmq_send (frontend, "Hello", 5, ZMQ_DONTWAIT); - assert (rc == 5); - - rc = zmq_close (backend); - assert (rc == 0); - - rc = zmq_close (frontend); - assert (rc == 0); - - rc = zmq_ctx_term (context); - assert (rc == 0); -} diff --git a/zeromq/zeromq-4.1.4/tests/test_inproc_connect.cpp b/zeromq/zeromq-4.1.4/tests/test_inproc_connect.cpp deleted file mode 100644 index 106765db00..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_inproc_connect.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -static void pusher (void *ctx) -{ - // Connect first - void *connectSocket = zmq_socket (ctx, ZMQ_PAIR); - assert (connectSocket); - int rc = zmq_connect (connectSocket, "inproc://sink"); - assert (rc == 0); - - // Queue up some data - rc = zmq_send_const (connectSocket, "foobar", 6, 0); - assert (rc == 6); - - // Cleanup - rc = zmq_close (connectSocket); - assert (rc == 0); -} - -static void simult_conn (void *payload) -{ - // Pull out arguments - context followed by endpoint string - void* ctx = (void*)((void**)payload)[0]; - char* endpt = (char*)((void**)payload)[1]; - - // Connect - void *connectSocket = zmq_socket (ctx, ZMQ_SUB); - assert (connectSocket); - int rc = zmq_connect (connectSocket, endpt); - assert (rc == 0); - - // Cleanup - rc = zmq_close (connectSocket); - assert (rc == 0); -} - -static void simult_bind (void *payload) -{ - // Pull out arguments - context followed by endpoint string - void* ctx = (void*)((void**)payload)[0]; - char* endpt = (char*)((void**)payload)[1]; - - // Bind - void *bindSocket = zmq_socket (ctx, ZMQ_PUB); - assert (bindSocket); - int rc = zmq_bind (bindSocket, endpt); - assert (rc == 0); - - // Cleanup - rc = zmq_close (bindSocket); - assert (rc == 0); -} - -void test_bind_before_connect () -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Bind first - void *bindSocket = zmq_socket (ctx, ZMQ_PAIR); - assert (bindSocket); - int rc = zmq_bind (bindSocket, "inproc://bbc"); - assert (rc == 0); - - // Now connect - void *connectSocket = zmq_socket (ctx, ZMQ_PAIR); - assert (connectSocket); - rc = zmq_connect (connectSocket, "inproc://bbc"); - assert (rc == 0); - - // Queue up some data - rc = zmq_send_const (connectSocket, "foobar", 6, 0); - assert (rc == 6); - - // Read pending message - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, bindSocket, 0); - assert (rc == 6); - void *data = zmq_msg_data (&msg); - assert (memcmp ("foobar", data, 6) == 0); - - // Cleanup - rc = zmq_close (connectSocket); - assert (rc == 0); - - rc = zmq_close (bindSocket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_connect_before_bind () -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Connect first - void *connectSocket = zmq_socket (ctx, ZMQ_PAIR); - assert (connectSocket); - int rc = zmq_connect (connectSocket, "inproc://cbb"); - assert (rc == 0); - - // Queue up some data - rc = zmq_send_const (connectSocket, "foobar", 6, 0); - assert (rc == 6); - - // Now bind - void *bindSocket = zmq_socket (ctx, ZMQ_PAIR); - assert (bindSocket); - rc = zmq_bind (bindSocket, "inproc://cbb"); - assert (rc == 0); - - // Read pending message - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, bindSocket, 0); - assert (rc == 6); - void *data = zmq_msg_data (&msg); - assert (memcmp ("foobar", data, 6) == 0); - - // Cleanup - rc = zmq_close (connectSocket); - assert (rc == 0); - - rc = zmq_close (bindSocket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_connect_before_bind_pub_sub () -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Connect first - void *connectSocket = zmq_socket (ctx, ZMQ_PUB); - assert (connectSocket); - int rc = zmq_connect (connectSocket, "inproc://cbbps"); - assert (rc == 0); - - // Queue up some data, this will be dropped - rc = zmq_send_const (connectSocket, "before", 6, 0); - assert (rc == 6); - - // Now bind - void *bindSocket = zmq_socket (ctx, ZMQ_SUB); - assert (bindSocket); - rc = zmq_setsockopt (bindSocket, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_bind (bindSocket, "inproc://cbbps"); - assert (rc == 0); - - // Wait for pub-sub connection to happen - msleep (SETTLE_TIME); - - // Queue up some data, this not will be dropped - rc = zmq_send_const (connectSocket, "after", 6, 0); - assert (rc == 6); - - // Read pending message - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, bindSocket, 0); - assert (rc == 6); - void *data = zmq_msg_data (&msg); - assert (memcmp ("after", data, 5) == 0); - - // Cleanup - rc = zmq_close (connectSocket); - assert (rc == 0); - - rc = zmq_close (bindSocket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_multiple_connects () -{ - const unsigned int no_of_connects = 10; - void *ctx = zmq_ctx_new (); - assert (ctx); - - int rc; - void *connectSocket [no_of_connects]; - - // Connect first - for (unsigned int i = 0; i < no_of_connects; ++i) - { - connectSocket [i] = zmq_socket (ctx, ZMQ_PUSH); - assert (connectSocket [i]); - rc = zmq_connect (connectSocket [i], "inproc://multiple"); - assert (rc == 0); - - // Queue up some data - rc = zmq_send_const (connectSocket [i], "foobar", 6, 0); - assert (rc == 6); - } - - // Now bind - void *bindSocket = zmq_socket (ctx, ZMQ_PULL); - assert (bindSocket); - rc = zmq_bind (bindSocket, "inproc://multiple"); - assert (rc == 0); - - for (unsigned int i = 0; i < no_of_connects; ++i) - { - // Read pending message - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, bindSocket, 0); - assert (rc == 6); - void *data = zmq_msg_data (&msg); - assert (memcmp ("foobar", data, 6) == 0); - } - - // Cleanup - for (unsigned int i = 0; i < no_of_connects; ++i) - { - rc = zmq_close (connectSocket [i]); - assert (rc == 0); - } - - rc = zmq_close (bindSocket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_multiple_threads () -{ - const unsigned int no_of_threads = 30; - void *ctx = zmq_ctx_new (); - assert (ctx); - - int rc; - void *threads [no_of_threads]; - - // Connect first - for (unsigned int i = 0; i < no_of_threads; ++i) - { - threads [i] = zmq_threadstart (&pusher, ctx); - } - - // Now bind - void *bindSocket = zmq_socket (ctx, ZMQ_PULL); - assert (bindSocket); - rc = zmq_bind (bindSocket, "inproc://sink"); - assert (rc == 0); - - for (unsigned int i = 0; i < no_of_threads; ++i) - { - // Read pending message - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, bindSocket, 0); - assert (rc == 6); - void *data = zmq_msg_data (&msg); - assert (memcmp ("foobar", data, 6) == 0); - } - - // Cleanup - for (unsigned int i = 0; i < no_of_threads; ++i) - { - zmq_threadclose (threads [i]); - } - - rc = zmq_close (bindSocket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_simultaneous_connect_bind_threads () -{ - const unsigned int no_of_times = 50; - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *threads[no_of_times*2]; - void *thr_args[no_of_times][2]; - char endpts[no_of_times][20]; - - // Set up thread arguments: context followed by endpoint string - for (unsigned int i = 0; i < no_of_times; ++i) - { - thr_args[i][0] = (void*) ctx; - thr_args[i][1] = (void*) endpts[i]; - sprintf (endpts[i], "inproc://foo_%d", i); - } - - // Spawn all threads as simultaneously as possible - for (unsigned int i = 0; i < no_of_times; ++i) - { - threads[i*2+0] = zmq_threadstart (&simult_conn, (void*)thr_args[i]); - threads[i*2+1] = zmq_threadstart (&simult_bind, (void*)thr_args[i]); - } - - // Close all threads - for (unsigned int i = 0; i < no_of_times; ++i) - { - zmq_threadclose (threads[i*2+0]); - zmq_threadclose (threads[i*2+1]); - } - - int rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_identity () -{ - // Create the infrastructure - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sc = zmq_socket (ctx, ZMQ_DEALER); - assert (sc); - - int rc = zmq_connect (sc, "inproc://identity"); - assert (rc == 0); - - void *sb = zmq_socket (ctx, ZMQ_ROUTER); - assert (sb); - - rc = zmq_bind (sb, "inproc://identity"); - assert (rc == 0); - - // Send 2-part message. - rc = zmq_send (sc, "A", 1, ZMQ_SNDMORE); - assert (rc == 1); - rc = zmq_send (sc, "B", 1, 0); - assert (rc == 1); - - // Identity comes first. - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, sb, 0); - assert (rc >= 0); - int more = zmq_msg_more (&msg); - assert (more == 1); - - // Then the first part of the message body. - rc = zmq_msg_recv (&msg, sb, 0); - assert (rc == 1); - more = zmq_msg_more (&msg); - assert (more == 1); - - // And finally, the second part of the message body. - rc = zmq_msg_recv (&msg, sb, 0); - assert (rc == 1); - more = zmq_msg_more (&msg); - assert (more == 0); - - // Deallocate the infrastructure. - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -void test_connect_only () -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *connectSocket = zmq_socket (ctx, ZMQ_PUSH); - assert (connectSocket); - int rc = zmq_connect (connectSocket, "inproc://a"); - assert (rc == 0); - - rc = zmq_close (connectSocket); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - - -void test_unbind () -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Bind and unbind socket 1 - void *bindSocket1 = zmq_socket (ctx, ZMQ_PAIR); - assert (bindSocket1); - int rc = zmq_bind (bindSocket1, "inproc://unbind"); - assert (rc == 0); - zmq_unbind (bindSocket1, "inproc://unbind"); - assert (rc == 0); - - // Bind socket 2 - void *bindSocket2 = zmq_socket (ctx, ZMQ_PAIR); - assert (bindSocket2); - rc = zmq_bind (bindSocket2, "inproc://unbind"); - assert (rc == 0); - - // Now connect - void *connectSocket = zmq_socket (ctx, ZMQ_PAIR); - assert (connectSocket); - rc = zmq_connect (connectSocket, "inproc://unbind"); - assert (rc == 0); - - // Queue up some data - rc = zmq_send_const (connectSocket, "foobar", 6, 0); - assert (rc == 6); - - // Read pending message - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, bindSocket2, 0); - assert (rc == 6); - void *data = zmq_msg_data (&msg); - assert (memcmp ("foobar", data, 6) == 0); - - // Cleanup - rc = zmq_close (connectSocket); - assert (rc == 0); - rc = zmq_close (bindSocket1); - assert (rc == 0); - rc = zmq_close (bindSocket2); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment (); - - test_bind_before_connect (); - test_connect_before_bind (); - test_connect_before_bind_pub_sub (); - test_multiple_connects (); - test_multiple_threads (); - test_simultaneous_connect_bind_threads (); - test_identity (); - test_connect_only (); - test_unbind (); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_invalid_rep.cpp b/zeromq/zeromq-4.1.4/tests/test_invalid_rep.cpp deleted file mode 100644 index 9acdc1dca2..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_invalid_rep.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - // Create REQ/ROUTER wiring. - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *router_socket = zmq_socket (ctx, ZMQ_ROUTER); - assert (router_socket); - - void *req_socket = zmq_socket (ctx, ZMQ_REQ); - assert (req_socket); - - int linger = 0; - int rc = zmq_setsockopt (router_socket, ZMQ_LINGER, &linger, sizeof (int)); - assert (rc == 0); - rc = zmq_setsockopt (req_socket, ZMQ_LINGER, &linger, sizeof (int)); - assert (rc == 0); - rc = zmq_bind (router_socket, "inproc://hi"); - assert (rc == 0); - rc = zmq_connect (req_socket, "inproc://hi"); - assert (rc == 0); - - // Initial request. - rc = zmq_send (req_socket, "r", 1, 0); - assert (rc == 1); - - // Receive the request. - char addr [32]; - int addr_size; - char bottom [1]; - char body [1]; - addr_size = zmq_recv (router_socket, addr, sizeof (addr), 0); - assert (addr_size >= 0); - rc = zmq_recv (router_socket, bottom, sizeof (bottom), 0); - assert (rc == 0); - rc = zmq_recv (router_socket, body, sizeof (body), 0); - assert (rc == 1); - - // Send invalid reply. - rc = zmq_send (router_socket, addr, addr_size, 0); - assert (rc == addr_size); - - // Send valid reply. - rc = zmq_send (router_socket, addr, addr_size, ZMQ_SNDMORE); - assert (rc == addr_size); - rc = zmq_send (router_socket, bottom, 0, ZMQ_SNDMORE); - assert (rc == 0); - rc = zmq_send (router_socket, "b", 1, 0); - assert (rc == 1); - - // Check whether we've got the valid reply. - rc = zmq_recv (req_socket, body, sizeof (body), 0); - assert (rc == 1); - assert (body [0] == 'b'); - - // Tear down the wiring. - rc = zmq_close (router_socket); - assert (rc == 0); - rc = zmq_close (req_socket); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_iov.cpp b/zeromq/zeromq-4.1.4/tests/test_iov.cpp deleted file mode 100644 index d2c23528f6..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_iov.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -// XSI vector I/O -#if defined ZMQ_HAVE_UIO -#include -#else -struct iovec { - void *iov_base; - size_t iov_len; -}; -#endif - -void do_check(void* sb, void* sc, unsigned int msgsz) -{ - setup_test_environment(); - int rc; - int sum =0; - for (int i = 0; i < 10; i++) - { - zmq_msg_t msg; - zmq_msg_init_size(&msg, msgsz); - void * data = zmq_msg_data(&msg); - memcpy(data,&i, sizeof(int)); - rc = zmq_msg_send(&msg,sc,i==9 ? 0 :ZMQ_SNDMORE); - assert (rc == (int)msgsz); - zmq_msg_close(&msg); - sum += i; - } - - struct iovec ibuffer[32] ; - memset(&ibuffer[0], 0, sizeof(ibuffer)); - - size_t count = 10; - rc = zmq_recviov(sb,&ibuffer[0],&count,0); - assert (rc == 10); - - int rsum=0; - for(;count;--count) - { - int v; - memcpy(&v,ibuffer[count-1].iov_base,sizeof(int)); - rsum += v; - assert(ibuffer[count-1].iov_len == msgsz); - // free up the memory - free(ibuffer[count-1].iov_base); - } - - assert ( sum == rsum ); - -} - -int main (void) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - int rc; - - void *sb = zmq_socket (ctx, ZMQ_PULL); - assert (sb); - - rc = zmq_bind (sb, "inproc://a"); - assert (rc == 0); - - msleep (SETTLE_TIME); - void *sc = zmq_socket (ctx, ZMQ_PUSH); - - rc = zmq_connect (sc, "inproc://a"); - assert (rc == 0); - - - // message bigger than vsm max - do_check(sb,sc,100); - - // message smaller than vsm max - do_check(sb,sc,10); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_ipc_wildcard.cpp b/zeromq/zeromq-4.1.4/tests/test_ipc_wildcard.cpp deleted file mode 100644 index 140e55420a..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_ipc_wildcard.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PAIR); - assert (sb); - int rc = zmq_bind (sb, "ipc://*"); - assert (rc == 0); - - char endpoint [200]; - size_t size = sizeof (endpoint); - rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &size); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_PAIR); - assert (sc); - rc = zmq_connect (sc, endpoint); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_issue_566.cpp b/zeromq/zeromq-4.1.4/tests/test_issue_566.cpp deleted file mode 100644 index 3d10e03512..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_issue_566.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -// Issue 566 describes a problem in libzmq v4.0.0 where a dealer to router -// connection would fail randomly. The test works when the two sockets are -// on the same context, and failed when they were on separate contexts. -// Fixed by https://github.com/zeromq/libzmq/commit/be25cf. - -int main (void) -{ - setup_test_environment(); - - void *ctx1 = zmq_ctx_new (); - assert (ctx1); - - void *ctx2 = zmq_ctx_new (); - assert (ctx2); - - void *router = zmq_socket (ctx1, ZMQ_ROUTER); - int on = 1; - int rc = zmq_setsockopt (router, ZMQ_ROUTER_MANDATORY, &on, sizeof (on)); - assert (rc == 0); - rc = zmq_bind (router, "tcp://127.0.0.1:5555"); - assert (rc != -1); - - // Repeat often enough to be sure this works as it should - for (int cycle = 0; cycle < 100; cycle++) { - // Create dealer with unique explicit identity - // We assume the router learns this out-of-band - void *dealer = zmq_socket (ctx2, ZMQ_DEALER); - char identity [10]; - sprintf (identity, "%09d", cycle); - rc = zmq_setsockopt (dealer, ZMQ_IDENTITY, identity, 10); - assert (rc == 0); - int rcvtimeo = 1000; - rc = zmq_setsockopt (dealer, ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int)); - assert (rc == 0); - rc = zmq_connect (dealer, "tcp://127.0.0.1:5555"); - assert (rc == 0); - - // Router will try to send to dealer, at short intervals. - // It typically takes 2-5 msec for the connection to establish - // on a loopback interface, but we'll allow up to one second - // before failing the test (e.g. for running on a debugger or - // a very slow system). - for (int attempt = 0; attempt < 500; attempt++) { - zmq_poll (0, 0, 2); - rc = zmq_send (router, identity, 10, ZMQ_SNDMORE); - if (rc == -1 && errno == EHOSTUNREACH) - continue; - assert (rc == 10); - rc = zmq_send (router, "HELLO", 5, 0); - assert (rc == 5); - break; - } - uint8_t buffer [5]; - rc = zmq_recv (dealer, buffer, 5, 0); - assert (rc == 5); - assert (memcmp (buffer, "HELLO", 5) == 0); - close_zero_linger (dealer); - } - zmq_close (router); - zmq_ctx_destroy (ctx1); - zmq_ctx_destroy (ctx2); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_last_endpoint.cpp b/zeromq/zeromq-4.1.4/tests/test_last_endpoint.cpp deleted file mode 100644 index 213ace5ae0..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_last_endpoint.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -static void do_bind_and_verify (void *s, const char *endpoint) -{ - int rc = zmq_bind (s, endpoint); - assert (rc == 0); - char reported [255]; - size_t size = 255; - rc = zmq_getsockopt (s, ZMQ_LAST_ENDPOINT, reported, &size); - assert (rc == 0 && strcmp (reported, endpoint) == 0); -} - -int main (void) -{ - setup_test_environment(); - // Create the infrastructure - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_ROUTER); - assert (sb); - int val = 0; - int rc = zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val)); - assert (rc == 0); - - do_bind_and_verify (sb, "tcp://127.0.0.1:5560"); - do_bind_and_verify (sb, "tcp://127.0.0.1:5561"); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_many_sockets.cpp b/zeromq/zeromq-4.1.4/tests/test_many_sockets.cpp deleted file mode 100644 index d54d6cf763..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_many_sockets.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#include -#include -#include -#include - -void test_system_max () -{ - // Keep allocating sockets until we run out of system resources - const int no_of_sockets = 2 * 65536; - void *ctx = zmq_ctx_new (); - zmq_ctx_set (ctx, ZMQ_MAX_SOCKETS, no_of_sockets); - std::vector sockets; - - while (true) { - void *socket = zmq_socket (ctx, ZMQ_PAIR); - if (!socket) - break; - sockets.push_back (socket); - } - assert ((int) sockets.size () < no_of_sockets); - - // System is out of resources, further calls to zmq_socket should return NULL - for (unsigned int i = 0; i < 10; ++i) { - void *socket = zmq_socket (ctx, ZMQ_PAIR); - assert (socket == NULL); - } - // Clean up. - for (unsigned int i = 0; i < sockets.size (); ++i) - zmq_close (sockets [i]); - - zmq_ctx_destroy (ctx); -} - -void test_zmq_default_max () -{ - // Keep allocating sockets until we hit the default limit - void *ctx = zmq_ctx_new (); - std::vector sockets; - - while (true) { - void *socket = zmq_socket (ctx, ZMQ_PAIR); - if (!socket) - break; - sockets.push_back (socket); - } - // We may stop sooner if system has fewer available sockets - assert (sockets.size () <= ZMQ_MAX_SOCKETS_DFLT); - - // Further calls to zmq_socket should return NULL - for (unsigned int i = 0; i < 10; ++i) { - void *socket = zmq_socket (ctx, ZMQ_PAIR); - assert (socket == NULL); - } - - // Clean up - for (unsigned int i = 0; i < sockets.size (); ++i) - zmq_close (sockets [i]); - - zmq_ctx_destroy (ctx); -} - -int main (void) -{ - setup_test_environment (); - - test_system_max (); - test_zmq_default_max (); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_metadata.cpp b/zeromq/zeromq-4.1.4/tests/test_metadata.cpp deleted file mode 100644 index 2c749d6ef6..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_metadata.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -static void -zap_handler (void *handler) -{ - uint8_t metadata [] = { - 5, 'H', 'e', 'l', 'l', 'o', - 0, 0, 0, 5, 'W', 'o', 'r', 'l', 'd' - }; - - // Process ZAP requests forever - while (true) { - char *version = s_recv (handler); - if (!version) - break; // Terminating - - char *sequence = s_recv (handler); - char *domain = s_recv (handler); - char *address = s_recv (handler); - char *identity = s_recv (handler); - char *mechanism = s_recv (handler); - - assert (streq (version, "1.0")); - assert (streq (mechanism, "NULL")); - - s_sendmore (handler, version); - s_sendmore (handler, sequence); - if (streq (domain, "DOMAIN")) { - s_sendmore (handler, "200"); - s_sendmore (handler, "OK"); - s_sendmore (handler, "anonymous"); - zmq_send (handler, metadata, sizeof (metadata), 0); - } - else { - s_sendmore (handler, "400"); - s_sendmore (handler, "BAD DOMAIN"); - s_sendmore (handler, ""); - s_send (handler, ""); - } - free (version); - free (sequence); - free (domain); - free (address); - free (identity); - free (mechanism); - } - close_zero_linger (handler); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Spawn ZAP handler - // We create and bind ZAP socket in main thread to avoid case - // where child thread does not start up fast enough. - void *handler = zmq_socket (ctx, ZMQ_REP); - assert (handler); - int rc = zmq_bind (handler, "inproc://zeromq.zap.01"); - assert (rc == 0); - void *zap_thread = zmq_threadstart (&zap_handler, handler); - - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "DOMAIN", 6); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9001"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127.0.0.1:9001"); - assert (rc == 0); - - s_send (client, "This is a message"); - zmq_msg_t msg; - zmq_msg_init (&msg); - rc = zmq_msg_recv (&msg, server, 0); - assert (rc != -1); - assert (streq (zmq_msg_gets (&msg, "Hello"), "World")); - assert (streq (zmq_msg_gets (&msg, "Socket-Type"), "DEALER")); - assert (streq (zmq_msg_gets (&msg, "User-Id"), "anonymous")); - assert (streq (zmq_msg_gets (&msg, "Peer-Address"), "127.0.0.1")); - assert (zmq_msg_gets (&msg, "No Such") == NULL); - assert (zmq_errno () == EINVAL); - zmq_msg_close (&msg); - - close_zero_linger (client); - close_zero_linger (server); - - // Shutdown - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - // Wait until ZAP handler terminates - zmq_threadclose (zap_thread); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_monitor.cpp b/zeromq/zeromq-4.1.4/tests/test_monitor.cpp deleted file mode 100644 index 56f6e7aaa1..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_monitor.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -// Read one event off the monitor socket; return value and address -// by reference, if not null, and event number by value. Returns -1 -// in case of error. - -static int -get_monitor_event (void *monitor, int *value, char **address) -{ - // First frame in message contains event number and value - zmq_msg_t msg; - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == -1) - return -1; // Interruped, presumably - assert (zmq_msg_more (&msg)); - - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - uint16_t event = *(uint16_t *) (data); - if (value) - *value = *(uint32_t *) (data + 2); - - // Second frame in message contains event address - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == -1) - return -1; // Interruped, presumably - assert (!zmq_msg_more (&msg)); - - if (address) { - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - size_t size = zmq_msg_size (&msg); - *address = (char *) malloc (size + 1); - memcpy (*address, data, size); - *address [size] = 0; - } - return event; -} - -int main (void) -{ - setup_test_environment(); - - void *ctx = zmq_ctx_new (); - assert (ctx); - - // We'll monitor these two sockets - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - - // Socket monitoring only works over inproc:// - int rc = zmq_socket_monitor (client, "tcp://127.0.0.1:9999", 0); - assert (rc == -1); - assert (zmq_errno () == EPROTONOSUPPORT); - - // Monitor all events on client and server sockets - rc = zmq_socket_monitor (client, "inproc://monitor-client", ZMQ_EVENT_ALL); - assert (rc == 0); - rc = zmq_socket_monitor (server, "inproc://monitor-server", ZMQ_EVENT_ALL); - assert (rc == 0); - - // Create two sockets for collecting monitor events - void *client_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (client_mon); - void *server_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (server_mon); - - // Connect these to the inproc endpoints so they'll get events - rc = zmq_connect (client_mon, "inproc://monitor-client"); - assert (rc == 0); - rc = zmq_connect (server_mon, "inproc://monitor-server"); - assert (rc == 0); - - // Now do a basic ping test - rc = zmq_bind (server, "tcp://127.0.0.1:9998"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127.0.0.1:9998"); - assert (rc == 0); - bounce (client, server); - - // Close client and server - close_zero_linger (client); - close_zero_linger (server); - - // Now collect and check events from both sockets - int event = get_monitor_event (client_mon, NULL, NULL); - if (event == ZMQ_EVENT_CONNECT_DELAYED) - event = get_monitor_event (client_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CONNECTED); - event = get_monitor_event (client_mon, NULL, NULL); - assert (event == ZMQ_EVENT_MONITOR_STOPPED); - - // This is the flow of server events - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_LISTENING); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_ACCEPTED); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CLOSED); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_MONITOR_STOPPED); - - // Close down the sockets - close_zero_linger (client_mon); - close_zero_linger (server_mon); - zmq_ctx_term (ctx); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_msg_flags.cpp b/zeromq/zeromq-4.1.4/tests/test_msg_flags.cpp deleted file mode 100644 index 3cc95454d9..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_msg_flags.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - // Create the infrastructure - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_ROUTER); - assert (sb); - - int rc = zmq_bind (sb, "inproc://a"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_DEALER); - assert (sc); - - rc = zmq_connect (sc, "inproc://a"); - assert (rc == 0); - - // Send 2-part message. - rc = zmq_send (sc, "A", 1, ZMQ_SNDMORE); - assert (rc == 1); - rc = zmq_send (sc, "B", 1, 0); - assert (rc == 1); - - // Identity comes first. - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, sb, 0); - assert (rc >= 0); - int more = zmq_msg_more (&msg); - assert (more == 1); - - // Then the first part of the message body. - rc = zmq_msg_recv (&msg, sb, 0); - assert (rc == 1); - more = zmq_msg_more (&msg); - assert (more == 1); - - // And finally, the second part of the message body. - rc = zmq_msg_recv (&msg, sb, 0); - assert (rc == 1); - more = zmq_msg_more (&msg); - assert (more == 0); - - // Test ZMQ_SHARED property (case 1, refcounted messages) - zmq_msg_t msg_a; - rc = zmq_msg_init_size(&msg_a, 1024); // large enough to be a type_lmsg - assert (rc == 0); - - // Message is not shared - rc = zmq_msg_get(&msg_a, ZMQ_SHARED); - assert (rc == 0); - - zmq_msg_t msg_b; - rc = zmq_msg_init(&msg_b); - assert (rc == 0); - - rc = zmq_msg_copy(&msg_b, &msg_a); - assert (rc == 0); - - // Message is now shared - rc = zmq_msg_get(&msg_b, ZMQ_SHARED); - assert (rc == 1); - - // cleanup - rc = zmq_msg_close(&msg_a); - assert (rc == 0); - rc = zmq_msg_close(&msg_b); - assert (rc == 0); - - // Test ZMQ_SHARED property (case 2, constant data messages) - rc = zmq_msg_init_data(&msg_a, (void*) "TEST", 5, 0, 0); - assert (rc == 0); - - // Message reports as shared - rc = zmq_msg_get(&msg_a, ZMQ_SHARED); - assert (rc == 1); - - // cleanup - rc = zmq_msg_close(&msg_a); - assert (rc == 0); - - // Deallocate the infrastructure. - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - return 0 ; -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_pair_inproc.cpp b/zeromq/zeromq-4.1.4/tests/test_pair_inproc.cpp deleted file mode 100644 index 1b485273cc..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_pair_inproc.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PAIR); - assert (sb); - int rc = zmq_bind (sb, "inproc://a"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_PAIR); - assert (sc); - rc = zmq_connect (sc, "inproc://a"); - assert (rc == 0); - - bounce (sb, sc); - - // Test zmq_send_const - rc = zmq_send_const (sb, "foo", 3, ZMQ_SNDMORE); - assert (rc == 3); - rc = zmq_send_const (sb, "foobar", 6, 0); - assert (rc == 6); - - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, sc, 0); - assert (rc == 3); - assert (zmq_msg_size (&msg) == 3); - void* data = zmq_msg_data (&msg); - assert (memcmp ("foo", data, 3) == 0); - rc = zmq_msg_recv (&msg, sc, 0); - assert (rc == 6); - data = zmq_msg_data (&msg); - assert (memcmp ("foobar", data, 6) == 0); - - // Cleanup - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_pair_ipc.cpp b/zeromq/zeromq-4.1.4/tests/test_pair_ipc.cpp deleted file mode 100644 index b20ab2688f..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_pair_ipc.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PAIR); - assert (sb); - int rc = zmq_bind (sb, "ipc:///tmp/tester"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_PAIR); - assert (sc); - rc = zmq_connect (sc, "ipc:///tmp/tester"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_pair_tcp.cpp b/zeromq/zeromq-4.1.4/tests/test_pair_tcp.cpp deleted file mode 100644 index f4577ad2ea..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_pair_tcp.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PAIR); - assert (sb); - int rc = zmq_bind (sb, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_PAIR); - assert (sc); - rc = zmq_connect (sc, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_pair_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_pair_tipc.cpp deleted file mode 100644 index 1b284add11..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_pair_tipc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 iMatix Corporation - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include -#include "testutil.hpp" - -int main (void) -{ - fprintf (stderr, "test_pair_tipc running...\n"); - - void *ctx = zmq_init (1); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_PAIR); - assert (sb); - int rc = zmq_bind (sb, "tipc://{5560,0,0}"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_PAIR); - assert (sc); - rc = zmq_connect (sc, "tipc://{5560,0}"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_probe_router.cpp b/zeromq/zeromq-4.1.4/tests/test_probe_router.cpp deleted file mode 100644 index ac67caf385..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_probe_router.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Create server and bind to endpoint - void *server = zmq_socket (ctx, ZMQ_ROUTER); - assert (server); - int rc = zmq_bind (server, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Create client and connect to server, doing a probe - void *client = zmq_socket (ctx, ZMQ_ROUTER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_IDENTITY, "X", 1); - assert (rc == 0); - int probe = 1; - rc = zmq_setsockopt (client, ZMQ_PROBE_ROUTER, &probe, sizeof (probe)); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:5560"); - assert (rc == 0); - - // We expect an identity=X + empty message from client - unsigned char buffer [255]; - rc = zmq_recv (server, buffer, 255, 0); - assert (rc == 1); - assert (buffer [0] == 'X'); - rc = zmq_recv (server, buffer, 255, 0); - assert (rc == 0); - - // Send a message to client now - rc = zmq_send (server, "X", 1, ZMQ_SNDMORE); - assert (rc == 1); - rc = zmq_send (server, "Hello", 5, 0); - assert (rc == 5); - - rc = zmq_recv (client, buffer, 255, 0); - assert (rc == 5); - - rc = zmq_close (server); - assert (rc == 0); - - rc = zmq_close (client); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_proxy.cpp b/zeromq/zeromq-4.1.4/tests/test_proxy.cpp deleted file mode 100644 index 425fb1e1c8..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_proxy.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#include "../include/zmq_utils.h" - -// Asynchronous client-to-server (DEALER to ROUTER) - pure libzmq -// -// While this example runs in a single process, that is to make -// it easier to start and stop the example. Each task may have its own -// context and conceptually acts as a separate process. To have this -// behaviour, it is necessary to replace the inproc transport of the -// control socket by a tcp transport. - -// This is our client task -// It connects to the server, and then sends a request once per second -// It collects responses as they arrive, and it prints them out. We will -// run several client tasks in parallel, each with a different random ID. - -#define CONTENT_SIZE 13 -#define CONTENT_SIZE_MAX 32 -#define ID_SIZE 10 -#define ID_SIZE_MAX 32 -#define QT_WORKERS 5 -#define QT_CLIENTS 3 -#define is_verbose 0 - -static void -client_task (void *ctx) -{ - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_SUB); - assert (control); - int rc = zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_connect (control, "inproc://control"); - assert (rc == 0); - - char content [CONTENT_SIZE_MAX]; - // Set random identity to make tracing easier - char identity [ID_SIZE]; - sprintf (identity, "%04X-%04X", rand() % 0xFFFF, rand() % 0xFFFF); - rc = zmq_setsockopt (client, ZMQ_IDENTITY, identity, ID_SIZE); // includes '\0' as an helper for printf - assert (rc == 0); - rc = zmq_connect (client, "tcp://127.0.0.1:5563"); - assert (rc == 0); - - zmq_pollitem_t items [] = { { client, 0, ZMQ_POLLIN, 0 }, { control, 0, ZMQ_POLLIN, 0 } }; - int request_nbr = 0; - bool run = true; - while (run) { - // Tick once per 200 ms, pulling in arriving messages - int centitick; - for (centitick = 0; centitick < 20; centitick++) { - zmq_poll (items, 2, 10); - if (items [0].revents & ZMQ_POLLIN) { - int rcvmore; - size_t sz = sizeof (rcvmore); - rc = zmq_recv (client, content, CONTENT_SIZE_MAX, 0); - assert (rc == CONTENT_SIZE); - if (is_verbose) printf("client receive - identity = %s content = %s\n", identity, content); - // Check that message is still the same - assert (memcmp (content, "request #", 9) == 0); - rc = zmq_getsockopt (client, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); - } - if (items [1].revents & ZMQ_POLLIN) { - rc = zmq_recv (control, content, CONTENT_SIZE_MAX, 0); - if (is_verbose) printf("client receive - identity = %s command = %s\n", identity, content); - if (memcmp (content, "TERMINATE", 9) == 0) { - run = false; - break; - } - } - } - sprintf(content, "request #%03d", ++request_nbr); // CONTENT_SIZE - rc = zmq_send (client, content, CONTENT_SIZE, 0); - assert (rc == CONTENT_SIZE); - } - - rc = zmq_close (client); - assert (rc == 0); - rc = zmq_close (control); - assert (rc == 0); -} - -// This is our server task. -// It uses the multithreaded server model to deal requests out to a pool -// of workers and route replies back to clients. One worker can handle -// one request at a time but one client can talk to multiple workers at -// once. - -static void server_worker (void *ctx); - -void -server_task (void *ctx) -{ - // Frontend socket talks to clients over TCP - void *frontend = zmq_socket (ctx, ZMQ_ROUTER); - assert (frontend); - int rc = zmq_bind (frontend, "tcp://127.0.0.1:5563"); - assert (rc == 0); - - // Backend socket talks to workers over inproc - void *backend = zmq_socket (ctx, ZMQ_DEALER); - assert (backend); - rc = zmq_bind (backend, "inproc://backend"); - assert (rc == 0); - - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_SUB); - assert (control); - rc = zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_connect (control, "inproc://control"); - assert (rc == 0); - - // Launch pool of worker threads, precise number is not critical - int thread_nbr; - void* threads [5]; - for (thread_nbr = 0; thread_nbr < QT_WORKERS; thread_nbr++) - threads[thread_nbr] = zmq_threadstart (&server_worker, ctx); - - // Connect backend to frontend via a proxy - zmq_proxy_steerable (frontend, backend, NULL, control); - - for (thread_nbr = 0; thread_nbr < QT_WORKERS; thread_nbr++) - zmq_threadclose (threads[thread_nbr]); - - rc = zmq_close (frontend); - assert (rc == 0); - rc = zmq_close (backend); - assert (rc == 0); - rc = zmq_close (control); - assert (rc == 0); -} - -// Each worker task works on one request at a time and sends a random number -// of replies back, with random delays between replies: -// The comments in the first column, if suppressed, makes it a poller version - -static void -server_worker (void *ctx) -{ - void *worker = zmq_socket (ctx, ZMQ_DEALER); - assert (worker); - int rc = zmq_connect (worker, "inproc://backend"); - assert (rc == 0); - - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_SUB); - assert (control); - rc = zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_connect (control, "inproc://control"); - assert (rc == 0); - - char content [CONTENT_SIZE_MAX]; // bigger than what we need to check that - char identity [ID_SIZE_MAX]; // the size received is the size sent - - bool run = true; - while (run) { - rc = zmq_recv (control, content, CONTENT_SIZE_MAX, ZMQ_DONTWAIT); // usually, rc == -1 (no message) - if (rc > 0) { - if (is_verbose) - printf("server_worker receives command = %s\n", content); - if (memcmp (content, "TERMINATE", 9) == 0) - run = false; - } - // The DEALER socket gives us the reply envelope and message - // if we don't poll, we have to use ZMQ_DONTWAIT, if we poll, we can block-receive with 0 - rc = zmq_recv (worker, identity, ID_SIZE_MAX, ZMQ_DONTWAIT); - if (rc == ID_SIZE) { - rc = zmq_recv (worker, content, CONTENT_SIZE_MAX, 0); - assert (rc == CONTENT_SIZE); - if (is_verbose) - printf ("server receive - identity = %s content = %s\n", identity, content); - - // Send 0..4 replies back - int reply, replies = rand() % 5; - for (reply = 0; reply < replies; reply++) { - // Sleep for some fraction of a second - msleep (rand () % 10 + 1); - // Send message from server to client - rc = zmq_send (worker, identity, ID_SIZE, ZMQ_SNDMORE); - assert (rc == ID_SIZE); - rc = zmq_send (worker, content, CONTENT_SIZE, 0); - assert (rc == CONTENT_SIZE); - } - } - } - rc = zmq_close (worker); - assert (rc == 0); - rc = zmq_close (control); - assert (rc == 0); -} - -// The main thread simply starts several clients and a server, and then -// waits for the server to finish. - -int main (void) -{ - setup_test_environment (); - - void *ctx = zmq_ctx_new (); - assert (ctx); - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_PUB); - assert (control); - int rc = zmq_bind (control, "inproc://control"); - assert (rc == 0); - - void *threads [QT_CLIENTS + 1]; - for (int i = 0; i < QT_CLIENTS; i++) - threads[i] = zmq_threadstart (&client_task, ctx); - threads[QT_CLIENTS] = zmq_threadstart (&server_task, ctx); - msleep (500); // Run for 500 ms then quit - - rc = zmq_send (control, "TERMINATE", 9, 0); - assert (rc == 9); - - rc = zmq_close (control); - assert (rc == 0); - - for (int i = 0; i < QT_CLIENTS + 1; i++) - zmq_threadclose (threads[i]); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_proxy_single_socket.cpp b/zeromq/zeromq-4.1.4/tests/test_proxy_single_socket.cpp deleted file mode 100644 index bd63f7e361..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_proxy_single_socket.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#include "../include/zmq_utils.h" - - - -// This is our server task. -// It runs a proxy with a single REP socket as both frontend and backend. - -void -server_task (void *ctx) -{ - void *rep = zmq_socket (ctx, ZMQ_REP); - assert (rep); - int rc = zmq_bind (rep, "tcp://127.0.0.1:5563"); - assert (rc == 0); - - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_SUB); - assert (control); - rc = zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_connect (control, "inproc://control"); - assert (rc == 0); - - // Use rep as both frontend and backend - zmq_proxy_steerable (rep, rep, NULL, control); - - rc = zmq_close (rep); - assert (rc == 0); - rc = zmq_close (control); - assert (rc == 0); -} - - -// The main thread simply starts several clients and a server, and then -// waits for the server to finish. - -int main (void) -{ - setup_test_environment (); - - void *ctx = zmq_ctx_new (); - assert (ctx); - // client socket pings proxy over tcp - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - int rc = zmq_connect (req, "tcp://127.0.0.1:5563"); - assert (rc == 0); - - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_PUB); - assert (control); - rc = zmq_bind (control, "inproc://control"); - assert (rc == 0); - - void *server_thread = zmq_threadstart(&server_task, ctx); - - char buf[255]; - rc = zmq_send(req, "msg1", 4, 0); - assert (rc == 4); - rc = zmq_recv(req, buf, 255, 0); - assert (rc == 4); - assert (memcmp (buf, "msg1", 4) == 0); - - rc = zmq_send(req, "msg22", 5, 0); - assert (rc == 5); - rc = zmq_recv(req, buf, 255, 0); - assert (rc == 5); - assert (memcmp (buf, "msg22", 5) == 0); - - rc = zmq_send (control, "TERMINATE", 9, 0); - assert (rc == 9); - - rc = zmq_close (control); - assert (rc == 0); - rc = zmq_close (req); - assert (rc == 0); - - zmq_threadclose (server_thread); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_proxy_terminate.cpp b/zeromq/zeromq-4.1.4/tests/test_proxy_terminate.cpp deleted file mode 100644 index 9f688fb624..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_proxy_terminate.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#include "../include/zmq_utils.h" - -// This is a test for issue #1382. The server thread creates a SUB-PUSH -// steerable proxy. The main process then sends messages to the SUB -// but there is no pull on the other side, previously the proxy blocks -// in writing to the backend, preventing the proxy from terminating - -void -server_task (void *ctx) -{ - // Frontend socket talks to main process - void *frontend = zmq_socket (ctx, ZMQ_SUB); - assert (frontend); - int rc = zmq_setsockopt (frontend, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_bind (frontend, "tcp://127.0.0.1:15564"); - assert (rc == 0); - - // Nice socket which is never read - void *backend = zmq_socket (ctx, ZMQ_PUSH); - assert (backend); - rc = zmq_bind (backend, "tcp://127.0.0.1:15563"); - assert (rc == 0); - - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_SUB); - assert (control); - rc = zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - rc = zmq_connect (control, "inproc://control"); - assert (rc == 0); - - // Connect backend to frontend via a proxy - zmq_proxy_steerable (frontend, backend, NULL, control); - - rc = zmq_close (frontend); - assert (rc == 0); - rc = zmq_close (backend); - assert (rc == 0); - rc = zmq_close (control); - assert (rc == 0); -} - - -// The main thread simply starts a basic steerable proxy server, publishes some messages, and then -// waits for the server to terminate. - -int main (void) -{ - setup_test_environment (); - - void *ctx = zmq_ctx_new (); - assert (ctx); - // Control socket receives terminate command from main over inproc - void *control = zmq_socket (ctx, ZMQ_PUB); - assert (control); - int rc = zmq_bind (control, "inproc://control"); - assert (rc == 0); - - void *thread = zmq_threadstart(&server_task, ctx); - msleep (500); // Run for 500 ms - - // Start a secondary publisher which writes data to the SUB-PUSH server socket - void *publisher = zmq_socket (ctx, ZMQ_PUB); - assert (publisher); - rc = zmq_connect (publisher, "tcp://127.0.0.1:15564"); - assert (rc == 0); - - msleep (50); - rc = zmq_send (publisher, "This is a test", 14, 0); - assert (rc == 14); - - msleep (50); - rc = zmq_send (publisher, "This is a test", 14, 0); - assert (rc == 14); - - msleep (50); - rc = zmq_send (publisher, "This is a test", 14, 0); - assert (rc == 14); - rc = zmq_send (control, "TERMINATE", 9, 0); - assert (rc == 9); - - rc = zmq_close (publisher); - assert (rc == 0); - rc = zmq_close (control); - assert (rc == 0); - - zmq_threadclose (thread); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_req_correlate.cpp b/zeromq/zeromq-4.1.4/tests/test_req_correlate.cpp deleted file mode 100644 index 4200d1cc61..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_req_correlate.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - - int enabled = 1; - int rc = zmq_setsockopt (req, ZMQ_REQ_CORRELATE, &enabled, sizeof (int)); - assert (rc == 0); - - int rcvtimeo = 100; - rc = zmq_setsockopt (req, ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (req, "tcp://localhost:5555"); - assert (rc == 0); - - rc = zmq_bind (router, "tcp://127.0.0.1:5555"); - assert (rc == 0); - - // Send a multi-part request. - s_send_seq (req, "ABC", "DEF", SEQ_END); - - zmq_msg_t msg; - zmq_msg_init (&msg); - - // Receive peer identity - rc = zmq_msg_recv (&msg, router, 0); - assert (rc != -1); - assert (zmq_msg_size (&msg) > 0); - zmq_msg_t peer_id_msg; - zmq_msg_init (&peer_id_msg); - zmq_msg_copy (&peer_id_msg, &msg); - - int more = 0; - size_t more_size = sizeof (more); - rc = zmq_getsockopt (router, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - assert (more); - - // Receive request id 1 - rc = zmq_msg_recv (&msg, router, 0); - assert (rc != -1); - assert (zmq_msg_size (&msg) == sizeof(uint32_t)); - uint32_t req_id = *static_cast (zmq_msg_data (&msg)); - zmq_msg_t req_id_msg; - zmq_msg_init (&req_id_msg); - zmq_msg_copy (&req_id_msg, &msg); - - more = 0; - more_size = sizeof (more); - rc = zmq_getsockopt (router, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - assert (more); - - // Receive the rest. - s_recv_seq (router, 0, "ABC", "DEF", SEQ_END); - - // Send back a bad reply: correct req id - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_copy (&msg, &req_id_msg); - rc = zmq_msg_send (&msg, router, 0); - assert (rc != -1); - - // Send back a bad reply: wrong req id - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - uint32_t bad_req_id = req_id + 1; - zmq_msg_init_data (&msg, &bad_req_id, sizeof (uint32_t), NULL, NULL); - rc = zmq_msg_send (&msg, router, 0); - assert (rc != -1); - - // Send back a bad reply: correct req id, 0 - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_copy (&msg, &req_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, 0, SEQ_END); - - // Send back a bad reply: correct req id, garbage - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_copy (&msg, &req_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, "FOO", SEQ_END); - - // Send back a bad reply: wrong req id, 0 - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_init_data (&msg, &bad_req_id, sizeof (uint32_t), NULL, NULL); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, 0, SEQ_END); - - // Send back a bad reply: correct req id, garbage, data - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_copy (&msg, &req_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, "FOO", "DATA", SEQ_END); - - // Send back a bad reply: wrong req id, 0, data - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_init_data (&msg, &bad_req_id, sizeof (uint32_t), NULL, NULL); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, 0, "DATA", SEQ_END); - - // Send back a good reply. - zmq_msg_copy (&msg, &peer_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - zmq_msg_copy (&msg, &req_id_msg); - rc = zmq_msg_send (&msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, 0, "GHI", SEQ_END); - - // Receive reply. If any of the other messages got through, we wouldn't see - // this particular data. - s_recv_seq (req, "GHI", SEQ_END); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - rc = zmq_msg_close (&peer_id_msg); - assert (rc == 0); - - rc = zmq_msg_close (&req_id_msg); - assert (rc == 0); - - close_zero_linger (req); - close_zero_linger (router); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_req_relaxed.cpp b/zeromq/zeromq-4.1.4/tests/test_req_relaxed.cpp deleted file mode 100644 index 9262f6dea1..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_req_relaxed.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - - int enabled = 1; - int rc = zmq_setsockopt (req, ZMQ_REQ_RELAXED, &enabled, sizeof (int)); - assert (rc == 0); - - rc = zmq_setsockopt (req, ZMQ_REQ_CORRELATE, &enabled, sizeof (int)); - assert (rc == 0); - - rc = zmq_bind (req, "tcp://127.0.0.1:5555"); - assert (rc == 0); - - const size_t services = 5; - void *rep [services]; - for (size_t peer = 0; peer < services; peer++) { - rep [peer] = zmq_socket (ctx, ZMQ_REP); - assert (rep [peer]); - - int timeout = 250; - rc = zmq_setsockopt (rep [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (rep [peer], "tcp://localhost:5555"); - assert (rc == 0); - } - // We have to give the connects time to finish otherwise the requests - // will not properly round-robin. We could alternatively connect the - // REQ sockets to the REP sockets. - msleep (SETTLE_TIME); - - // Case 1: Second send() before a reply arrives in a pipe. - - // Send a request, ensure it arrives, don't send a reply - s_send_seq (req, "A", "B", SEQ_END); - s_recv_seq (rep [0], "A", "B", SEQ_END); - - // Send another request on the REQ socket - s_send_seq (req, "C", "D", SEQ_END); - s_recv_seq (rep [1], "C", "D", SEQ_END); - - // Send a reply to the first request - that should be discarded by the REQ - s_send_seq (rep [0], "WRONG", SEQ_END); - - // Send the expected reply - s_send_seq (rep [1], "OK", SEQ_END); - s_recv_seq (req, "OK", SEQ_END); - - - // Another standard req-rep cycle, just to check - s_send_seq (req, "E", SEQ_END); - s_recv_seq (rep [2], "E", SEQ_END); - s_send_seq (rep [2], "F", "G", SEQ_END); - s_recv_seq (req, "F", "G", SEQ_END); - - - // Case 2: Second send() after a reply is already in a pipe on the REQ. - - // Send a request, ensure it arrives, send a reply - s_send_seq (req, "H", SEQ_END); - s_recv_seq (rep [3], "H", SEQ_END); - s_send_seq (rep [3], "BAD", SEQ_END); - - // Wait for message to be there. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - // Without receiving that reply, send another request on the REQ socket - s_send_seq (req, "I", SEQ_END); - s_recv_seq (rep [4], "I", SEQ_END); - - // Send the expected reply - s_send_seq (rep [4], "GOOD", SEQ_END); - s_recv_seq (req, "GOOD", SEQ_END); - - - close_zero_linger (req); - for (size_t peer = 0; peer < services; peer++) - close_zero_linger (rep [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_reqrep_device.cpp b/zeromq/zeromq-4.1.4/tests/test_reqrep_device.cpp deleted file mode 100644 index e231c592d1..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_reqrep_device.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Create a req/rep device. - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - int rc = zmq_bind (dealer, "tcp://127.0.0.1:5560"); - assert (rc == 0); - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - rc = zmq_bind (router, "tcp://127.0.0.1:5561"); - assert (rc == 0); - - // Create a worker. - void *rep = zmq_socket (ctx, ZMQ_REP); - assert (rep); - rc = zmq_connect (rep, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Create a client. - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - rc = zmq_connect (req, "tcp://127.0.0.1:5561"); - assert (rc == 0); - - // Send a request. - rc = zmq_send (req, "ABC", 3, ZMQ_SNDMORE); - assert (rc == 3); - rc = zmq_send (req, "DEF", 3, 0); - assert (rc == 3); - - // Pass the request through the device. - for (int i = 0; i != 4; i++) { - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, router, 0); - assert (rc >= 0); - int rcvmore; - size_t sz = sizeof (rcvmore); - rc = zmq_getsockopt (router, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - rc = zmq_msg_send (&msg, dealer, rcvmore? ZMQ_SNDMORE: 0); - assert (rc >= 0); - } - - // Receive the request. - char buff [3]; - rc = zmq_recv (rep, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "ABC", 3) == 0); - int rcvmore; - size_t sz = sizeof (rcvmore); - rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (rcvmore); - rc = zmq_recv (rep, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "DEF", 3) == 0); - rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); - - // Send the reply. - rc = zmq_send (rep, "GHI", 3, ZMQ_SNDMORE); - assert (rc == 3); - rc = zmq_send (rep, "JKL", 3, 0); - assert (rc == 3); - - // Pass the reply through the device. - for (int i = 0; i != 4; i++) { - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_msg_recv (&msg, dealer, 0); - assert (rc >= 0); - int rcvmore; - rc = zmq_getsockopt (dealer, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - rc = zmq_msg_send (&msg, router, rcvmore? ZMQ_SNDMORE: 0); - assert (rc >= 0); - } - - // Receive the reply. - rc = zmq_recv (req, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "GHI", 3) == 0); - rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (rcvmore); - rc = zmq_recv (req, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "JKL", 3) == 0); - rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); - - // Clean up. - rc = zmq_close (req); - assert (rc == 0); - rc = zmq_close (rep); - assert (rc == 0); - rc = zmq_close (router); - assert (rc == 0); - rc = zmq_close (dealer); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_reqrep_device_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_reqrep_device_tipc.cpp deleted file mode 100644 index b617f8ac7a..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_reqrep_device_tipc.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 VMware, Inc. - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "../include/zmq.h" -#include -#include - -#undef NDEBUG -#include - -int main (void) -{ - fprintf (stderr, "test_reqrep_device_tipc running...\n"); - - void *ctx = zmq_init (1); - assert (ctx); - - // Create a req/rep device. - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - int rc = zmq_bind (dealer, "tipc://{5560,0,0}"); - assert (rc == 0); - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - rc = zmq_bind (router, "tipc://{5561,0,0}"); - assert (rc == 0); - - // Create a worker. - void *rep = zmq_socket (ctx, ZMQ_REP); - assert (rep); - rc = zmq_connect (rep, "tipc://{5560,0}"); - assert (rc == 0); - - // Create a client. - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - rc = zmq_connect (req, "tipc://{5561,0}"); - assert (rc == 0); - - // Send a request. - rc = zmq_send (req, "ABC", 3, ZMQ_SNDMORE); - assert (rc == 3); - rc = zmq_send (req, "DEF", 3, 0); - assert (rc == 3); - - // Pass the request through the device. - for (int i = 0; i != 4; i++) { - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_recvmsg (router, &msg, 0); - assert (rc >= 0); - int rcvmore; - size_t sz = sizeof (rcvmore); - rc = zmq_getsockopt (router, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - rc = zmq_sendmsg (dealer, &msg, rcvmore ? ZMQ_SNDMORE : 0); - assert (rc >= 0); - } - - // Receive the request. - char buff [3]; - rc = zmq_recv (rep, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "ABC", 3) == 0); - int rcvmore; - size_t sz = sizeof (rcvmore); - rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (rcvmore); - rc = zmq_recv (rep, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "DEF", 3) == 0); - rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); - - // Send the reply. - rc = zmq_send (rep, "GHI", 3, ZMQ_SNDMORE); - assert (rc == 3); - rc = zmq_send (rep, "JKL", 3, 0); - assert (rc == 3); - - // Pass the reply through the device. - for (int i = 0; i != 4; i++) { - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - rc = zmq_recvmsg (dealer, &msg, 0); - assert (rc >= 0); - int rcvmore; - rc = zmq_getsockopt (dealer, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - rc = zmq_sendmsg (router, &msg, rcvmore ? ZMQ_SNDMORE : 0); - assert (rc >= 0); - } - - // Receive the reply. - rc = zmq_recv (req, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "GHI", 3) == 0); - rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (rcvmore); - rc = zmq_recv (req, buff, 3, 0); - assert (rc == 3); - assert (memcmp (buff, "JKL", 3) == 0); - rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); - - // Clean up. - rc = zmq_close (req); - assert (rc == 0); - rc = zmq_close (rep); - assert (rc == 0); - rc = zmq_close (router); - assert (rc == 0); - rc = zmq_close (dealer); - assert (rc == 0); - rc = zmq_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_reqrep_inproc.cpp b/zeromq/zeromq-4.1.4/tests/test_reqrep_inproc.cpp deleted file mode 100644 index 1e9eb1f518..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_reqrep_inproc.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_REP); - assert (sb); - int rc = zmq_bind (sb, "inproc://a"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_REQ); - assert (sc); - rc = zmq_connect (sc, "inproc://a"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_reqrep_ipc.cpp b/zeromq/zeromq-4.1.4/tests/test_reqrep_ipc.cpp deleted file mode 100644 index c11d1b0f3c..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_reqrep_ipc.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_REP); - assert (sb); - int rc = zmq_bind (sb, "ipc:///tmp/tester"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_REQ); - assert (sc); - rc = zmq_connect (sc, "ipc:///tmp/tester"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_reqrep_tcp.cpp b/zeromq/zeromq-4.1.4/tests/test_reqrep_tcp.cpp deleted file mode 100644 index f1475a3553..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_reqrep_tcp.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_REP); - assert (sb); - int rc = zmq_bind (sb, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_REQ); - assert (sc); - rc = zmq_connect (sc, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_reqrep_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_reqrep_tipc.cpp deleted file mode 100644 index bd0e411656..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_reqrep_tipc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 iMatix Corporation - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include -#include "testutil.hpp" - -int main (void) -{ - fprintf (stderr, "test_reqrep_tipc running...\n"); - - void *ctx = zmq_init (1); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_REP); - assert (sb); - int rc = zmq_bind (sb, "tipc://{5560,0,0}"); - assert (rc == 0); - - void *sc = zmq_socket (ctx, ZMQ_REQ); - assert (sc); - rc = zmq_connect (sc, "tipc://{5560,0}"); - assert (rc == 0); - - bounce (sb, sc); - - rc = zmq_close (sc); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_router_handover.cpp b/zeromq/zeromq-4.1.4/tests/test_router_handover.cpp deleted file mode 100644 index 99f904cecb..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_router_handover.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - - int rc = zmq_bind (router, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Enable the handover flag - int handover = 1; - rc = zmq_setsockopt (router, ZMQ_ROUTER_HANDOVER, &handover, sizeof (handover)); - assert (rc == 0); - - // Create dealer called "X" and connect it to our router - void *dealer_one = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer_one); - rc = zmq_setsockopt (dealer_one, ZMQ_IDENTITY, "X", 1); - assert (rc == 0); - rc = zmq_connect (dealer_one, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Get message from dealer to know when connection is ready - char buffer [255]; - rc = zmq_send (dealer_one, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (router, buffer, 255, 0); - assert (rc == 1); - assert (buffer [0] == 'X'); - rc = zmq_recv (router, buffer, 255, 0); - assert (rc == 5); - - // Now create a second dealer that uses the same identity - void *dealer_two = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer_two); - rc = zmq_setsockopt (dealer_two, ZMQ_IDENTITY, "X", 1); - assert (rc == 0); - rc = zmq_connect (dealer_two, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Get message from dealer to know when connection is ready - rc = zmq_send (dealer_two, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (router, buffer, 255, 0); - assert (rc == 1); - assert (buffer [0] == 'X'); - rc = zmq_recv (router, buffer, 255, 0); - assert (rc == 5); - - // Send a message to 'X' identity. This should be delivered - // to the second dealer, instead of the first beccause of the handover. - rc = zmq_send (router, "X", 1, ZMQ_SNDMORE); - assert (rc == 1); - rc = zmq_send (router, "Hello", 5, 0); - assert (rc == 5); - - // Ensure that the first dealer doesn't receive the message - // but the second one does - rc = zmq_recv (dealer_one, buffer, 255, ZMQ_NOBLOCK); - assert (rc == -1); - - rc = zmq_recv (dealer_two, buffer, 255, 0); - assert (rc == 5); - - rc = zmq_close (router); - assert (rc == 0); - - rc = zmq_close (dealer_one); - assert (rc == 0); - - rc = zmq_close (dealer_two); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_router_mandatory.cpp b/zeromq/zeromq-4.1.4/tests/test_router_mandatory.cpp deleted file mode 100644 index 1e784b942c..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_router_mandatory.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - - int rc = zmq_bind (router, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Send a message to an unknown peer with the default setting - // This will not report any error - rc = zmq_send (router, "UNKNOWN", 7, ZMQ_SNDMORE); - assert (rc == 7); - rc = zmq_send (router, "DATA", 4, 0); - assert (rc == 4); - - // Send a message to an unknown peer with mandatory routing - // This will fail - int mandatory = 1; - rc = zmq_setsockopt (router, ZMQ_ROUTER_MANDATORY, &mandatory, sizeof (mandatory)); - assert (rc == 0); - rc = zmq_send (router, "UNKNOWN", 7, ZMQ_SNDMORE); - assert (rc == -1 && errno == EHOSTUNREACH); - - // Create dealer called "X" and connect it to our router - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - rc = zmq_setsockopt (dealer, ZMQ_IDENTITY, "X", 1); - assert (rc == 0); - rc = zmq_connect (dealer, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Get message from dealer to know when connection is ready - char buffer [255]; - rc = zmq_send (dealer, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (router, buffer, 255, 0); - assert (rc == 1); - assert (buffer [0] == 'X'); - - // Send a message to connected dealer now - // It should work - rc = zmq_send (router, "X", 1, ZMQ_SNDMORE); - assert (rc == 1); - rc = zmq_send (router, "Hello", 5, 0); - assert (rc == 5); - - rc = zmq_close (router); - assert (rc == 0); - - rc = zmq_close (dealer); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_router_mandatory_hwm.cpp b/zeromq/zeromq-4.1.4/tests/test_router_mandatory_hwm.cpp deleted file mode 100644 index 7c8084106d..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_router_mandatory_hwm.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include -#include "testutil.hpp" -#include - -// DEBUG shouldn't be defined in sources as it will cause a redefined symbol -// error when it is defined in the build configuration. It appears that the -// intent here is to semi-permanently disable DEBUG tracing statements, so the -// implementation is changed to accomodate that intent. -//#define DEBUG 0 -#define TRACE_ENABLED 0 - -int main (void) -{ - int rc; - if (TRACE_ENABLED) fprintf(stderr, "Staring router mandatory HWM test ...\n"); - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - - // Configure router socket to mandatory routing and set HWM and linger - int mandatory = 1; - rc = zmq_setsockopt (router, ZMQ_ROUTER_MANDATORY, &mandatory, sizeof (mandatory)); - assert (rc == 0); - int sndhwm = 1; - rc = zmq_setsockopt (router, ZMQ_SNDHWM, &sndhwm, sizeof (sndhwm)); - assert (rc == 0); - int linger = 1; - rc = zmq_setsockopt (router, ZMQ_LINGER, &linger, sizeof (linger)); - assert (rc == 0); - - rc = zmq_bind (router, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Create dealer called "X" and connect it to our router, configure HWM - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - rc = zmq_setsockopt (dealer, ZMQ_IDENTITY, "X", 1); - assert (rc == 0); - int rcvhwm = 1; - rc = zmq_setsockopt (dealer, ZMQ_RCVHWM, &rcvhwm, sizeof (rcvhwm)); - assert (rc == 0); - - rc = zmq_connect (dealer, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Get message from dealer to know when connection is ready - char buffer [255]; - rc = zmq_send (dealer, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (router, buffer, 255, 0); - assert (rc == 1); - assert (buffer [0] == 'X'); - - int i; - const int BUF_SIZE = 65536; - char buf[BUF_SIZE]; - // Send first batch of messages - for(i = 0; i < 100000; ++i) { - if (TRACE_ENABLED) fprintf(stderr, "Sending message %d ...\n", i); - rc = zmq_send (router, "X", 1, ZMQ_DONTWAIT | ZMQ_SNDMORE); - if (rc == -1 && zmq_errno() == EAGAIN) break; - assert (rc == 1); - rc = zmq_send (router, buf, BUF_SIZE, ZMQ_DONTWAIT); - assert (rc == BUF_SIZE); - } - // This should fail after one message but kernel buffering could - // skew results - assert (i < 10); - sleep(1); - // Send second batch of messages - for(; i < 100000; ++i) { - if (TRACE_ENABLED) fprintf(stderr, "Sending message %d (part 2) ...\n", i); - rc = zmq_send (router, "X", 1, ZMQ_DONTWAIT | ZMQ_SNDMORE); - if (rc == -1 && zmq_errno() == EAGAIN) break; - assert (rc == 1); - rc = zmq_send (router, buf, BUF_SIZE, ZMQ_DONTWAIT); - assert (rc == BUF_SIZE); - } - // This should fail after two messages but kernel buffering could - // skew results - assert (i < 20); - - if (TRACE_ENABLED) fprintf(stderr, "Done sending messages.\n"); - - rc = zmq_close (router); - assert (rc == 0); - - rc = zmq_close (dealer); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_router_mandatory_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_router_mandatory_tipc.cpp deleted file mode 100644 index ca961790a8..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_router_mandatory_tipc.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 iMatix Corporation - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include -#include "testutil.hpp" - -int main (void) -{ - fprintf (stderr, "test_router_mandatory_tipc running...\n"); - - void *ctx = zmq_init (1); - assert (ctx); - - // Creating the first socket. - void *sa = zmq_socket (ctx, ZMQ_ROUTER); - assert (sa); - - int rc = zmq_bind (sa, "tipc://{15560,0,0}"); - assert (rc == 0); - - // Sending a message to an unknown peer with the default setting - rc = zmq_send (sa, "UNKNOWN", 7, ZMQ_SNDMORE); - assert (rc == 7); - rc = zmq_send (sa, "DATA", 4, 0); - assert (rc == 4); - - int mandatory = 1; - - // Set mandatory routing on socket - rc = zmq_setsockopt (sa, ZMQ_ROUTER_MANDATORY, &mandatory, sizeof (mandatory)); - assert (rc == 0); - - // Send a message and check that it fails - rc = zmq_send (sa, "UNKNOWN", 7, ZMQ_SNDMORE | ZMQ_DONTWAIT); - assert (rc == -1 && errno == EHOSTUNREACH); - - rc = zmq_close (sa); - assert (rc == 0); - - rc = zmq_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_security_curve.cpp b/zeromq/zeromq-4.1.4/tests/test_security_curve.cpp deleted file mode 100644 index 6c075978af..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_security_curve.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#if defined (ZMQ_HAVE_WINDOWS) -# include -# include -# include -# define close closesocket -#else -# include -# include -# include -# include -#endif - -// We'll generate random test keys at startup -static char client_public [41]; -static char client_secret [41]; -static char server_public [41]; -static char server_secret [41]; - -// -------------------------------------------------------------------------- -// This methods receives and validates ZAP requestes (allowing or denying -// each client connection). - -static void zap_handler (void *handler) -{ - // Process ZAP requests forever - while (true) { - char *version = s_recv (handler); - if (!version) - break; // Terminating - - char *sequence = s_recv (handler); - char *domain = s_recv (handler); - char *address = s_recv (handler); - char *identity = s_recv (handler); - char *mechanism = s_recv (handler); - uint8_t client_key [32]; - int size = zmq_recv (handler, client_key, 32, 0); - assert (size == 32); - - char client_key_text [41]; - zmq_z85_encode (client_key_text, client_key, 32); - - assert (streq (version, "1.0")); - assert (streq (mechanism, "CURVE")); - assert (streq (identity, "IDENT")); - - s_sendmore (handler, version); - s_sendmore (handler, sequence); - - if (streq (client_key_text, client_public)) { - s_sendmore (handler, "200"); - s_sendmore (handler, "OK"); - s_sendmore (handler, "anonymous"); - s_send (handler, ""); - } - else { - s_sendmore (handler, "400"); - s_sendmore (handler, "Invalid client public key"); - s_sendmore (handler, ""); - s_send (handler, ""); - } - free (version); - free (sequence); - free (domain); - free (address); - free (identity); - free (mechanism); - } - zmq_close (handler); -} - - -int main (void) -{ -#ifndef HAVE_LIBSODIUM - printf ("libsodium not installed, skipping CURVE test\n"); - return 0; -#endif - - // Generate new keypairs for this test - int rc = zmq_curve_keypair (client_public, client_secret); - assert (rc == 0); - rc = zmq_curve_keypair (server_public, server_secret); - assert (rc == 0); - - setup_test_environment (); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Spawn ZAP handler - // We create and bind ZAP socket in main thread to avoid case - // where child thread does not start up fast enough. - void *handler = zmq_socket (ctx, ZMQ_REP); - assert (handler); - rc = zmq_bind (handler, "inproc://zeromq.zap.01"); - assert (rc == 0); - void *zap_thread = zmq_threadstart (&zap_handler, handler); - - // Server socket will accept connections - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - int as_server = 1; - rc = zmq_setsockopt (server, ZMQ_CURVE_SERVER, &as_server, sizeof (int)); - assert (rc == 0); - rc = zmq_setsockopt (server, ZMQ_CURVE_SECRETKEY, server_secret, 41); - assert (rc == 0); - rc = zmq_setsockopt (server, ZMQ_IDENTITY, "IDENT", 6); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9998"); - assert (rc == 0); - - // Check CURVE security with valid credentials - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 41); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - bounce (server, client); - rc = zmq_close (client); - assert (rc == 0); - - // Check CURVE security with a garbage server key - // This will be caught by the curve_server class, not passed to ZAP - char garbage_key [] = "0000111122223333444455556666777788889999"; - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, garbage_key, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 41); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Check CURVE security with a garbage client public key - // This will be caught by the curve_server class, not passed to ZAP - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, garbage_key, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 41); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Check CURVE security with a garbage client secret key - // This will be caught by the curve_server class, not passed to ZAP - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, garbage_key, 41); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Check CURVE security with bogus client credentials - // This must be caught by the ZAP handler - char bogus_public [41]; - char bogus_secret [41]; - zmq_curve_keypair (bogus_public, bogus_secret); - - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, bogus_public, 41); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, bogus_secret, 41); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Check CURVE security with NULL client credentials - // This must be caught by the curve_server class, not passed to ZAP - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Check CURVE security with PLAIN client credentials - // This must be caught by the curve_server class, not passed to ZAP - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (client, ZMQ_PLAIN_USERNAME, "admin", 5); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_PLAIN_PASSWORD, "password", 8); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Unauthenticated messages from a vanilla socket shouldn't be received - struct sockaddr_in ip4addr; - int s; - - ip4addr.sin_family = AF_INET; - ip4addr.sin_port = htons (9998); - inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr); - - s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); - rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr)); - assert (rc > -1); - // send anonymous ZMTP/1.0 greeting - send (s, "\x01\x00", 2, 0); - // send sneaky message that shouldn't be received - send (s, "\x08\x00sneaky\0", 9, 0); - int timeout = 250; - zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); - char *buf = s_recv (server); - if (buf != NULL) { - printf ("Received unauthenticated message: %s\n", buf); - assert (buf == NULL); - } - close (s); - - // Check return codes for invalid buffer sizes - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - errno = 0; - rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 123); - assert (rc == -1 && errno == EINVAL); - errno = 0; - rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 123); - assert (rc == -1 && errno == EINVAL); - errno = 0; - rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 123); - assert (rc == -1 && errno == EINVAL); - rc = zmq_close (client); - assert (rc == 0); - - // Shutdown - rc = zmq_close (server); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - // Wait until ZAP handler terminates - zmq_threadclose (zap_thread); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_security_null.cpp b/zeromq/zeromq-4.1.4/tests/test_security_null.cpp deleted file mode 100644 index e95a7c9da5..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_security_null.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#if defined (ZMQ_HAVE_WINDOWS) -# include -# include -# include -# define close closesocket -#else -# include -# include -# include -# include -#endif - -static void -zap_handler (void *handler) -{ - // Process ZAP requests forever - while (true) { - char *version = s_recv (handler); - if (!version) - break; // Terminating - - char *sequence = s_recv (handler); - char *domain = s_recv (handler); - char *address = s_recv (handler); - char *identity = s_recv (handler); - char *mechanism = s_recv (handler); - - assert (streq (version, "1.0")); - assert (streq (mechanism, "NULL")); - - s_sendmore (handler, version); - s_sendmore (handler, sequence); - if (streq (domain, "TEST")) { - s_sendmore (handler, "200"); - s_sendmore (handler, "OK"); - s_sendmore (handler, "anonymous"); - s_send (handler, ""); - } - else { - s_sendmore (handler, "400"); - s_sendmore (handler, "BAD DOMAIN"); - s_sendmore (handler, ""); - s_send (handler, ""); - } - free (version); - free (sequence); - free (domain); - free (address); - free (identity); - free (mechanism); - } - close_zero_linger (handler); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Spawn ZAP handler - // We create and bind ZAP socket in main thread to avoid case - // where child thread does not start up fast enough. - void *handler = zmq_socket (ctx, ZMQ_REP); - assert (handler); - int rc = zmq_bind (handler, "inproc://zeromq.zap.01"); - assert (rc == 0); - void *zap_thread = zmq_threadstart (&zap_handler, handler); - - // We bounce between a binding server and a connecting client - - // We first test client/server with no ZAP domain - // Libzmq does not call our ZAP handler, the connect must succeed - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_bind (server, "tcp://127.0.0.1:9000"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127.0.0.1:9000"); - assert (rc == 0); - bounce (server, client); - close_zero_linger (client); - close_zero_linger (server); - - // Now define a ZAP domain for the server; this enables - // authentication. We're using the wrong domain so this test - // must fail. - server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9001"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127.0.0.1:9001"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - close_zero_linger (server); - - // Now use the right domain, the test must pass - server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9002"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127.0.0.1:9002"); - assert (rc == 0); - bounce (server, client); - close_zero_linger (client); - close_zero_linger (server); - - // Unauthenticated messages from a vanilla socket shouldn't be received - server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9003"); - assert (rc == 0); - - struct sockaddr_in ip4addr; - int s; - - ip4addr.sin_family = AF_INET; - ip4addr.sin_port = htons(9003); - inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); - - s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); - rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr); - assert (rc > -1); - // send anonymous ZMTP/1.0 greeting - send (s, "\x01\x00", 2, 0); - // send sneaky message that shouldn't be received - send (s, "\x08\x00sneaky\0", 9, 0); - int timeout = 250; - zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); - char *buf = s_recv (server); - if (buf != NULL) { - printf ("Received unauthenticated message: %s\n", buf); - assert (buf == NULL); - } - close (s); - close_zero_linger (server); - - // Shutdown - rc = zmq_ctx_term (ctx); - assert (rc == 0); - // Wait until ZAP handler terminates - zmq_threadclose (zap_thread); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_security_plain.cpp b/zeromq/zeromq-4.1.4/tests/test_security_plain.cpp deleted file mode 100644 index b76727fb7f..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_security_plain.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" -#if defined (ZMQ_HAVE_WINDOWS) -# include -# include -# include -# define close closesocket -#else -# include -# include -# include -# include -#endif - -static void -zap_handler (void *ctx) -{ - // Create and bind ZAP socket - void *zap = zmq_socket (ctx, ZMQ_REP); - assert (zap); - int rc = zmq_bind (zap, "inproc://zeromq.zap.01"); - assert (rc == 0); - - // Process ZAP requests forever - while (true) { - char *version = s_recv (zap); - if (!version) - break; // Terminating - char *sequence = s_recv (zap); - char *domain = s_recv (zap); - char *address = s_recv (zap); - char *identity = s_recv (zap); - char *mechanism = s_recv (zap); - char *username = s_recv (zap); - char *password = s_recv (zap); - - assert (streq (version, "1.0")); - assert (streq (mechanism, "PLAIN")); - assert (streq (identity, "IDENT")); - - s_sendmore (zap, version); - s_sendmore (zap, sequence); - if (streq (username, "admin") - && streq (password, "password")) { - s_sendmore (zap, "200"); - s_sendmore (zap, "OK"); - s_sendmore (zap, "anonymous"); - s_send (zap, ""); - } - else { - s_sendmore (zap, "400"); - s_sendmore (zap, "Invalid username or password"); - s_sendmore (zap, ""); - s_send (zap, ""); - } - free (version); - free (sequence); - free (domain); - free (address); - free (identity); - free (mechanism); - free (username); - free (password); - } - rc = zmq_close (zap); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Spawn ZAP handler - void *zap_thread = zmq_threadstart (&zap_handler, ctx); - - // Server socket will accept connections - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - int rc = zmq_setsockopt (server, ZMQ_IDENTITY, "IDENT", 6); - assert (rc == 0); - int as_server = 1; - rc = zmq_setsockopt (server, ZMQ_PLAIN_SERVER, &as_server, sizeof (int)); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9998"); - assert (rc == 0); - - char username [256]; - char password [256]; - - // Check PLAIN security with correct username/password - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - strcpy (username, "admin"); - rc = zmq_setsockopt (client, ZMQ_PLAIN_USERNAME, username, strlen (username)); - assert (rc == 0); - strcpy (password, "password"); - rc = zmq_setsockopt (client, ZMQ_PLAIN_PASSWORD, password, strlen (password)); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - bounce (server, client); - rc = zmq_close (client); - assert (rc == 0); - - // Check PLAIN security with badly configured client (as_server) - // This will be caught by the plain_server class, not passed to ZAP - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - as_server = 1; - rc = zmq_setsockopt (client, ZMQ_PLAIN_SERVER, &as_server, sizeof (int)); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Check PLAIN security -- failed authentication - client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - strcpy (username, "wronguser"); - strcpy (password, "wrongpass"); - rc = zmq_setsockopt (client, ZMQ_PLAIN_USERNAME, username, strlen (username)); - assert (rc == 0); - rc = zmq_setsockopt (client, ZMQ_PLAIN_PASSWORD, password, strlen (password)); - assert (rc == 0); - rc = zmq_connect (client, "tcp://localhost:9998"); - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); - - // Unauthenticated messages from a vanilla socket shouldn't be received - struct sockaddr_in ip4addr; - int s; - - ip4addr.sin_family = AF_INET; - ip4addr.sin_port = htons (9998); - inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr); - - s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); - rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr)); - assert (rc > -1); - // send anonymous ZMTP/1.0 greeting - send (s, "\x01\x00", 2, 0); - // send sneaky message that shouldn't be received - send (s, "\x08\x00sneaky\0", 9, 0); - int timeout = 250; - zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); - char *buf = s_recv (server); - if (buf != NULL) { - printf ("Received unauthenticated message: %s\n", buf); - assert (buf == NULL); - } - close (s); - - // Shutdown - rc = zmq_close (server); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - // Wait until ZAP handler terminates - zmq_threadclose (zap_thread); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_shutdown_stress.cpp b/zeromq/zeromq-4.1.4/tests/test_shutdown_stress.cpp deleted file mode 100644 index e4e1658b54..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_shutdown_stress.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -#define THREAD_COUNT 100 - -extern "C" -{ - static void worker (void *s) - { - int rc; - - rc = zmq_connect (s, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Start closing the socket while the connecting process is underway. - rc = zmq_close (s); - assert (rc == 0); - } -} - -int main (void) -{ - setup_test_environment(); - void *s1; - void *s2; - int i; - int j; - int rc; - void* threads [THREAD_COUNT]; - - for (j = 0; j != 10; j++) { - - // Check the shutdown with many parallel I/O threads. - void *ctx = zmq_ctx_new (); - assert (ctx); - zmq_ctx_set (ctx, ZMQ_IO_THREADS, 7); - - s1 = zmq_socket (ctx, ZMQ_PUB); - assert (s1); - - rc = zmq_bind (s1, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - for (i = 0; i != THREAD_COUNT; i++) { - s2 = zmq_socket (ctx, ZMQ_SUB); - assert (s2); - threads [i] = zmq_threadstart(&worker, s2); - } - - for (i = 0; i != THREAD_COUNT; i++) { - zmq_threadclose(threads [i]); - } - - rc = zmq_close (s1); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - } - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_shutdown_stress_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_shutdown_stress_tipc.cpp deleted file mode 100644 index ac8e72b35c..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_shutdown_stress_tipc.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 iMatix Corporation - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "../include/zmq.h" -#include -#include -#include - -#undef NDEBUG -#include - -#define THREAD_COUNT 100 - -extern "C" -{ - static void *worker (void *s) - { - int rc; - - rc = zmq_connect (s, "tipc://{5560,0}"); - assert (rc == 0); - - // Start closing the socket while the connecting process is underway. - rc = zmq_close (s); - assert (rc == 0); - - return NULL; - } -} - -int main (void) -{ - void *ctx; - void *s1; - void *s2; - int i; - int j; - int rc; - pthread_t threads [THREAD_COUNT]; - - fprintf (stderr, "test_shutdown_stress_tipc running...\n"); - - for (j = 0; j != 10; j++) { - - // Check the shutdown with many parallel I/O threads. - ctx = zmq_init (7); - assert (ctx); - - s1 = zmq_socket (ctx, ZMQ_PUB); - assert (s1); - - rc = zmq_bind (s1, "tipc://{5560,0,0}"); - assert (rc == 0); - - for (i = 0; i != THREAD_COUNT; i++) { - s2 = zmq_socket (ctx, ZMQ_SUB); - assert (s2); - rc = pthread_create (&threads [i], NULL, worker, s2); - assert (rc == 0); - } - - for (i = 0; i != THREAD_COUNT; i++) { - rc = pthread_join (threads [i], NULL); - assert (rc == 0); - } - - rc = zmq_close (s1); - assert (rc == 0); - - rc = zmq_term (ctx); - assert (rc == 0); - } - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_spec_dealer.cpp b/zeromq/zeromq-4.1.4/tests/test_spec_dealer.cpp deleted file mode 100644 index 475a4dcd33..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_spec_dealer.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const char *bind_address = 0; -const char *connect_address = 0; - -void test_round_robin_out (void *ctx) -{ - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - - int rc = zmq_bind (dealer, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *rep [services]; - for (size_t peer = 0; peer < services; ++peer) { - rep [peer] = zmq_socket (ctx, ZMQ_REP); - assert (rep [peer]); - - int timeout = 250; - rc = zmq_setsockopt (rep [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (rep [peer], connect_address); - assert (rc == 0); - } - - // Wait for connections. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - // Send all requests - for (size_t i = 0; i < services; ++i) - s_send_seq (dealer, 0, "ABC", SEQ_END); - - // Expect every REP got one message - zmq_msg_t msg; - zmq_msg_init (&msg); - - for (size_t peer = 0; peer < services; ++peer) - s_recv_seq (rep [peer], "ABC", SEQ_END); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (dealer); - - for (size_t peer = 0; peer < services; ++peer) - close_zero_linger (rep [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_fair_queue_in (void *ctx) -{ - void *receiver = zmq_socket (ctx, ZMQ_DEALER); - assert (receiver); - - int timeout = 250; - int rc = zmq_setsockopt (receiver, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_bind (receiver, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *senders [services]; - for (size_t peer = 0; peer < services; ++peer) { - senders [peer] = zmq_socket (ctx, ZMQ_DEALER); - assert (senders [peer]); - - rc = zmq_setsockopt (senders [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (senders [peer], connect_address); - assert (rc == 0); - } - - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - - s_send_seq (senders [0], "A", SEQ_END); - s_recv_seq (receiver, "A", SEQ_END); - - s_send_seq (senders [0], "A", SEQ_END); - s_recv_seq (receiver, "A", SEQ_END); - - // send our requests - for (size_t peer = 0; peer < services; ++peer) - s_send_seq (senders [peer], "B", SEQ_END); - - // Wait for data. - rc = zmq_poll (0, 0, 50); - assert (rc == 0); - - // handle the requests - for (size_t peer = 0; peer < services; ++peer) - s_recv_seq (receiver, "B", SEQ_END); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (receiver); - - for (size_t peer = 0; peer < services; ++peer) - close_zero_linger (senders [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_destroy_queue_on_disconnect (void *ctx) -{ - void *A = zmq_socket (ctx, ZMQ_DEALER); - assert (A); - - int rc = zmq_bind (A, bind_address); - assert (rc == 0); - - void *B = zmq_socket (ctx, ZMQ_DEALER); - assert (B); - - rc = zmq_connect (B, connect_address); - assert (rc == 0); - - // Send a message in both directions - s_send_seq (A, "ABC", SEQ_END); - s_send_seq (B, "DEF", SEQ_END); - - rc = zmq_disconnect (B, connect_address); - assert (rc == 0); - - // Disconnect may take time and need command processing. - zmq_pollitem_t poller [2] = { { A, 0, 0, 0 }, { B, 0, 0, 0 } }; - rc = zmq_poll (poller, 2, 100); - assert (rc == 0); - rc = zmq_poll (poller, 2, 100); - assert (rc == 0); - - // No messages should be available, sending should fail. - zmq_msg_t msg; - zmq_msg_init (&msg); - - rc = zmq_send (A, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_msg_recv (&msg, A, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - // After a reconnect of B, the messages should still be gone - rc = zmq_connect (B, connect_address); - assert (rc == 0); - - rc = zmq_msg_recv (&msg, A, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_msg_recv (&msg, B, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (A); - close_zero_linger (B); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_block_on_send_no_peers (void *ctx) -{ - void *sc = zmq_socket (ctx, ZMQ_DEALER); - assert (sc); - - int timeout = 250; - int rc = zmq_setsockopt (sc, ZMQ_SNDTIMEO, &timeout, sizeof (timeout)); - assert (rc == 0); - - rc = zmq_send (sc, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_send (sc, 0, 0, 0); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_close (sc); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" }; - const char *connects [] = { "inproc://a", "tcp://localhost:5555" }; - - for (int transports = 0; transports < 2; ++transports) { - bind_address = binds [transports]; - connect_address = connects [transports]; - - // SHALL route outgoing messages to available peers using a round-robin - // strategy. - test_round_robin_out (ctx); - - // SHALL receive incoming messages from its peers using a fair-queuing - // strategy. - test_fair_queue_in (ctx); - - // SHALL block on sending, or return a suitable error, when it has no connected peers. - test_block_on_send_no_peers (ctx); - - // SHALL create a double queue when a peer connects to it. If this peer - // disconnects, the DEALER socket SHALL destroy its double queue and SHALL - // discard any messages it contains. - // *** Test disabled until libzmq does this properly *** - // test_destroy_queue_on_disconnect (ctx); - } - - int rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_spec_pushpull.cpp b/zeromq/zeromq-4.1.4/tests/test_spec_pushpull.cpp deleted file mode 100644 index 40d15a0cec..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_spec_pushpull.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const char *bind_address = 0; -const char *connect_address = 0; - -void test_push_round_robin_out (void *ctx) -{ - void *push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - - int rc = zmq_bind (push, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *pulls [services]; - for (size_t peer = 0; peer < services; ++peer) { - pulls [peer] = zmq_socket (ctx, ZMQ_PULL); - assert (pulls [peer]); - - int timeout = 250; - rc = zmq_setsockopt (pulls [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (pulls [peer], connect_address); - assert (rc == 0); - } - - // Wait for connections. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - // Send 2N messages - for (size_t peer = 0; peer < services; ++peer) - s_send_seq (push, "ABC", SEQ_END); - for (size_t peer = 0; peer < services; ++peer) - s_send_seq (push, "DEF", SEQ_END); - - // Expect every PULL got one of each - for (size_t peer = 0; peer < services; ++peer) { - s_recv_seq (pulls [peer], "ABC", SEQ_END); - s_recv_seq (pulls [peer], "DEF", SEQ_END); - } - - close_zero_linger (push); - - for (size_t peer = 0; peer < services; ++peer) - close_zero_linger (pulls [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_pull_fair_queue_in (void *ctx) -{ - void *pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - - int rc = zmq_bind (pull, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *pushs [services]; - for (size_t peer = 0; peer < services; ++peer) - { - pushs [peer] = zmq_socket (ctx, ZMQ_PUSH); - assert (pushs [peer]); - - rc = zmq_connect (pushs [peer], connect_address); - assert (rc == 0); - } - - // Wait for connections. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - int first_half = 0; - int second_half = 0; - - // Send 2N messages - for (size_t peer = 0; peer < services; ++peer) { - char *str = strdup("A"); - - str [0] += peer; - s_send_seq (pushs [peer], str, SEQ_END); - first_half += str [0]; - - str [0] += services; - s_send_seq (pushs [peer], str, SEQ_END); - second_half += str [0]; - - free (str); - } - - // Wait for data. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - - // Expect to pull one from each first - for (size_t peer = 0; peer < services; ++peer) { - rc = zmq_msg_recv (&msg, pull, 0); - assert (rc == 2); - const char *str = (const char *)zmq_msg_data (&msg); - first_half -= str [0]; - } - assert (first_half == 0); - - // And then get the second batch - for (size_t peer = 0; peer < services; ++peer) { - rc = zmq_msg_recv (&msg, pull, 0); - assert (rc == 2); - const char *str = (const char *)zmq_msg_data (&msg); - second_half -= str [0]; - } - assert (second_half == 0); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (pull); - - for (size_t peer = 0; peer < services; ++peer) - close_zero_linger (pushs [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_push_block_on_send_no_peers (void *ctx) -{ - void *sc = zmq_socket (ctx, ZMQ_PUSH); - assert (sc); - - int timeout = 250; - int rc = zmq_setsockopt (sc, ZMQ_SNDTIMEO, &timeout, sizeof (timeout)); - assert (rc == 0); - - rc = zmq_send (sc, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_send (sc, 0, 0, 0); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_close (sc); - assert (rc == 0); -} - -void test_destroy_queue_on_disconnect (void *ctx) -{ - void *A = zmq_socket (ctx, ZMQ_PUSH); - assert (A); - - int hwm = 1; - int rc = zmq_setsockopt (A, ZMQ_SNDHWM, &hwm, sizeof (hwm)); - assert (rc == 0); - - rc = zmq_bind (A, bind_address); - assert (rc == 0); - - void *B = zmq_socket (ctx, ZMQ_PULL); - assert (B); - - rc = zmq_setsockopt (B, ZMQ_RCVHWM, &hwm, sizeof (hwm)); - assert (rc == 0); - - rc = zmq_connect (B, connect_address); - assert (rc == 0); - - // Send two messages, one should be stuck in A's outgoing queue, the other - // arrives at B. - s_send_seq (A, "ABC", SEQ_END); - s_send_seq (A, "DEF", SEQ_END); - - // Both queues should now be full, indicated by A blocking on send. - rc = zmq_send (A, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_disconnect (B, connect_address); - assert (rc == 0); - - // Disconnect may take time and need command processing. - zmq_pollitem_t poller [2] = { { A, 0, 0, 0 }, { B, 0, 0, 0 } }; - rc = zmq_poll (poller, 2, 100); - assert (rc == 0); - rc = zmq_poll (poller, 2, 100); - assert (rc == 0); - - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - - // Can't receive old data on B. - rc = zmq_msg_recv (&msg, B, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - // Sending fails. - rc = zmq_send (A, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - // Reconnect B - rc = zmq_connect (B, connect_address); - assert (rc == 0); - - // Still can't receive old data on B. - rc = zmq_msg_recv (&msg, B, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - // two messages should be sendable before the queues are filled up. - s_send_seq (A, "ABC", SEQ_END); - s_send_seq (A, "DEF", SEQ_END); - - rc = zmq_send (A, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (A); - close_zero_linger (B); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" }; - const char *connects [] = { "inproc://a", "tcp://localhost:5555" }; - - for (int transport = 0; transport < 2; ++transport) { - bind_address = binds [transport]; - connect_address = connects [transport]; - - // PUSH: SHALL route outgoing messages to connected peers using a - // round-robin strategy. - test_push_round_robin_out (ctx); - - // PULL: SHALL receive incoming messages from its peers using a fair-queuing - // strategy. - test_pull_fair_queue_in (ctx); - - // PUSH: SHALL block on sending, or return a suitable error, when it has no - // available peers. - test_push_block_on_send_no_peers (ctx); - - // PUSH and PULL: SHALL create this queue when a peer connects to it. If - // this peer disconnects, the socket SHALL destroy its queue and SHALL - // discard any messages it contains. - // *** Test disabled until libzmq does this properly *** - // test_destroy_queue_on_disconnect (ctx); - } - - int rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_spec_rep.cpp b/zeromq/zeromq-4.1.4/tests/test_spec_rep.cpp deleted file mode 100644 index 8db053d38b..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_spec_rep.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const char *bind_address = 0; -const char *connect_address = 0; - -void test_fair_queue_in (void *ctx) -{ - void *rep = zmq_socket (ctx, ZMQ_REP); - assert (rep); - - int timeout = 250; - int rc = zmq_setsockopt (rep, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_bind (rep, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *reqs [services]; - for (size_t peer = 0; peer < services; ++peer) { - reqs [peer] = zmq_socket (ctx, ZMQ_REQ); - assert (reqs [peer]); - - rc = zmq_setsockopt (reqs [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (reqs [peer], connect_address); - assert (rc == 0); - } - - s_send_seq (reqs [0], "A", SEQ_END); - s_recv_seq (rep, "A", SEQ_END); - s_send_seq (rep, "A", SEQ_END); - s_recv_seq (reqs [0], "A", SEQ_END); - - s_send_seq (reqs [0], "A", SEQ_END); - s_recv_seq (rep, "A", SEQ_END); - s_send_seq (rep, "A", SEQ_END); - s_recv_seq (reqs [0], "A", SEQ_END); - - // TODO: following test fails randomly on some boxes -#ifdef SOMEONE_FIXES_THIS - // send N requests - for (size_t peer = 0; peer < services; ++peer) { - char * str = strdup("A"); - str [0] += peer; - s_send_seq (reqs [peer], str, SEQ_END); - free (str); - } - - // handle N requests - for (size_t peer = 0; peer < services; ++peer) { - char * str = strdup("A"); - str [0] += peer; - // Test fails here - s_recv_seq (rep, str, SEQ_END); - s_send_seq (rep, str, SEQ_END); - s_recv_seq (reqs [peer], str, SEQ_END); - free (str); - } -#endif - close_zero_linger (rep); - - for (size_t peer = 0; peer < services; ++peer) - close_zero_linger (reqs [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_envelope (void *ctx) -{ - void *rep = zmq_socket (ctx, ZMQ_REP); - assert (rep); - - int rc = zmq_bind (rep, bind_address); - assert (rc == 0); - - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - - rc = zmq_connect (dealer, connect_address); - assert (rc == 0); - - // minimal envelope - s_send_seq (dealer, 0, "A", SEQ_END); - s_recv_seq (rep, "A", SEQ_END); - s_send_seq (rep, "A", SEQ_END); - s_recv_seq (dealer, 0, "A", SEQ_END); - - // big envelope - s_send_seq (dealer, "X", "Y", 0, "A", SEQ_END); - s_recv_seq (rep, "A", SEQ_END); - s_send_seq (rep, "A", SEQ_END); - s_recv_seq (dealer, "X", "Y", 0, "A", SEQ_END); - - close_zero_linger (rep); - close_zero_linger (dealer); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" }; - const char *connects [] = { "inproc://a", "tcp://localhost:5555" }; - - for (int transport = 0; transport < 2; ++transport) { - bind_address = binds [transport]; - connect_address = connects [transport]; - - // SHALL receive incoming messages from its peers using a fair-queuing - // strategy. - test_fair_queue_in (ctx); - - // For an incoming message: - // SHALL remove and store the address envelope, including the delimiter. - // SHALL pass the remaining data frames to its calling application. - // SHALL wait for a single reply message from its calling application. - // SHALL prepend the address envelope and delimiter. - // SHALL deliver this message back to the originating peer. - test_envelope (ctx); - } - - int rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_spec_req.cpp b/zeromq/zeromq-4.1.4/tests/test_spec_req.cpp deleted file mode 100644 index 29f00e9256..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_spec_req.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const char *bind_address = 0; -const char *connect_address = 0; - -void test_round_robin_out (void *ctx) -{ - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - - int rc = zmq_bind (req, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *rep [services]; - for (size_t peer = 0; peer < services; peer++) { - rep [peer] = zmq_socket (ctx, ZMQ_REP); - assert (rep [peer]); - - int timeout = 250; - rc = zmq_setsockopt (rep [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_connect (rep [peer], connect_address); - assert (rc == 0); - } - // We have to give the connects time to finish otherwise the requests - // will not properly round-robin. We could alternatively connect the - // REQ sockets to the REP sockets. - msleep (SETTLE_TIME); - - // Send our peer-replies, and expect every REP it used once in order - for (size_t peer = 0; peer < services; peer++) { - s_send_seq (req, "ABC", SEQ_END); - s_recv_seq (rep [peer], "ABC", SEQ_END); - s_send_seq (rep [peer], "DEF", SEQ_END); - s_recv_seq (req, "DEF", SEQ_END); - } - - close_zero_linger (req); - for (size_t peer = 0; peer < services; peer++) - close_zero_linger (rep [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_req_only_listens_to_current_peer (void *ctx) -{ - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - - int rc = zmq_setsockopt(req, ZMQ_IDENTITY, "A", 2); - assert (rc == 0); - - rc = zmq_bind (req, bind_address); - assert (rc == 0); - - const size_t services = 3; - void *router [services]; - - for (size_t i = 0; i < services; ++i) { - router [i] = zmq_socket (ctx, ZMQ_ROUTER); - assert (router [i]); - - int timeout = 250; - rc = zmq_setsockopt (router [i], ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); - assert (rc == 0); - - int enabled = 1; - rc = zmq_setsockopt (router [i], ZMQ_ROUTER_MANDATORY, &enabled, sizeof (enabled)); - assert (rc == 0); - - rc = zmq_connect (router [i], connect_address); - assert (rc == 0); - } - - // Wait for connects to finish. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - for (size_t i = 0; i < services; ++i) { - // There still is a race condition when a stale peer's message - // arrives at the REQ just after a request was sent to that peer. - // To avoid that happening in the test, sleep for a bit. - rc = zmq_poll (0, 0, 10); - assert (rc == 0); - - s_send_seq (req, "ABC", SEQ_END); - - // Receive on router i - s_recv_seq (router [i], "A", 0, "ABC", SEQ_END); - - // Send back replies on all routers - for (size_t j = 0; j < services; ++j) { - const char *replies [] = { "WRONG", "GOOD" }; - const char *reply = replies [i == j ? 1 : 0]; - s_send_seq (router [j], "A", 0, reply, SEQ_END); - } - - // Receive only the good reply - s_recv_seq (req, "GOOD", SEQ_END); - } - - close_zero_linger (req); - for (size_t i = 0; i < services; ++i) - close_zero_linger (router [i]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_req_message_format (void *ctx) -{ - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - - void *router = zmq_socket (ctx, ZMQ_ROUTER); - assert (router); - - int rc = zmq_bind (req, bind_address); - assert (rc == 0); - - rc = zmq_connect (router, connect_address); - assert (rc == 0); - - // Send a multi-part request. - s_send_seq (req, "ABC", "DEF", SEQ_END); - - zmq_msg_t msg; - zmq_msg_init (&msg); - - // Receive peer identity - rc = zmq_msg_recv (&msg, router, 0); - assert (rc != -1); - assert (zmq_msg_size (&msg) > 0); - zmq_msg_t peer_id_msg; - zmq_msg_init (&peer_id_msg); - zmq_msg_copy (&peer_id_msg, &msg); - - int more = 0; - size_t more_size = sizeof (more); - rc = zmq_getsockopt (router, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - assert (more); - - // Receive the rest. - s_recv_seq (router, 0, "ABC", "DEF", SEQ_END); - - // Send back a single-part reply. - rc = zmq_msg_send (&peer_id_msg, router, ZMQ_SNDMORE); - assert (rc != -1); - s_send_seq (router, 0, "GHI", SEQ_END); - - // Receive reply. - s_recv_seq (req, "GHI", SEQ_END); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - rc = zmq_msg_close (&peer_id_msg); - assert (rc == 0); - - close_zero_linger (req); - close_zero_linger (router); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_block_on_send_no_peers (void *ctx) -{ - void *sc = zmq_socket (ctx, ZMQ_REQ); - assert (sc); - - int timeout = 250; - int rc = zmq_setsockopt (sc, ZMQ_SNDTIMEO, &timeout, sizeof (timeout)); - assert (rc == 0); - - rc = zmq_send (sc, 0, 0, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_send (sc, 0, 0, 0); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_close (sc); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" }; - const char *connects [] = { "inproc://a", "tcp://localhost:5555" }; - - for (int transport = 0; transport < 2; transport++) { - bind_address = binds [transport]; - connect_address = connects [transport]; - - // SHALL route outgoing messages to connected peers using a round-robin - // strategy. - test_round_robin_out (ctx); - - // The request and reply messages SHALL have this format on the wire: - // * A delimiter, consisting of an empty frame, added by the REQ socket. - // * One or more data frames, comprising the message visible to the - // application. - test_req_message_format (ctx); - - // SHALL block on sending, or return a suitable error, when it has no - // connected peers. - test_block_on_send_no_peers (ctx); - - // SHALL accept an incoming message only from the last peer that it sent a - // request to. - // SHALL discard silently any messages received from other peers. - // PH: this test is still failing; disabled for now to allow build to - // complete. - // test_req_only_listens_to_current_peer (ctx); - } - - int rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_spec_router.cpp b/zeromq/zeromq-4.1.4/tests/test_spec_router.cpp deleted file mode 100644 index e563f8f624..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_spec_router.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -const char *bind_address = 0; -const char *connect_address = 0; - -void test_fair_queue_in (void *ctx) -{ - void *receiver = zmq_socket (ctx, ZMQ_ROUTER); - assert (receiver); - - int timeout = 250; - int rc = zmq_setsockopt (receiver, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_bind (receiver, bind_address); - assert (rc == 0); - - const size_t services = 5; - void *senders [services]; - for (size_t peer = 0; peer < services; ++peer) { - senders [peer] = zmq_socket (ctx, ZMQ_DEALER); - assert (senders [peer]); - - rc = zmq_setsockopt (senders [peer], ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - char *str = strdup("A"); - str [0] += peer; - rc = zmq_setsockopt (senders [peer], ZMQ_IDENTITY, str, 2); - assert (rc == 0); - free (str); - - rc = zmq_connect (senders [peer], connect_address); - assert (rc == 0); - } - - zmq_msg_t msg; - rc = zmq_msg_init (&msg); - assert (rc == 0); - - s_send_seq (senders [0], "M", SEQ_END); - s_recv_seq (receiver, "A", "M", SEQ_END); - - s_send_seq (senders [0], "M", SEQ_END); - s_recv_seq (receiver, "A", "M", SEQ_END); - - int sum = 0; - - // send N requests - for (size_t peer = 0; peer < services; ++peer) { - s_send_seq (senders [peer], "M", SEQ_END); - sum += 'A' + peer; - } - - assert (sum == services * 'A' + services * (services - 1) / 2); - - // handle N requests - for (size_t peer = 0; peer < services; ++peer) { - rc = zmq_msg_recv (&msg, receiver, 0); - assert (rc == 2); - const char *id = (const char *)zmq_msg_data (&msg); - sum -= id [0]; - - s_recv_seq (receiver, "M", SEQ_END); - } - - assert (sum == 0); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (receiver); - - for (size_t peer = 0; peer < services; ++peer) - close_zero_linger (senders [peer]); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - -void test_destroy_queue_on_disconnect (void *ctx) -{ - void *A = zmq_socket (ctx, ZMQ_ROUTER); - assert (A); - - int enabled = 1; - int rc = zmq_setsockopt (A, ZMQ_ROUTER_MANDATORY, &enabled, sizeof (enabled)); - assert (rc == 0); - - rc = zmq_bind (A, bind_address); - assert (rc == 0); - - void *B = zmq_socket (ctx, ZMQ_DEALER); - assert (B); - - rc = zmq_setsockopt (B, ZMQ_IDENTITY, "B", 2); - assert (rc == 0); - - rc = zmq_connect (B, connect_address); - assert (rc == 0); - - // Wait for connection. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); - - // Send a message in both directions - s_send_seq (A, "B", "ABC", SEQ_END); - s_send_seq (B, "DEF", SEQ_END); - - rc = zmq_disconnect (B, connect_address); - assert (rc == 0); - - // Disconnect may take time and need command processing. - zmq_pollitem_t poller [2] = { { A, 0, 0, 0 }, { B, 0, 0, 0 } }; - rc = zmq_poll (poller, 2, 100); - assert (rc == 0); - rc = zmq_poll (poller, 2, 100); - assert (rc == 0); - - // No messages should be available, sending should fail. - zmq_msg_t msg; - zmq_msg_init (&msg); - - rc = zmq_send (A, "B", 2, ZMQ_SNDMORE | ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EHOSTUNREACH); - - rc = zmq_msg_recv (&msg, A, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - // After a reconnect of B, the messages should still be gone - rc = zmq_connect (B, connect_address); - assert (rc == 0); - - rc = zmq_msg_recv (&msg, A, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_msg_recv (&msg, B, ZMQ_DONTWAIT); - assert (rc == -1); - assert (errno == EAGAIN); - - rc = zmq_msg_close (&msg); - assert (rc == 0); - - close_zero_linger (A); - close_zero_linger (B); - - // Wait for disconnects. - rc = zmq_poll (0, 0, 100); - assert (rc == 0); -} - - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" }; - const char *connects [] = { "inproc://a", "tcp://localhost:5555" }; - - for (int transport = 0; transport < 2; ++transport) { - bind_address = binds [transport]; - connect_address = connects [transport]; - - // SHALL receive incoming messages from its peers using a fair-queuing - // strategy. - test_fair_queue_in (ctx); - - // SHALL create a double queue when a peer connects to it. If this peer - // disconnects, the ROUTER socket SHALL destroy its double queue and SHALL - // discard any messages it contains. - // *** Test disabled until libzmq does this properly *** - // test_destroy_queue_on_disconnect (ctx); - } - - int rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_srcfd.cpp b/zeromq/zeromq-4.1.4/tests/test_srcfd.cpp deleted file mode 100644 index 7f9f982eb0..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_srcfd.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -#define MSG_SIZE 20 - -#ifdef _WIN32 -#include -#include -#define usleep(a) Sleep((a) / 1000) -#else -#include -#include -#include -#endif - -int main (void) -{ - int rc; - - setup_test_environment(); - // Create the infrastructure - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *rep = zmq_socket (ctx, ZMQ_REP); - assert (rep); - void *req = zmq_socket (ctx, ZMQ_REQ); - assert (req); - - rc = zmq_bind(rep, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - rc = zmq_connect(req, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - char tmp[MSG_SIZE]; - zmq_send(req, tmp, MSG_SIZE, 0); - - zmq_msg_t msg; - rc = zmq_msg_init(&msg); - assert (rc == 0); - - zmq_recvmsg(rep, &msg, 0); - assert(zmq_msg_size(&msg) == MSG_SIZE); - - // get the messages source file descriptor - int srcFd = zmq_msg_get(&msg, ZMQ_SRCFD); - assert(srcFd >= 0); - - // get the remote endpoint - struct sockaddr_storage ss; - socklen_t addrlen = sizeof ss; - rc = getpeername (srcFd, (struct sockaddr*) &ss, &addrlen); - assert (rc == 0); - - char host [NI_MAXHOST]; - rc = getnameinfo ((struct sockaddr*) &ss, addrlen, host, sizeof host, NULL, 0, NI_NUMERICHOST); - assert (rc == 0); - - // assert it is localhost which connected - assert (strcmp(host, "127.0.0.1") == 0); - - rc = zmq_close (rep); - assert (rc == 0); - rc = zmq_close (req); - assert (rc == 0); - - // sleep a bit for the socket to be freed - usleep(30000); - - // getting name from closed socket will fail - rc = getpeername (srcFd, (struct sockaddr*) &ss, &addrlen); - assert (rc == -1); - assert (errno == EBADF); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} - diff --git a/zeromq/zeromq-4.1.4/tests/test_stream.cpp b/zeromq/zeromq-4.1.4/tests/test_stream.cpp deleted file mode 100644 index d241d148ea..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_stream.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -// ZMTP protocol greeting structure - -typedef unsigned char byte; -typedef struct { - byte signature [10]; // 0xFF 8*0x00 0x7F - byte version [2]; // 0x03 0x00 for ZMTP/3.0 - byte mechanism [20]; // "NULL" - byte as_server; - byte filler [31]; -} zmtp_greeting_t; - -#define ZMTP_DEALER 5 // Socket type constants - -// This is a greeting matching what 0MQ will send us; note the -// 8-byte size is set to 1 for backwards compatibility - -static zmtp_greeting_t greeting -= { { 0xFF, 0, 0, 0, 0, 0, 0, 0, 1, 0x7F }, { 3, 0 }, { 'N', 'U', 'L', 'L'}, 0, { 0 } }; - -static void -test_stream_to_dealer (void) -{ - int rc; - - // Set up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - // We'll be using this socket in raw mode - void *stream = zmq_socket (ctx, ZMQ_STREAM); - assert (stream); - - int zero = 0; - rc = zmq_setsockopt (stream, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_bind (stream, "tcp://127.0.0.1:5556"); - assert (rc == 0); - - // We'll be using this socket as the other peer - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - rc = zmq_setsockopt (dealer, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_connect (dealer, "tcp://localhost:5556"); - - // Send a message on the dealer socket - rc = zmq_send (dealer, "Hello", 5, 0); - assert (rc == 5); - - // Connecting sends a zero message - // First frame is identity - zmq_msg_t identity; - rc = zmq_msg_init (&identity); - assert (rc == 0); - rc = zmq_msg_recv (&identity, stream, 0); - assert (rc > 0); - assert (zmq_msg_more (&identity)); - - // Verify the existence of Peer-Address metadata - assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1")); - - // Second frame is zero - byte buffer [255]; - rc = zmq_recv (stream, buffer, 255, 0); - assert (rc == 0); - - // Verify the existence of Peer-Address metadata - assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1")); - - // Real data follows - // First frame is identity - rc = zmq_msg_recv (&identity, stream, 0); - assert (rc > 0); - assert (zmq_msg_more (&identity)); - - // Verify the existence of Peer-Address metadata - assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1")); - - // Second frame is greeting signature - rc = zmq_recv (stream, buffer, 255, 0); - assert (rc == 10); - assert (memcmp (buffer, greeting.signature, 10) == 0); - - // Send our own protocol greeting - rc = zmq_msg_send (&identity, stream, ZMQ_SNDMORE); - assert (rc > 0); - rc = zmq_send (stream, &greeting, sizeof (greeting), 0); - assert (rc == sizeof (greeting)); - - // Now we expect the data from the DEALER socket - // We want the rest of greeting along with the Ready command - int bytes_read = 0; - while (bytes_read < 97) { - // First frame is the identity of the connection (each time) - rc = zmq_msg_recv (&identity, stream, 0); - assert (rc > 0); - assert (zmq_msg_more (&identity)); - // Second frame contains the next chunk of data - rc = zmq_recv (stream, buffer + bytes_read, 255 - bytes_read, 0); - assert (rc >= 0); - bytes_read += rc; - } - - // First two bytes are major and minor version numbers. - assert (buffer [0] == 3); // ZMTP/3.0 - assert (buffer [1] == 0); - - // Mechanism is "NULL" - assert (memcmp (buffer + 2, "NULL\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0); - assert (memcmp (buffer + 54, "\4\51\5READY", 8) == 0); - assert (memcmp (buffer + 62, "\13Socket-Type\0\0\0\6DEALER", 22) == 0); - assert (memcmp (buffer + 84, "\10Identity\0\0\0\0", 13) == 0); - - // Announce we are ready - memcpy (buffer, "\4\51\5READY", 8); - memcpy (buffer + 8, "\13Socket-Type\0\0\0\6ROUTER", 22); - memcpy (buffer + 30, "\10Identity\0\0\0\0", 13); - - // Send Ready command - rc = zmq_msg_send (&identity, stream, ZMQ_SNDMORE); - assert (rc > 0); - rc = zmq_send (stream, buffer, 43, 0); - assert (rc == 43); - - // Now we expect the data from the DEALER socket - // First frame is, again, the identity of the connection - rc = zmq_msg_recv (&identity, stream, 0); - assert (rc > 0); - assert (zmq_msg_more (&identity)); - - // Third frame contains Hello message from DEALER - rc = zmq_recv (stream, buffer, sizeof buffer, 0); - assert (rc == 7); - - // Then we have a 5-byte message "Hello" - assert (buffer [0] == 0); // Flags = 0 - assert (buffer [1] == 5); // Size = 5 - assert (memcmp (buffer + 2, "Hello", 5) == 0); - - // Send "World" back to DEALER - rc = zmq_msg_send (&identity, stream, ZMQ_SNDMORE); - assert (rc > 0); - byte world [] = { 0, 5, 'W', 'o', 'r', 'l', 'd' }; - rc = zmq_send (stream, world, sizeof (world), 0); - assert (rc == sizeof (world)); - - // Expect response on DEALER socket - rc = zmq_recv (dealer, buffer, 255, 0); - assert (rc == 5); - assert (memcmp (buffer, "World", 5) == 0); - - rc = zmq_close (dealer); - assert (rc == 0); - - rc = zmq_close (stream); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - - -static void -test_stream_to_stream (void) -{ - int rc; - // Set-up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *server = zmq_socket (ctx, ZMQ_STREAM); - assert (server); - rc = zmq_bind (server, "tcp://127.0.0.1:9070"); - assert (rc == 0); - - void *client = zmq_socket (ctx, ZMQ_STREAM); - assert (client); - rc = zmq_connect (client, "tcp://localhost:9070"); - assert (rc == 0); - uint8_t id [256]; - size_t id_size = 256; - uint8_t buffer [256]; - - // Connecting sends a zero message - // Server: First frame is identity, second frame is zero - id_size = zmq_recv (server, id, 256, 0); - assert (id_size > 0); - rc = zmq_recv (server, buffer, 256, 0); - assert (rc == 0); - // Client: First frame is identity, second frame is zero - id_size = zmq_recv (client, id, 256, 0); - assert (id_size > 0); - rc = zmq_recv (client, buffer, 256, 0); - assert (rc == 0); - - // Sent HTTP request on client socket - // Get server identity - rc = zmq_getsockopt (client, ZMQ_IDENTITY, id, &id_size); - assert (rc == 0); - // First frame is server identity - rc = zmq_send (client, id, id_size, ZMQ_SNDMORE); - assert (rc == (int) id_size); - // Second frame is HTTP GET request - rc = zmq_send (client, "GET /\n\n", 7, 0); - assert (rc == 7); - - // Get HTTP request; ID frame and then request - id_size = zmq_recv (server, id, 256, 0); - assert (id_size > 0); - rc = zmq_recv (server, buffer, 256, 0); - assert (rc != -1); - assert (memcmp (buffer, "GET /\n\n", 7) == 0); - - // Send reply back to client - char http_response [] = - "HTTP/1.0 200 OK\r\n" - "Content-Type: text/plain\r\n" - "\r\n" - "Hello, World!"; - rc = zmq_send (server, id, id_size, ZMQ_SNDMORE); - assert (rc != -1); - rc = zmq_send (server, http_response, sizeof (http_response), ZMQ_SNDMORE); - assert (rc != -1); - - // Send zero to close connection to client - rc = zmq_send (server, id, id_size, ZMQ_SNDMORE); - assert (rc != -1); - rc = zmq_send (server, NULL, 0, ZMQ_SNDMORE); - assert (rc != -1); - - // Get reply at client and check that it's complete - id_size = zmq_recv (client, id, 256, 0); - assert (id_size > 0); - rc = zmq_recv (client, buffer, 256, 0); - assert (rc == sizeof (http_response)); - assert (memcmp (buffer, http_response, sizeof (http_response)) == 0); - - // // Get disconnection notification - // FIXME: why does this block? Bug in STREAM disconnect notification? - // id_size = zmq_recv (client, id, 256, 0); - // assert (id_size > 0); - // rc = zmq_recv (client, buffer, 256, 0); - // assert (rc == 0); - - rc = zmq_close (server); - assert (rc == 0); - - rc = zmq_close (client); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - - -int main (void) -{ - setup_test_environment(); - test_stream_to_dealer (); - test_stream_to_stream (); -} diff --git a/zeromq/zeromq-4.1.4/tests/test_stream_disconnect.cpp b/zeromq/zeromq-4.1.4/tests/test_stream_disconnect.cpp deleted file mode 100644 index 125023b80d..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_stream_disconnect.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* - Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -static const int SERVER = 0; -static const int CLIENT = 1; - -struct test_message_t { - int turn; - const char * text; -}; - -// NOTE: messages are sent without null terminator. -const test_message_t dialog [] = { - {CLIENT, "i can haz cheez burger?"}, - {SERVER, "y u no disonnect?"}, - {CLIENT, ""}, -}; -const int steps = sizeof(dialog) / sizeof(dialog[0]); - -bool has_more (void* socket) -{ - int more = 0; - size_t more_size = sizeof(more); - int rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - if (rc != 0) - return false; - return more != 0; -} - -bool get_identity (void* socket, char* data, size_t* size) -{ - int rc = zmq_getsockopt (socket, ZMQ_IDENTITY, data, size); - return rc == 0; -} - -int main(int, char**) -{ - setup_test_environment(); - - void* context = zmq_ctx_new (); - void* sockets [2]; - int rc = 0; - - sockets [SERVER] = zmq_socket (context, ZMQ_STREAM); - rc = zmq_bind (sockets [SERVER], "tcp://0.0.0.0:6666"); - assert (rc == 0); - - sockets [CLIENT] = zmq_socket (context, ZMQ_STREAM); - rc = zmq_connect (sockets [CLIENT], "tcp://localhost:6666"); - assert (rc == 0); - - // wait for connect notification - // Server: Grab the 1st frame (peer identity). - zmq_msg_t peer_frame; - rc = zmq_msg_init (&peer_frame); - assert (rc == 0); - rc = zmq_msg_recv (&peer_frame, sockets [SERVER], 0); - assert (rc != -1); - assert(zmq_msg_size (&peer_frame) > 0); - assert (has_more (sockets [SERVER])); - - // Server: Grab the 2nd frame (actual payload). - zmq_msg_t data_frame; - rc = zmq_msg_init (&data_frame); - assert (rc == 0); - rc = zmq_msg_recv (&data_frame, sockets [SERVER], 0); - assert (rc != -1); - assert(zmq_msg_size (&data_frame) == 0); - - // Client: Grab the 1st frame (peer identity). - rc = zmq_msg_init (&peer_frame); - assert (rc == 0); - rc = zmq_msg_recv (&peer_frame, sockets [CLIENT], 0); - assert (rc != -1); - assert(zmq_msg_size (&peer_frame) > 0); - assert (has_more (sockets [CLIENT])); - - // Client: Grab the 2nd frame (actual payload). - rc = zmq_msg_init (&data_frame); - assert (rc == 0); - rc = zmq_msg_recv (&data_frame, sockets [CLIENT], 0); - assert (rc != -1); - assert(zmq_msg_size (&data_frame) == 0); - - // Send initial message. - char blob_data [256]; - size_t blob_size = sizeof(blob_data); - rc = zmq_getsockopt (sockets [CLIENT], ZMQ_IDENTITY, blob_data, &blob_size); - assert (rc != -1); - assert(blob_size > 0); - zmq_msg_t msg; - rc = zmq_msg_init_size (&msg, blob_size); - assert (rc == 0); - memcpy (zmq_msg_data (&msg), blob_data, blob_size); - rc = zmq_msg_send (&msg, sockets [dialog [0].turn], ZMQ_SNDMORE); - assert (rc != -1); - rc = zmq_msg_close (&msg); - assert (rc == 0); - rc = zmq_msg_init_size (&msg, strlen(dialog [0].text)); - assert (rc == 0); - memcpy (zmq_msg_data (&msg), dialog [0].text, strlen(dialog [0].text)); - rc = zmq_msg_send (&msg, sockets [dialog [0].turn], ZMQ_SNDMORE); - assert (rc != -1); - rc = zmq_msg_close (&msg); - assert (rc == 0); - - // TODO: make sure this loop doesn't loop forever if something is wrong - // with the test (or the implementation). - - int step = 0; - while (step < steps) { - // Wait until something happens. - zmq_pollitem_t items [] = { - { sockets [SERVER], 0, ZMQ_POLLIN, 0 }, - { sockets [CLIENT], 0, ZMQ_POLLIN, 0 }, - }; - int rc = zmq_poll (items, 2, 100); - assert (rc >= 0); - - // Check for data received by the server. - if (items [SERVER].revents & ZMQ_POLLIN) { - assert (dialog [step].turn == CLIENT); - - // Grab the 1st frame (peer identity). - zmq_msg_t peer_frame; - rc = zmq_msg_init (&peer_frame); - assert (rc == 0); - rc = zmq_msg_recv (&peer_frame, sockets [SERVER], 0); - assert (rc != -1); - assert(zmq_msg_size (&peer_frame) > 0); - assert (has_more (sockets [SERVER])); - - // Grab the 2nd frame (actual payload). - zmq_msg_t data_frame; - rc = zmq_msg_init (&data_frame); - assert (rc == 0); - rc = zmq_msg_recv (&data_frame, sockets [SERVER], 0); - assert (rc != -1); - - // Make sure payload matches what we expect. - const char * const data = (const char*)zmq_msg_data (&data_frame); - const int size = zmq_msg_size (&data_frame); - // 0-length frame is a disconnection notification. The server - // should receive it as the last step in the dialogue. - if (size == 0) { - ++step; - assert (step == steps); - } - else { - assert ((size_t) size == strlen (dialog [step].text)); - int cmp = memcmp (dialog [step].text, data, size); - assert (cmp == 0); - - ++step; - - assert (step < steps); - - // Prepare the response. - rc = zmq_msg_close (&data_frame); - assert (rc == 0); - rc = zmq_msg_init_size (&data_frame, - strlen (dialog [step].text)); - assert (rc == 0); - memcpy (zmq_msg_data (&data_frame), dialog [step].text, - zmq_msg_size (&data_frame)); - - // Send the response. - rc = zmq_msg_send (&peer_frame, sockets [SERVER], ZMQ_SNDMORE); - assert (rc != -1); - rc = zmq_msg_send (&data_frame, sockets [SERVER], ZMQ_SNDMORE); - assert (rc != -1); - } - - // Release resources. - rc = zmq_msg_close (&peer_frame); - assert (rc == 0); - rc = zmq_msg_close (&data_frame); - assert (rc == 0); - } - - // Check for data received by the client. - if (items [CLIENT].revents & ZMQ_POLLIN) { - assert (dialog [step].turn == SERVER); - - // Grab the 1st frame (peer identity). - zmq_msg_t peer_frame; - rc = zmq_msg_init (&peer_frame); - assert (rc == 0); - rc = zmq_msg_recv (&peer_frame, sockets [CLIENT], 0); - assert (rc != -1); - assert(zmq_msg_size (&peer_frame) > 0); - assert (has_more (sockets [CLIENT])); - - // Grab the 2nd frame (actual payload). - zmq_msg_t data_frame; - rc = zmq_msg_init (&data_frame); - assert (rc == 0); - rc = zmq_msg_recv (&data_frame, sockets [CLIENT], 0); - assert (rc != -1); - assert(zmq_msg_size (&data_frame) > 0); - - // Make sure payload matches what we expect. - const char * const data = (const char*)zmq_msg_data (&data_frame); - const int size = zmq_msg_size (&data_frame); - assert ((size_t)size == strlen(dialog [step].text)); - int cmp = memcmp(dialog [step].text, data, size); - assert (cmp == 0); - - ++step; - - // Prepare the response (next line in the dialog). - assert (step < steps); - rc = zmq_msg_close (&data_frame); - assert (rc == 0); - rc = zmq_msg_init_size (&data_frame, strlen (dialog [step].text)); - assert (rc == 0); - memcpy (zmq_msg_data (&data_frame), dialog [step].text, zmq_msg_size (&data_frame)); - - // Send the response. - rc = zmq_msg_send (&peer_frame, sockets [CLIENT], ZMQ_SNDMORE); - assert (rc != -1); - rc = zmq_msg_send (&data_frame, sockets [CLIENT], ZMQ_SNDMORE); - assert (rc != -1); - - // Release resources. - rc = zmq_msg_close (&peer_frame); - assert (rc == 0); - rc = zmq_msg_close (&data_frame); - assert (rc == 0); - } - } - assert (step == steps); - rc = zmq_close (sockets [CLIENT]); - assert (rc == 0); - rc = zmq_close (sockets [SERVER]); - assert (rc == 0); - rc = zmq_ctx_term (context); - assert (rc == 0); - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_stream_empty.cpp b/zeromq/zeromq-4.1.4/tests/test_stream_empty.cpp deleted file mode 100644 index 463024b659..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_stream_empty.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) { - setup_test_environment (); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *stream = zmq_socket (ctx, ZMQ_STREAM); - assert (stream); - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - - int rc = zmq_bind (stream, "tcp://127.0.0.1:5555"); - assert (rc >= 0); - rc = zmq_connect (dealer, "tcp://127.0.0.1:5555"); - assert (rc >= 0); - zmq_send (dealer, "", 0, 0); - - zmq_msg_t ident, empty; - zmq_msg_init (&ident); - rc = zmq_msg_recv (&ident, stream, 0); - assert (rc >= 0); - rc = zmq_msg_init_data (&empty, (void *) "", 0, NULL, NULL); - assert (rc >= 0); - - rc = zmq_msg_send (&ident, stream, ZMQ_SNDMORE); - assert (rc >= 0); - rc = zmq_msg_close (&ident); - assert (rc >= 0); - - rc = zmq_msg_send (&empty, stream, 0); - assert (rc >= 0); - - // This close used to fail with Bad Address - rc = zmq_msg_close (&empty); - assert (rc >= 0); - - close_zero_linger (dealer); - close_zero_linger (stream); - zmq_ctx_term (ctx); -} diff --git a/zeromq/zeromq-4.1.4/tests/test_stream_timeout.cpp b/zeromq/zeromq-4.1.4/tests/test_stream_timeout.cpp deleted file mode 100644 index bc96728803..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_stream_timeout.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -// Read one event off the monitor socket; return value and address -// by reference, if not null, and event number by value. Returns -1 -// in case of error. - -static int -get_monitor_event (void *monitor, int *value, char **address) -{ - // First frame in message contains event number and value - zmq_msg_t msg; - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == -1) - return -1; // Interruped, presumably - assert (zmq_msg_more (&msg)); - - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - uint16_t event = *(uint16_t *) (data); - if (value) - *value = *(uint32_t *) (data + 2); - - // Second frame in message contains event address - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == -1) - return -1; // Interruped, presumably - assert (!zmq_msg_more (&msg)); - - if (address) { - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - size_t size = zmq_msg_size (&msg); - *address = (char *) malloc (size + 1); - memcpy (*address, data, size); - *address [size] = 0; - } - return event; -} - -static void -test_stream_handshake_timeout_accept (void) -{ - int rc; - - // Set up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - // We use this socket in raw mode, to make a connection and send nothing - void *stream = zmq_socket (ctx, ZMQ_STREAM); - assert (stream); - - int zero = 0; - rc = zmq_setsockopt (stream, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_connect (stream, "tcp://localhost:5557"); - assert (rc == 0); - - // We'll be using this socket to test TCP stream handshake timeout - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - rc = zmq_setsockopt (dealer, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - int val, tenth = 100; - size_t vsize = sizeof(val); - - // check for the expected default handshake timeout value - 30 sec - rc = zmq_getsockopt (dealer, ZMQ_HANDSHAKE_IVL, &val, &vsize); - assert (rc == 0); - assert (vsize == sizeof(val)); - assert (val == 30000); - // make handshake timeout faster - 1/10 sec - rc = zmq_setsockopt (dealer, ZMQ_HANDSHAKE_IVL, &tenth, sizeof (tenth)); - assert (rc == 0); - vsize = sizeof(val); - // make sure zmq_setsockopt changed the value - rc = zmq_getsockopt (dealer, ZMQ_HANDSHAKE_IVL, &val, &vsize); - assert (rc == 0); - assert (vsize == sizeof(val)); - assert (val == tenth); - - // Create and connect a socket for collecting monitor events on dealer - void *dealer_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (dealer_mon); - - rc = zmq_socket_monitor (dealer, "inproc://monitor-dealer", - ZMQ_EVENT_CONNECTED | ZMQ_EVENT_DISCONNECTED | ZMQ_EVENT_ACCEPTED); - assert (rc == 0); - - // Connect to the inproc endpoint so we'll get events - rc = zmq_connect (dealer_mon, "inproc://monitor-dealer"); - assert (rc == 0); - - // bind dealer socket to accept connection from non-sending stream socket - rc = zmq_bind (dealer, "tcp://127.0.0.1:5557"); - assert (rc == 0); - - // we should get ZMQ_EVENT_ACCEPTED and then ZMQ_EVENT_DISCONNECTED - int event = get_monitor_event (dealer_mon, NULL, NULL); - assert (event == ZMQ_EVENT_ACCEPTED); - event = get_monitor_event (dealer_mon, NULL, NULL); - assert (event == ZMQ_EVENT_DISCONNECTED); - - rc = zmq_close (dealer); - assert (rc == 0); - - rc = zmq_close (dealer_mon); - assert (rc == 0); - - rc = zmq_close (stream); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -static void -test_stream_handshake_timeout_connect (void) -{ - int rc; - - // Set up our context and sockets - void *ctx = zmq_ctx_new (); - assert (ctx); - - // We use this socket in raw mode, to accept a connection and send nothing - void *stream = zmq_socket (ctx, ZMQ_STREAM); - assert (stream); - - int zero = 0; - rc = zmq_setsockopt (stream, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - rc = zmq_bind (stream, "tcp://127.0.0.1:5556"); - assert (rc == 0); - - // We'll be using this socket to test TCP stream handshake timeout - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - assert (dealer); - rc = zmq_setsockopt (dealer, ZMQ_LINGER, &zero, sizeof (zero)); - assert (rc == 0); - int val, tenth = 100; - size_t vsize = sizeof(val); - - // check for the expected default handshake timeout value - 30 sec - rc = zmq_getsockopt (dealer, ZMQ_HANDSHAKE_IVL, &val, &vsize); - assert (rc == 0); - assert (vsize == sizeof(val)); - assert (val == 30000); - // make handshake timeout faster - 1/10 sec - rc = zmq_setsockopt (dealer, ZMQ_HANDSHAKE_IVL, &tenth, sizeof (tenth)); - assert (rc == 0); - vsize = sizeof(val); - // make sure zmq_setsockopt changed the value - rc = zmq_getsockopt (dealer, ZMQ_HANDSHAKE_IVL, &val, &vsize); - assert (rc == 0); - assert (vsize == sizeof(val)); - assert (val == tenth); - - // Create and connect a socket for collecting monitor events on dealer - void *dealer_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (dealer_mon); - - rc = zmq_socket_monitor (dealer, "inproc://monitor-dealer", - ZMQ_EVENT_CONNECTED | ZMQ_EVENT_DISCONNECTED | ZMQ_EVENT_ACCEPTED); - assert (rc == 0); - - // Connect to the inproc endpoint so we'll get events - rc = zmq_connect (dealer_mon, "inproc://monitor-dealer"); - assert (rc == 0); - - // connect dealer socket to non-sending stream socket - rc = zmq_connect (dealer, "tcp://localhost:5556"); - assert (rc == 0); - - // we should get ZMQ_EVENT_CONNECTED and then ZMQ_EVENT_DISCONNECTED - int event = get_monitor_event (dealer_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CONNECTED); - event = get_monitor_event (dealer_mon, NULL, NULL); - assert (event == ZMQ_EVENT_DISCONNECTED); - - rc = zmq_close (dealer); - assert (rc == 0); - - rc = zmq_close (dealer_mon); - assert (rc == 0); - - rc = zmq_close (stream); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); -} - -int main (void) -{ - setup_test_environment(); - test_stream_handshake_timeout_accept (); - test_stream_handshake_timeout_connect (); -} diff --git a/zeromq/zeromq-4.1.4/tests/test_sub_forward.cpp b/zeromq/zeromq-4.1.4/tests/test_sub_forward.cpp deleted file mode 100644 index f02328ded7..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_sub_forward.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // First, create an intermediate device - void *xpub = zmq_socket (ctx, ZMQ_XPUB); - assert (xpub); - int rc = zmq_bind (xpub, "tcp://127.0.0.1:5560"); - assert (rc == 0); - void *xsub = zmq_socket (ctx, ZMQ_XSUB); - assert (xsub); - rc = zmq_bind (xsub, "tcp://127.0.0.1:5561"); - assert (rc == 0); - - // Create a publisher - void *pub = zmq_socket (ctx, ZMQ_PUB); - assert (pub); - rc = zmq_connect (pub, "tcp://127.0.0.1:5561"); - assert (rc == 0); - - // Create a subscriber - void *sub = zmq_socket (ctx, ZMQ_SUB); - assert (sub); - rc = zmq_connect (sub, "tcp://127.0.0.1:5560"); - assert (rc == 0); - - // Subscribe for all messages. - rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - - // Pass the subscription upstream through the device - char buff [32]; - rc = zmq_recv (xpub, buff, sizeof (buff), 0); - assert (rc >= 0); - rc = zmq_send (xsub, buff, rc, 0); - assert (rc >= 0); - - // Wait a bit till the subscription gets to the publisher - msleep (SETTLE_TIME); - - // Send an empty message - rc = zmq_send (pub, NULL, 0, 0); - assert (rc == 0); - - // Pass the message downstream through the device - rc = zmq_recv (xsub, buff, sizeof (buff), 0); - assert (rc >= 0); - rc = zmq_send (xpub, buff, rc, 0); - assert (rc >= 0); - - // Receive the message in the subscriber - rc = zmq_recv (sub, buff, sizeof (buff), 0); - assert (rc == 0); - - // Clean up. - rc = zmq_close (xpub); - assert (rc == 0); - rc = zmq_close (xsub); - assert (rc == 0); - rc = zmq_close (pub); - assert (rc == 0); - rc = zmq_close (sub); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_sub_forward_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_sub_forward_tipc.cpp deleted file mode 100644 index de2f7fb16e..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_sub_forward_tipc.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 iMatix Corporation - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "../include/zmq.h" -#include "../include/zmq_utils.h" -#include - -#undef NDEBUG -#include - -#include "testutil.hpp" - -int main (void) -{ - fprintf (stderr, "test_sub_forward running...\n"); - - void *ctx = zmq_init (1); - assert (ctx); - - // First, create an intermediate device. - void *xpub = zmq_socket (ctx, ZMQ_XPUB); - assert (xpub); - int rc = zmq_bind (xpub, "tipc://{5560,0,0}"); - assert (rc == 0); - void *xsub = zmq_socket (ctx, ZMQ_XSUB); - assert (xsub); - rc = zmq_bind (xsub, "tipc://{5561,0,0}"); - assert (rc == 0); - - // Create a publisher. - void *pub = zmq_socket (ctx, ZMQ_PUB); - assert (pub); - rc = zmq_connect (pub, "tipc://{5561,0}"); - assert (rc == 0); - - // Create a subscriber. - void *sub = zmq_socket (ctx, ZMQ_SUB); - assert (sub); - rc = zmq_connect (sub, "tipc://{5560,0}"); - assert (rc == 0); - - // Subscribe for all messages. - rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - - // Pass the subscription upstream through the device. - char buff [32]; - rc = zmq_recv (xpub, buff, sizeof (buff), 0); - assert (rc >= 0); - rc = zmq_send (xsub, buff, rc, 0); - assert (rc >= 0); - - // Wait a bit till the subscription gets to the publisher. - msleep (SETTLE_TIME); - - // Send an empty message. - rc = zmq_send (pub, NULL, 0, 0); - assert (rc == 0); - - // Pass the message downstream through the device. - rc = zmq_recv (xsub, buff, sizeof (buff), 0); - assert (rc >= 0); - rc = zmq_send (xpub, buff, rc, 0); - assert (rc >= 0); - - // Receive the message in the subscriber. - rc = zmq_recv (sub, buff, sizeof (buff), 0); - assert (rc == 0); - - // Clean up. - rc = zmq_close (xpub); - assert (rc == 0); - rc = zmq_close (xsub); - assert (rc == 0); - rc = zmq_close (pub); - assert (rc == 0); - rc = zmq_close (sub); - assert (rc == 0); - rc = zmq_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_system.cpp b/zeromq/zeromq-4.1.4/tests/test_system.cpp deleted file mode 100644 index c8c4776cbc..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_system.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -#if defined (ZMQ_HAVE_WINDOWS) -# include -# include -#else -# include -# include -# include -#endif - -#if defined (ZMQ_HAVE_WINDOWS) - -void initialise_network (void) -{ - WSADATA info; - if (WSAStartup(MAKEWORD(2,0), &info) != 0) - throw std::runtime_error("Could not start WSA"); -} - -int close (int fd) -{ - return closesocket (fd); -} - -#else - -void initialise_network (void) -{ -} - -#endif - -// This test case stresses the system to shake out known configuration -// problems. We're direct system calls when necessary. Some code may -// need wrapping to be properly portable. - -int main (void) -{ - initialise_network (); - - // Check that we have local networking via ZeroMQ - void *ctx = zmq_ctx_new (); - assert (ctx); - void *dealer = zmq_socket (ctx, ZMQ_DEALER); - if (zmq_bind (dealer, "tcp://127.0.0.1:5670") == -1) { - printf ("E: Cannot find 127.0.0.1 -- your system does not have local\n"); - printf ("E: networking. Please fix this before running libzmq checks.\n"); - return -1; - } - // Check that we can create 1,000 sockets - int handle [1000]; - int count; - for (count = 0; count < 1000; count++) { - handle [count] = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (handle [count] == -1) { - printf ("W: Only able to create %d sockets on this box\n", count); - printf ("I: Tune your system to increase maximum allowed file handles\n"); -#if defined (ZMQ_HAVE_OSX) - printf ("I: On OS/X, run 'ulimit -n 1200' in bash"); -#elif defined (ZMQ_HAVE_LINUX) - printf ("I: On Linux, run 'ulimit -n 1200' in bash"); -#endif - return -1; - } - } - // Release the socket handles - while (count) - close (handle [count--]); -} diff --git a/zeromq/zeromq-4.1.4/tests/test_term_endpoint.cpp b/zeromq/zeromq-4.1.4/tests/test_term_endpoint.cpp deleted file mode 100644 index 4d08080cd0..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_term_endpoint.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - int rc; - const size_t buf_size = 32; - char buf[buf_size]; - const char *ep = "tcp://127.0.0.1:5560"; - const char *ep_wc_tcp = "tcp://127.0.0.1:*"; -#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS - const char *ep_wc_ipc = "ipc://*"; -#endif - - // Create infrastructure. - void *ctx = zmq_ctx_new (); - assert (ctx); - void *push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - rc = zmq_bind (push, ep); - assert (rc == 0); - void *pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - rc = zmq_connect (pull, ep); - assert (rc == 0); - - // Pass one message through to ensure the connection is established - rc = zmq_send (push, "ABC", 3, 0); - assert (rc == 3); - rc = zmq_recv (pull, buf, sizeof (buf), 0); - assert (rc == 3); - - // Unbind the listening endpoint - rc = zmq_unbind (push, ep); - assert (rc == 0); - - // Allow unbind to settle - msleep (SETTLE_TIME); - - // Check that sending would block (there's no outbound connection) - rc = zmq_send (push, "ABC", 3, ZMQ_DONTWAIT); - assert (rc == -1 && zmq_errno () == EAGAIN); - - // Clean up - rc = zmq_close (pull); - assert (rc == 0); - rc = zmq_close (push); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - // Create infrastructure - ctx = zmq_ctx_new (); - assert (ctx); - push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - rc = zmq_connect (push, ep); - assert (rc == 0); - pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - rc = zmq_bind (pull, ep); - assert (rc == 0); - - // Pass one message through to ensure the connection is established. - rc = zmq_send (push, "ABC", 3, 0); - assert (rc == 3); - rc = zmq_recv (pull, buf, sizeof (buf), 0); - assert (rc == 3); - - // Disconnect the bound endpoint - rc = zmq_disconnect (push, ep); - assert (rc == 0); - - // Allow disconnect to settle - msleep (SETTLE_TIME); - - // Check that sending would block (there's no inbound connections). - rc = zmq_send (push, "ABC", 3, ZMQ_DONTWAIT); - assert (rc == -1 && zmq_errno () == EAGAIN); - - // Clean up. - rc = zmq_close (pull); - assert (rc == 0); - rc = zmq_close (push); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - // Create infrastructure (wild-card binding) - ctx = zmq_ctx_new (); - assert (ctx); - push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - rc = zmq_bind (push, ep_wc_tcp); - assert (rc == 0); -#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS - pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - rc = zmq_bind (pull, ep_wc_ipc); - assert (rc == 0); -#endif - - // Unbind sockets binded by wild-card address - rc = zmq_getsockopt (push, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size); - assert (rc == 0); - rc = zmq_unbind (push, buf); - assert (rc == 0); -#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS - rc = zmq_getsockopt (pull, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size); - assert (rc == 0); - rc = zmq_unbind (pull, buf); - assert (rc == 0); -#endif - - // Create infrastructure (wild-card binding) - ctx = zmq_ctx_new (); - assert (ctx); - push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - rc = zmq_bind (push, ep_wc_tcp); - assert (rc == 0); -#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS - pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - rc = zmq_bind (pull, ep_wc_ipc); - assert (rc == 0); -#endif - - // Sockets binded by wild-card address can't be unbinded by wild-card address - rc = zmq_unbind (push, ep_wc_tcp); - assert (rc == -1 && zmq_errno () == ENOENT); -#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS - rc = zmq_unbind (pull, ep_wc_ipc); - assert (rc == -1 && zmq_errno () == ENOENT); -#endif - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_term_endpoint_tipc.cpp b/zeromq/zeromq-4.1.4/tests/test_term_endpoint_tipc.cpp deleted file mode 100644 index dc3b6d3f30..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_term_endpoint_tipc.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - Copyright (c) 2010-2011 250bpm s.r.o. - Copyright (c) 2011 iMatix Corporation - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "../include/zmq.h" -#include "../include/zmq_utils.h" -#include -#include - -#undef NDEBUG -#include - -#include "testutil.hpp" - -int main (void) -{ - int rc; - char buf[32]; - const char *ep = "tipc://{5560,0,0}"; - const char *name = "tipc://{5560,0}"; - - fprintf (stderr, "unbind endpoint test running...\n"); - - // Create infrastructure. - void *ctx = zmq_init (1); - assert (ctx); - void *push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - rc = zmq_bind (push, ep); - assert (rc == 0); - void *pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - rc = zmq_connect (pull, name); - assert (rc == 0); - - // Pass one message through to ensure the connection is established. - rc = zmq_send (push, "ABC", 3, 0); - assert (rc == 3); - rc = zmq_recv (pull, buf, sizeof (buf), 0); - assert (rc == 3); - - // Unbind the lisnening endpoint - rc = zmq_unbind (push, ep); - assert (rc == 0); - - // Let events some time - msleep (SETTLE_TIME); - - // Check that sending would block (there's no outbound connection). - rc = zmq_send (push, "ABC", 3, ZMQ_DONTWAIT); - assert (rc == -1 && zmq_errno () == EAGAIN); - - // Clean up. - rc = zmq_close (pull); - assert (rc == 0); - rc = zmq_close (push); - assert (rc == 0); - rc = zmq_term (ctx); - assert (rc == 0); - - - // Now the other way round. - fprintf (stderr, "disconnect endpoint test running...\n"); - - - // Create infrastructure. - ctx = zmq_init (1); - assert (ctx); - push = zmq_socket (ctx, ZMQ_PUSH); - assert (push); - rc = zmq_connect (push, name); - assert (rc == 0); - pull = zmq_socket (ctx, ZMQ_PULL); - assert (pull); - rc = zmq_bind (pull, ep); - assert (rc == 0); - - // Pass one message through to ensure the connection is established. - rc = zmq_send (push, "ABC", 3, 0); - assert (rc == 3); - rc = zmq_recv (pull, buf, sizeof (buf), 0); - assert (rc == 3); - - // Disconnect the bound endpoint - rc = zmq_disconnect (push, name); - assert (rc == 0); - - msleep (SETTLE_TIME); - - // Check that sending would block (there's no inbound connections). - rc = zmq_send (push, "ABC", 3, ZMQ_DONTWAIT); - assert (rc == -1 && zmq_errno () == EAGAIN); - - // Clean up. - rc = zmq_close (pull); - assert (rc == 0); - rc = zmq_close (push); - assert (rc == 0); - rc = zmq_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_timeo.cpp b/zeromq/zeromq-4.1.4/tests/test_timeo.cpp deleted file mode 100644 index 0e49d62242..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_timeo.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *frontend = zmq_socket (ctx, ZMQ_DEALER); - assert (frontend); - int rc = zmq_bind (frontend, "inproc://timeout_test"); - assert (rc == 0); - - // Receive on disconnected socket returns immediately - char buffer [32]; - rc = zmq_recv (frontend, buffer, 32, ZMQ_DONTWAIT); - assert (rc == -1); - assert (zmq_errno() == EAGAIN); - - // Check whether receive timeout is honored - int timeout = 250; - rc = zmq_setsockopt (frontend, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - void* stopwatch = zmq_stopwatch_start(); - rc = zmq_recv (frontend, buffer, 32, 0); - assert (rc == -1); - assert (zmq_errno () == EAGAIN); - unsigned int elapsed = zmq_stopwatch_stop(stopwatch) / 1000; - assert (elapsed > 200 && elapsed < 300); - - // Check that normal message flow works as expected - void *backend = zmq_socket (ctx, ZMQ_DEALER); - assert (backend); - rc = zmq_connect (backend, "inproc://timeout_test"); - assert (rc == 0); - rc = zmq_setsockopt (backend, ZMQ_SNDTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - - rc = zmq_send (backend, "Hello", 5, 0); - assert (rc == 5); - rc = zmq_recv (frontend, buffer, 32, 0); - assert (rc == 5); - - // Clean-up - rc = zmq_close (backend); - assert (rc == 0); - - rc = zmq_close (frontend); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_unbind_inproc.cpp b/zeromq/zeromq-4.1.4/tests/test_unbind_inproc.cpp deleted file mode 100644 index 2b1d8982b0..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_unbind_inproc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file - - This file is part of 0MQ. - - 0MQ is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - 0MQ is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_REP); - assert (sb); - int rc = zmq_bind (sb, "inproc://a"); - assert (rc == 0); - - rc = zmq_unbind (sb, "inproc://a"); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_unbind_wildcard.cpp b/zeromq/zeromq-4.1.4/tests/test_unbind_wildcard.cpp deleted file mode 100644 index dae1d423ae..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_unbind_wildcard.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file - - This file is part of 0MQ. - - 0MQ is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - 0MQ is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_REP); - assert (sb); - int rc = zmq_bind (sb, "tcp://*:5555"); - assert (rc == 0); - - char endpoint[256]; - size_t endpoint_len = sizeof (endpoint); - rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &endpoint_len); - assert (rc == 0); - - rc = zmq_unbind (sb, endpoint); - assert (rc == 0); - - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; -} diff --git a/zeromq/zeromq-4.1.4/tests/test_xpub_nodrop.cpp b/zeromq/zeromq-4.1.4/tests/test_xpub_nodrop.cpp deleted file mode 100644 index 387a4bfa52..0000000000 --- a/zeromq/zeromq-4.1.4/tests/test_xpub_nodrop.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#include "testutil.hpp" - -int main (void) -{ - setup_test_environment(); - void *ctx = zmq_ctx_new (); - assert (ctx); - - // Create a publisher - void *pub = zmq_socket (ctx, ZMQ_PUB); - assert (pub); - int rc = zmq_bind (pub, "inproc://soname"); - assert (rc == 0); - - // set pub socket options - int wait = 1; - rc = zmq_setsockopt (pub, ZMQ_XPUB_NODROP, &wait, 4); - assert (rc == 0); - - int hwm = 2000; - rc = zmq_setsockopt (pub, ZMQ_SNDHWM, &hwm, 4); - assert (rc == 0); - - // Create a subscriber - void *sub = zmq_socket (ctx, ZMQ_SUB); - assert (sub); - rc = zmq_connect (sub, "inproc://soname"); - assert (rc == 0); - - // Subscribe for all messages. - rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0); - assert (rc == 0); - - int hwmlimit = hwm - 1; - int send_count = 0; - - // Send an empty message - for (int i = 0; i < hwmlimit; i++) { - rc = zmq_send (pub, NULL, 0, 0); - assert (rc == 0); - send_count++; - } - - int recv_count = 0; - do { - // Receive the message in the subscriber - rc = zmq_recv (sub, NULL, 0, ZMQ_DONTWAIT); - if (rc == -1) - assert (errno == EAGAIN); - else { - assert (rc == 0); - recv_count++; - } - } - while (rc == 0); - - assert (send_count == recv_count); - - // Now test real blocking behavior - // Set a timeout, default is infinite - int timeout = 0; - rc = zmq_setsockopt (pub, ZMQ_SNDTIMEO, &timeout, 4); - assert (rc == 0); - - send_count = 0; - recv_count = 0; - hwmlimit = hwm; - - // Send an empty message until we get an error, which must be EAGAIN - while (zmq_send (pub, "", 0, 0) == 0) - send_count++; - assert (errno == EAGAIN); - - while (zmq_recv (sub, NULL, 0, ZMQ_DONTWAIT) == 0) - recv_count++; - assert (send_count == recv_count); - - // Clean up. - rc = zmq_close (pub); - assert (rc == 0); - rc = zmq_close (sub); - assert (rc == 0); - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0 ; -} diff --git a/zeromq/zeromq-4.1.4/tests/testutil.hpp b/zeromq/zeromq-4.1.4/tests/testutil.hpp deleted file mode 100644 index 1bf77dd81a..0000000000 --- a/zeromq/zeromq-4.1.4/tests/testutil.hpp +++ /dev/null @@ -1,303 +0,0 @@ -/* - Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef __TESTUTIL_HPP_INCLUDED__ -#define __TESTUTIL_HPP_INCLUDED__ - -#include "../include/zmq.h" -#include "../src/stdint.hpp" -#include "platform.hpp" - -// This defines the settle time used in tests; raise this if we -// get test failures on slower systems due to binds/connects not -// settled. Tested to work reliably at 1 msec on a fast PC. -#define SETTLE_TIME 10 // In msec - -#undef NDEBUG -#include -#include -#include -#include -#include - -#if defined _WIN32 -# if defined _MSC_VER -# include -# pragma warning(disable:4996) -# endif -#else -# include -# include -# include -# include -#endif - -// Bounce a message from client to server and back -// For REQ/REP or DEALER/DEALER pairs only - -void -bounce (void *server, void *client) -{ - const char *content = "12345678ABCDEFGH12345678abcdefgh"; - - // Send message from client to server - int rc = zmq_send (client, content, 32, ZMQ_SNDMORE); - assert (rc == 32); - rc = zmq_send (client, content, 32, 0); - assert (rc == 32); - - // Receive message at server side - char buffer [32]; - rc = zmq_recv (server, buffer, 32, 0); - assert (rc == 32); - // Check that message is still the same - assert (memcmp (buffer, content, 32) == 0); - int rcvmore; - size_t sz = sizeof (rcvmore); - rc = zmq_getsockopt (server, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (rcvmore); - rc = zmq_recv (server, buffer, 32, 0); - assert (rc == 32); - // Check that message is still the same - assert (memcmp (buffer, content, 32) == 0); - rc = zmq_getsockopt (server, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); - - // Send two parts back to client - rc = zmq_send (server, buffer, 32, ZMQ_SNDMORE); - assert (rc == 32); - rc = zmq_send (server, buffer, 32, 0); - assert (rc == 32); - - // Receive the two parts at the client side - rc = zmq_recv (client, buffer, 32, 0); - assert (rc == 32); - // Check that message is still the same - assert (memcmp (buffer, content, 32) == 0); - rc = zmq_getsockopt (client, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (rcvmore); - rc = zmq_recv (client, buffer, 32, 0); - assert (rc == 32); - // Check that message is still the same - assert (memcmp (buffer, content, 32) == 0); - rc = zmq_getsockopt (client, ZMQ_RCVMORE, &rcvmore, &sz); - assert (rc == 0); - assert (!rcvmore); -} - -// Same as bounce, but expect messages to never arrive -// for security or subscriber reasons. - -void -expect_bounce_fail (void *server, void *client) -{ - const char *content = "12345678ABCDEFGH12345678abcdefgh"; - char buffer [32]; - int timeout = 250; - - // Send message from client to server - int rc = zmq_setsockopt (client, ZMQ_SNDTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_send (client, content, 32, ZMQ_SNDMORE); - assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN))); - rc = zmq_send (client, content, 32, 0); - assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN))); - - // Receive message at server side (should not succeed) - rc = zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_recv (server, buffer, 32, 0); - assert (rc == -1); - assert (zmq_errno () == EAGAIN); - - // Send message from server to client to test other direction - // If connection failed, send may block, without a timeout - rc = zmq_setsockopt (server, ZMQ_SNDTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_send (server, content, 32, ZMQ_SNDMORE); - assert (rc == 32 || (rc == -1 && zmq_errno () == EAGAIN)); - rc = zmq_send (server, content, 32, 0); - assert (rc == 32 || (rc == -1 && zmq_errno () == EAGAIN)); - - // Receive message at client side (should not succeed) - rc = zmq_setsockopt (client, ZMQ_RCVTIMEO, &timeout, sizeof (int)); - assert (rc == 0); - rc = zmq_recv (client, buffer, 32, 0); - assert (rc == -1); - assert (zmq_errno () == EAGAIN); -} - -// Receive 0MQ string from socket and convert into C string -// Caller must free returned string. Returns NULL if the context -// is being terminated. -char * -s_recv (void *socket) { - char buffer [256]; - int size = zmq_recv (socket, buffer, 255, 0); - if (size == -1) - return NULL; - if (size > 255) - size = 255; - buffer [size] = 0; - return strdup (buffer); -} - -// Convert C string to 0MQ string and send to socket -int -s_send (void *socket, const char *string) { - int size = zmq_send (socket, string, strlen (string), 0); - return size; -} - -// Sends string as 0MQ string, as multipart non-terminal -int -s_sendmore (void *socket, const char *string) { - int size = zmq_send (socket, string, strlen (string), ZMQ_SNDMORE); - return size; -} - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -const char *SEQ_END = (const char *) 1; - -// Sends a message composed of frames that are C strings or null frames. -// The list must be terminated by SEQ_END. -// Example: s_send_seq (req, "ABC", 0, "DEF", SEQ_END); -void s_send_seq (void *socket, ...) -{ - va_list ap; - va_start (ap, socket); - const char * data = va_arg (ap, const char *); - while (true) - { - const char * prev = data; - data = va_arg (ap, const char *); - bool end = data == SEQ_END; - - if (!prev) { - int rc = zmq_send (socket, 0, 0, end ? 0 : ZMQ_SNDMORE); - assert (rc != -1); - } - else { - int rc = zmq_send (socket, prev, strlen (prev)+1, end ? 0 : ZMQ_SNDMORE); - assert (rc != -1); - } - if (end) - break; - } - va_end (ap); -} - -// Receives message a number of frames long and checks that the frames have -// the given data which can be either C strings or 0 for a null frame. -// The list must be terminated by SEQ_END. -// Example: s_recv_seq (rep, "ABC", 0, "DEF", SEQ_END); -void s_recv_seq (void *socket, ...) -{ - zmq_msg_t msg; - zmq_msg_init (&msg); - - int more; - size_t more_size = sizeof(more); - - va_list ap; - va_start (ap, socket); - const char * data = va_arg (ap, const char *); - - while (true) { - int rc = zmq_msg_recv (&msg, socket, 0); - assert (rc != -1); - - if (!data) - assert (zmq_msg_size (&msg) == 0); - else - assert (strcmp (data, (const char *)zmq_msg_data (&msg)) == 0); - - data = va_arg (ap, const char *); - bool end = data == SEQ_END; - - rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - - assert (!more == end); - if (end) - break; - } - va_end (ap); - - zmq_msg_close (&msg); -} - - -// Sets a zero linger period on a socket and closes it. -void close_zero_linger (void *socket) -{ - int linger = 0; - int rc = zmq_setsockopt (socket, ZMQ_LINGER, &linger, sizeof(linger)); - assert (rc == 0 || errno == ETERM); - rc = zmq_close (socket); - assert (rc == 0); -} - -void setup_test_environment() -{ -#if defined _WIN32 -# if defined _MSC_VER - _set_abort_behavior( 0, _WRITE_ABORT_MSG); - _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); - _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); -# endif -#else - // abort test after 60 seconds - alarm(60); -#endif -#if defined __MVS__ - // z/OS UNIX System Services: Ignore SIGPIPE during test runs, as a - // workaround for no SO_NOGSIGPIPE socket option. - signal(SIGPIPE, SIG_IGN); -#endif -} - -// Provide portable millisecond sleep -// http://www.cplusplus.com/forum/unices/60161/ http://en.cppreference.com/w/cpp/thread/sleep_for -void msleep (int milliseconds) -{ -#ifdef ZMQ_HAVE_WINDOWS - Sleep (milliseconds); -#else - usleep (static_cast (milliseconds) * 1000); -#endif -} - - -#endif