Changeset 9520af7 in mainline for uspace/srv/net/tcp/test
- Timestamp:
- 2017-09-12T15:48:01Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d40c93d
- Parents:
- 0a1e7e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/test/conn.c
r0a1e7e4 r9520af7 33 33 34 34 #include "../conn.h" 35 #include "../rqueue.h" 36 #include "../ucall.h" 35 37 36 38 PCUT_INIT 37 39 38 40 PCUT_TEST_SUITE(conn); 41 42 static tcp_rqueue_cb_t test_rqueue_cb = { 43 .seg_received = tcp_as_segment_arrived 44 }; 39 45 40 46 PCUT_TEST_BEFORE … … 48 54 rc = tcp_conns_init(); 49 55 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 56 57 tcp_rqueue_init(&test_rqueue_cb); 58 tcp_rqueue_fibril_start(); 50 59 } 51 60 52 61 PCUT_TEST_AFTER 53 62 { 63 tcp_rqueue_fini(); 54 64 tcp_conns_fini(); 55 65 } … … 71 81 } 72 82 73 /** Test adding, finding and removing a connection */74 PCUT_TEST(add_find_ remove)83 /** Test adding, finding and deleting a connection */ 84 PCUT_TEST(add_find_delete) 75 85 { 76 86 tcp_conn_t *conn, *cfound; … … 101 111 } 102 112 113 /** Test trying to connect to endpoint that sends RST back */ 114 PCUT_TEST(connect_rst) 115 { 116 tcp_conn_t *conn; 117 inet_ep2_t epp; 118 int rc; 119 120 tcp_conn_lb = tcp_lb_segment; 121 122 inet_ep2_init(&epp); 123 inet_addr(&epp.local.addr, 127, 0, 0, 1); 124 inet_addr(&epp.remote.addr, 127, 0, 0, 1); 125 epp.remote.port = inet_port_user_lo; 126 127 conn = tcp_conn_new(&epp); 128 PCUT_ASSERT_NOT_NULL(conn); 129 130 rc = tcp_conn_add(conn); 131 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 132 133 PCUT_ASSERT_INT_EQUALS(st_listen, conn->cstate); 134 135 tcp_conn_lock(conn); 136 tcp_conn_sync(conn); 137 PCUT_ASSERT_INT_EQUALS(st_syn_sent, conn->cstate); 138 139 while (conn->cstate == st_syn_sent) 140 fibril_condvar_wait(&conn->cstate_cv, &conn->lock); 141 142 PCUT_ASSERT_INT_EQUALS(st_closed, conn->cstate); 143 144 tcp_conn_unlock(conn); 145 tcp_conn_delete(conn); 146 } 147 103 148 PCUT_EXPORT(conn);
Note:
See TracChangeset
for help on using the changeset viewer.