2015-12-07 18:19:45 +06:00
|
|
|
/*
|
2016-01-28 15:07:31 +01:00
|
|
|
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
2015-12-07 18:19:45 +06:00
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
#include <vmci_sockets.h>
|
|
|
|
|
|
|
|
#include "testutil.hpp"
|
2019-03-22 09:30:09 -04:00
|
|
|
#include "testutil_unity.hpp"
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2019-03-24 12:51:28 -04:00
|
|
|
SETUP_TEARDOWN_TESTCONTEXT
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2019-03-22 09:30:09 -04:00
|
|
|
void test_reqrep_vmci ()
|
|
|
|
{
|
2015-12-07 18:19:45 +06:00
|
|
|
std::stringstream s;
|
|
|
|
s << "vmci://" << VMCISock_GetLocalCID () << ":" << 5560;
|
|
|
|
std::string endpoint = s.str ();
|
|
|
|
|
2021-02-20 18:08:25 +00:00
|
|
|
void *sb = test_context_socket (ZMQ_DEALER);
|
2021-09-21 19:06:56 +01:00
|
|
|
int rc = zmq_bind (sb, endpoint.c_str ());
|
|
|
|
if (rc < 0 && errno == EAFNOSUPPORT)
|
|
|
|
TEST_IGNORE_MESSAGE ("VMCI not supported");
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (rc);
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2021-02-20 18:08:25 +00:00
|
|
|
void *sc = test_context_socket (ZMQ_DEALER);
|
2019-03-22 09:30:09 -04:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint.c_str ()));
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2021-02-20 18:08:25 +00:00
|
|
|
expect_bounce_fail (sb, sc);
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2021-02-20 18:08:25 +00:00
|
|
|
test_context_socket_close_zero_linger (sc);
|
|
|
|
test_context_socket_close_zero_linger (sb);
|
2019-03-22 09:30:09 -04:00
|
|
|
}
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2019-03-22 09:30:09 -04:00
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
setup_test_environment ();
|
2015-12-07 18:19:45 +06:00
|
|
|
|
2019-03-22 09:30:09 -04:00
|
|
|
UNITY_BEGIN ();
|
|
|
|
RUN_TEST (test_reqrep_vmci);
|
|
|
|
return UNITY_END ();
|
2015-12-07 18:19:45 +06:00
|
|
|
}
|