summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* tests: Enable threaded test cases on FreeBSDAnoop C S2018-11-121-12/+0
| | | | | | | | | It was previously judged as a bug which now turned to be due to wrong backlog count set in echo_srv while listening on socket. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Increase backlog count for listen() in echo_srvAnoop C S2018-11-121-1/+1
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Protect IPv6 in st_echo_tcp_get_peer_sock_nameAndreas Schneider2018-11-071-0/+15
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Set LINK_FLAGS for echo_srvAndreas Schneider2018-11-071-0/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Disable failing tests as on FreeBSDAndreas Schneider2018-11-061-0/+12
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Protect IPv6 function in setup_echo_srv_tcp_ipv6Andreas Schneider2018-11-061-0/+2
| | | | | | | Fixes the build on OmniOS. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Protect IPv6 case in echo_srvAndreas Schneider2018-11-061-0/+6
| | | | | | | This fixes the build on OmniOS. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Don't use string PREPENDAndreas Schneider2018-10-301-2/+2
| | | | | | | This is only supported in cmake >= 3.10. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Init in_addr only once in test_tcp_socket_overwriteAndreas Schneider2018-10-231-7/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Return an error if setenv() fails in test_max_socketsAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Check the correct return code in test_thread_echo_tcp_write_readAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Check return code of connect in test_thread_echo_tcp_sendmsg_recvmsgAndreas Schneider2018-10-231-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Check the return code of connect in test_echo_udp_sendmsg_recvmsgAndreas Schneider2018-10-231-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Check return code of connnect in test_echo_tcp_sendmsg_recvmsgAndreas Schneider2018-10-231-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* echo_srv: Check for a valid pidfile pointerAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* echo_srv: Only use 128K as buffer size instead of 4MBAndreas Schneider2018-10-231-1/+1
| | | | | | | This produced errors built with clang. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* torture: Wait longer for echo_srv startupAndreas Schneider2018-10-231-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* echo_srv: Do not close bogus file descriptorsAndreas Schneider2018-10-231-4/+2
| | | | | | | | | | | | | | ==1564== Warning: invalid file descriptor 1048564 in syscall close() ==1564== at 0x4D18534: close (in /lib64/libc-2.27.so) ==1564== by 0x4046A74: libc_close (socket_wrapper.c:760) ==1564== by 0x405105C: swrap_close (socket_wrapper.c:5933) ==1564== by 0x40511F5: close (socket_wrapper.c:5979) ==1564== by 0x401679: become_daemon (echo_srv.c:202) ==1564== by 0x402D44: main (echo_srv.c:896) ==1563== Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Use assert_return_code() to get errnoAndreas Schneider2018-10-231-8/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Avoid -Wcast-align warningAnoop C S2018-10-231-28/+18
| | | | | | | | | | | | | | | warning: cast from 'struct sockaddr *' to 'struct sockaddr_in *' increases required alignment from 2 to 4 [-Wcast-align] struct sockaddr_in *sinp = (struct sockaddr_in *)to; ^~~~~~~~~~~~~~~~~~~~~~~~ Above warning can be avoided by making use of sockaddr_in available within torture_address from the caller of echo_udp_recv_from_to(). Following that sa_socklen from torture_address can be used instead of passing sa_socklen explicitly to echo_udp_recv_from_to(). Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Fix -Wformat gcc warningAnoop C S2018-10-231-1/+1
| | | | | | | | | test_fork_thread_deadlock.c:48:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘pid_t {aka long int}’ [-Wformat=] Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Update AddCMockaTestAndreas Schneider2018-10-231-42/+41
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Support running the tests with AddressSanitizerAndreas Schneider2018-10-231-1/+27
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Improve checks for compiler flagsAndreas Schneider2018-10-231-0/+14
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Suppress helgrind race condition warning we created on purposeAndreas Schneider2018-10-232-1/+12
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Create an error if helgrind finds a bugAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Write helgrind logs to stderr so we can see themAndreas Schneider2018-10-231-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Update valgrind suppression fileAndreas Schneider2018-08-171-1/+9
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Prevent child process falling to defunct stateAnoop C S2018-08-091-0/+2
| | | | | | | | | | | | Parent process does not wait for child process(which gets forked after accepting a client connection) to exit inside echo server which in turn puts child into defunct state. Even though those defunct childs are cleaned up during parent exit it is better to wait from parent process itself. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add missing header for IPPROTO_TCPAndreas Schneider2018-08-091-0/+1
| | | | | | | This fixes the build on FreeBSD. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Fix resouce leak in echo_srv tcp handlingAndreas Schneider2018-05-041-2/+1
| | | | | | | CID 175587 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* cmake: Run threaded tests with helgrindAndreas Schneider2018-05-031-6/+35
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add test case to validate free-list indexesAnoop C S2018-05-022-1/+76
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: New threaded test casesAnoop C S2018-05-025-1/+591
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Modify echo server to accept multiple connectionsAnoop C S2018-05-021-23/+35
| | | | | | | | | | In context of multiple threads, echo server must be capable of accepting connections in a loop rather than be satisfied with one incoming connection. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Add new test to check mutex lock contentionMichael Adam2018-05-022-1/+74
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: set errno to ENFILE if there is no more free socket_infoMichael Adam2018-05-021-2/+2
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Increase wait time for setup and teardown to 5msAndreas Schneider2018-05-021-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* tests: Remove extra test by moving getsockname() to anotherAnoop C S2018-03-263-70/+2
| | | | | | | | | | | | | | test_echo_tcp_socket currently tests socket() and getsockname() network calls. The test name was misleading as it does not require echo server to be setup. Moreover it failed to create socket_wrapper directory which is the pre-requisite for testing with libsocket_wrapper. Therefore it is better to integrate getsockname() test into existing test_tcp_listen test and remove useless test_echo_tcp_socket Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlet <abartlet@samba.org>
* tests: Add a thread deadlock reproducerAndreas Schneider2017-12-043-1/+175
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Fix sa_socklen for sockaddr_inAndreas Schneider2017-12-041-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add a simple fnctl() testAndreas Schneider2017-09-072-0/+68
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Fix test_close_failure test caseMichael Adam2017-03-171-3/+1
| | | | | | | Found by valgrind. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* Increase wait time during echo_server's pid-file checkAnoop C S2017-02-271-1/+1
| | | | | | | | | | | | We used to sleep for 200 microseconds in each iteration for checking the existence of echo server's pid file which seems to be very short. In order to avoid chances of failures to detect this pid file within 100 such iterations its better to increase this wait time to 2000 microseconds. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* Avoid mutex lock wait in socket close failureAnoop C S2017-02-102-1/+52
| | | | | | | | | | | | | | | In case of absence to close a socket fd during an exit from application we try to close the same by traversing the socket_fds in swrap_destructor. But the early lock taken on libc_symbol_binding_mutex inside the destructor blocks the subsequent request for locking the same while loading libc_close within swrap_close. Also added a test case to verify this flaw in destructor. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* tests: Clean-up max_sockets test caseAnoop C S2016-10-271-20/+4
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* cmake: Link pthread library headersMichael Adam2016-10-201-1/+2
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Add a test for max_socketsMichael Adam2016-10-202-1/+112
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Add test case to validate oldfd = newfd case in dup2()Anoop C S2016-08-232-0/+51
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Add test_connect_sendto_null_ipv4() testAndreas Schneider2016-05-171-0/+52
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>