BA / Mbed OS BaBoRo1
Committer:
borlanic
Date:
Thu Mar 29 07:02:09 2018 +0000
Revision:
0:380207fcb5c1
Encoder, IMU --> OK; Controller --> in bearbeitung

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:380207fcb5c1 1 /*
borlanic 0:380207fcb5c1 2 * Copyright (c) 2013-2017, ARM Limited, All Rights Reserved
borlanic 0:380207fcb5c1 3 * SPDX-License-Identifier: Apache-2.0
borlanic 0:380207fcb5c1 4 *
borlanic 0:380207fcb5c1 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
borlanic 0:380207fcb5c1 6 * not use this file except in compliance with the License.
borlanic 0:380207fcb5c1 7 * You may obtain a copy of the License at
borlanic 0:380207fcb5c1 8 *
borlanic 0:380207fcb5c1 9 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:380207fcb5c1 10 *
borlanic 0:380207fcb5c1 11 * Unless required by applicable law or agreed to in writing, software
borlanic 0:380207fcb5c1 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
borlanic 0:380207fcb5c1 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:380207fcb5c1 14 * See the License for the specific language governing permissions and
borlanic 0:380207fcb5c1 15 * limitations under the License.
borlanic 0:380207fcb5c1 16 */
borlanic 0:380207fcb5c1 17
borlanic 0:380207fcb5c1 18 #ifndef MBED_CONF_APP_CONNECT_STATEMENT
borlanic 0:380207fcb5c1 19 #error [NOT_SUPPORTED] No network configuration found for this target.
borlanic 0:380207fcb5c1 20 #endif
borlanic 0:380207fcb5c1 21
borlanic 0:380207fcb5c1 22 #ifndef MBED_EXTENDED_TESTS
borlanic 0:380207fcb5c1 23 #error [NOT_SUPPORTED] Parallel pressure tests are not supported by default
borlanic 0:380207fcb5c1 24 #endif
borlanic 0:380207fcb5c1 25
borlanic 0:380207fcb5c1 26 #include "mbed.h"
borlanic 0:380207fcb5c1 27 #include MBED_CONF_APP_HEADER_FILE
borlanic 0:380207fcb5c1 28 #include "TCPSocket.h"
borlanic 0:380207fcb5c1 29 #include "greentea-client/test_env.h"
borlanic 0:380207fcb5c1 30 #include "unity/unity.h"
borlanic 0:380207fcb5c1 31 #include "utest.h"
borlanic 0:380207fcb5c1 32
borlanic 0:380207fcb5c1 33 using namespace utest::v1;
borlanic 0:380207fcb5c1 34
borlanic 0:380207fcb5c1 35
borlanic 0:380207fcb5c1 36 #ifndef MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MIN
borlanic 0:380207fcb5c1 37 #define MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MIN 64
borlanic 0:380207fcb5c1 38 #endif
borlanic 0:380207fcb5c1 39
borlanic 0:380207fcb5c1 40 #ifndef MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MAX
borlanic 0:380207fcb5c1 41 #define MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MAX 0x80000
borlanic 0:380207fcb5c1 42 #endif
borlanic 0:380207fcb5c1 43
borlanic 0:380207fcb5c1 44 #ifndef MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_SEED
borlanic 0:380207fcb5c1 45 #define MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_SEED 0x6d626564
borlanic 0:380207fcb5c1 46 #endif
borlanic 0:380207fcb5c1 47
borlanic 0:380207fcb5c1 48 #ifndef MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS
borlanic 0:380207fcb5c1 49 #define MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS 3
borlanic 0:380207fcb5c1 50 #endif
borlanic 0:380207fcb5c1 51
borlanic 0:380207fcb5c1 52 #ifndef MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_DEBUG
borlanic 0:380207fcb5c1 53 #define MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_DEBUG false
borlanic 0:380207fcb5c1 54 #endif
borlanic 0:380207fcb5c1 55
borlanic 0:380207fcb5c1 56 #define STRINGIZE(x) STRINGIZE2(x)
borlanic 0:380207fcb5c1 57 #define STRINGIZE2(x) #x
borlanic 0:380207fcb5c1 58
borlanic 0:380207fcb5c1 59
borlanic 0:380207fcb5c1 60 // Simple xorshift pseudorandom number generator
borlanic 0:380207fcb5c1 61 class RandSeq
borlanic 0:380207fcb5c1 62 {
borlanic 0:380207fcb5c1 63 private:
borlanic 0:380207fcb5c1 64 uint32_t x;
borlanic 0:380207fcb5c1 65 uint32_t y;
borlanic 0:380207fcb5c1 66 static const int A = 15;
borlanic 0:380207fcb5c1 67 static const int B = 18;
borlanic 0:380207fcb5c1 68 static const int C = 11;
borlanic 0:380207fcb5c1 69
borlanic 0:380207fcb5c1 70 public:
borlanic 0:380207fcb5c1 71 RandSeq(uint32_t seed = MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_SEED)
borlanic 0:380207fcb5c1 72 : x(seed), y(seed) {}
borlanic 0:380207fcb5c1 73
borlanic 0:380207fcb5c1 74 uint32_t next(void)
borlanic 0:380207fcb5c1 75 {
borlanic 0:380207fcb5c1 76 x ^= x << A;
borlanic 0:380207fcb5c1 77 x ^= x >> B;
borlanic 0:380207fcb5c1 78 x ^= y ^ (y >> C);
borlanic 0:380207fcb5c1 79 return x + y;
borlanic 0:380207fcb5c1 80 }
borlanic 0:380207fcb5c1 81
borlanic 0:380207fcb5c1 82 void skip(size_t size)
borlanic 0:380207fcb5c1 83 {
borlanic 0:380207fcb5c1 84 for (size_t i = 0; i < size; i++) {
borlanic 0:380207fcb5c1 85 next();
borlanic 0:380207fcb5c1 86 }
borlanic 0:380207fcb5c1 87 }
borlanic 0:380207fcb5c1 88
borlanic 0:380207fcb5c1 89 void buffer(uint8_t *buffer, size_t size)
borlanic 0:380207fcb5c1 90 {
borlanic 0:380207fcb5c1 91 RandSeq lookahead = *this;
borlanic 0:380207fcb5c1 92
borlanic 0:380207fcb5c1 93 for (size_t i = 0; i < size; i++) {
borlanic 0:380207fcb5c1 94 buffer[i] = lookahead.next() & 0xff;
borlanic 0:380207fcb5c1 95 }
borlanic 0:380207fcb5c1 96 }
borlanic 0:380207fcb5c1 97
borlanic 0:380207fcb5c1 98 int cmp(uint8_t *buffer, size_t size)
borlanic 0:380207fcb5c1 99 {
borlanic 0:380207fcb5c1 100 RandSeq lookahead = *this;
borlanic 0:380207fcb5c1 101
borlanic 0:380207fcb5c1 102 for (size_t i = 0; i < size; i++) {
borlanic 0:380207fcb5c1 103 int diff = buffer[i] - (lookahead.next() & 0xff);
borlanic 0:380207fcb5c1 104 if (diff != 0) {
borlanic 0:380207fcb5c1 105 return diff;
borlanic 0:380207fcb5c1 106 }
borlanic 0:380207fcb5c1 107 }
borlanic 0:380207fcb5c1 108 return 0;
borlanic 0:380207fcb5c1 109 }
borlanic 0:380207fcb5c1 110 };
borlanic 0:380207fcb5c1 111
borlanic 0:380207fcb5c1 112
borlanic 0:380207fcb5c1 113 // Tries to get the biggest buffer possible on the device. Exponentially
borlanic 0:380207fcb5c1 114 // grows a buffer until heap runs out of space, and uses half to leave
borlanic 0:380207fcb5c1 115 // space for the rest of the program
borlanic 0:380207fcb5c1 116 void generate_buffer(uint8_t **buffer, size_t *size, size_t min, size_t max)
borlanic 0:380207fcb5c1 117 {
borlanic 0:380207fcb5c1 118 size_t i = min;
borlanic 0:380207fcb5c1 119 while (i < max) {
borlanic 0:380207fcb5c1 120 void *b = malloc(i);
borlanic 0:380207fcb5c1 121 if (!b) {
borlanic 0:380207fcb5c1 122 i /= 4;
borlanic 0:380207fcb5c1 123 if (i < min) {
borlanic 0:380207fcb5c1 124 i = min;
borlanic 0:380207fcb5c1 125 }
borlanic 0:380207fcb5c1 126 break;
borlanic 0:380207fcb5c1 127 }
borlanic 0:380207fcb5c1 128 free(b);
borlanic 0:380207fcb5c1 129 i *= 2;
borlanic 0:380207fcb5c1 130 }
borlanic 0:380207fcb5c1 131
borlanic 0:380207fcb5c1 132 *buffer = (uint8_t *)malloc(i);
borlanic 0:380207fcb5c1 133 *size = i;
borlanic 0:380207fcb5c1 134 TEST_ASSERT(buffer);
borlanic 0:380207fcb5c1 135 }
borlanic 0:380207fcb5c1 136
borlanic 0:380207fcb5c1 137
borlanic 0:380207fcb5c1 138 // Global variables shared between pressure tests
borlanic 0:380207fcb5c1 139 NetworkInterface* net;
borlanic 0:380207fcb5c1 140 SocketAddress tcp_addr;
borlanic 0:380207fcb5c1 141 Timer timer;
borlanic 0:380207fcb5c1 142 Mutex iomutex;
borlanic 0:380207fcb5c1 143
borlanic 0:380207fcb5c1 144 // Single instance of a pressure test
borlanic 0:380207fcb5c1 145 class PressureTest
borlanic 0:380207fcb5c1 146 {
borlanic 0:380207fcb5c1 147 private:
borlanic 0:380207fcb5c1 148 uint8_t *buffer;
borlanic 0:380207fcb5c1 149 size_t buffer_size;
borlanic 0:380207fcb5c1 150
borlanic 0:380207fcb5c1 151 TCPSocket sock;
borlanic 0:380207fcb5c1 152 Thread thread;
borlanic 0:380207fcb5c1 153
borlanic 0:380207fcb5c1 154 public:
borlanic 0:380207fcb5c1 155 PressureTest(uint8_t *buffer, size_t buffer_size)
borlanic 0:380207fcb5c1 156 : buffer(buffer), buffer_size(buffer_size)
borlanic 0:380207fcb5c1 157 {
borlanic 0:380207fcb5c1 158 }
borlanic 0:380207fcb5c1 159
borlanic 0:380207fcb5c1 160 void start()
borlanic 0:380207fcb5c1 161 {
borlanic 0:380207fcb5c1 162 osStatus status = thread.start(callback(this, &PressureTest::run));
borlanic 0:380207fcb5c1 163 TEST_ASSERT_EQUAL(osOK, status);
borlanic 0:380207fcb5c1 164 }
borlanic 0:380207fcb5c1 165
borlanic 0:380207fcb5c1 166 void join()
borlanic 0:380207fcb5c1 167 {
borlanic 0:380207fcb5c1 168 osStatus status = thread.join();
borlanic 0:380207fcb5c1 169 TEST_ASSERT_EQUAL(osOK, status);
borlanic 0:380207fcb5c1 170 }
borlanic 0:380207fcb5c1 171
borlanic 0:380207fcb5c1 172 void run()
borlanic 0:380207fcb5c1 173 {
borlanic 0:380207fcb5c1 174 // Tests exponentially growing sequences
borlanic 0:380207fcb5c1 175 for (size_t size = MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MIN;
borlanic 0:380207fcb5c1 176 size < MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MAX;
borlanic 0:380207fcb5c1 177 size *= 2) {
borlanic 0:380207fcb5c1 178 int err = sock.open(net);
borlanic 0:380207fcb5c1 179 TEST_ASSERT_EQUAL(0, err);
borlanic 0:380207fcb5c1 180 err = sock.connect(tcp_addr);
borlanic 0:380207fcb5c1 181 TEST_ASSERT_EQUAL(0, err);
borlanic 0:380207fcb5c1 182
borlanic 0:380207fcb5c1 183 #if defined(MBED_CONF_APP_TCP_ECHO_PREFIX)
borlanic 0:380207fcb5c1 184 sock.recv(buffer, sizeof(MBED_CONF_APP_TCP_ECHO_PREFIX));
borlanic 0:380207fcb5c1 185 #endif /* MBED_CONF_APP_TCP_ECHO_PREFIX */
borlanic 0:380207fcb5c1 186
borlanic 0:380207fcb5c1 187 iomutex.lock();
borlanic 0:380207fcb5c1 188 printf("TCP: %s:%d streaming %d bytes\r\n",
borlanic 0:380207fcb5c1 189 tcp_addr.get_ip_address(), tcp_addr.get_port(), size);
borlanic 0:380207fcb5c1 190 iomutex.unlock();
borlanic 0:380207fcb5c1 191
borlanic 0:380207fcb5c1 192 sock.set_blocking(false);
borlanic 0:380207fcb5c1 193
borlanic 0:380207fcb5c1 194 // Loop to send/recv all data
borlanic 0:380207fcb5c1 195 RandSeq tx_seq;
borlanic 0:380207fcb5c1 196 RandSeq rx_seq;
borlanic 0:380207fcb5c1 197 size_t rx_count = 0;
borlanic 0:380207fcb5c1 198 size_t tx_count = 0;
borlanic 0:380207fcb5c1 199 size_t window = buffer_size;
borlanic 0:380207fcb5c1 200
borlanic 0:380207fcb5c1 201 while (tx_count < size || rx_count < size) {
borlanic 0:380207fcb5c1 202 // Send out data
borlanic 0:380207fcb5c1 203 if (tx_count < size) {
borlanic 0:380207fcb5c1 204 size_t chunk_size = size - tx_count;
borlanic 0:380207fcb5c1 205 if (chunk_size > window) {
borlanic 0:380207fcb5c1 206 chunk_size = window;
borlanic 0:380207fcb5c1 207 }
borlanic 0:380207fcb5c1 208
borlanic 0:380207fcb5c1 209 tx_seq.buffer(buffer, chunk_size);
borlanic 0:380207fcb5c1 210 int td = sock.send(buffer, chunk_size);
borlanic 0:380207fcb5c1 211
borlanic 0:380207fcb5c1 212 if (td > 0) {
borlanic 0:380207fcb5c1 213 if (MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_DEBUG) {
borlanic 0:380207fcb5c1 214 iomutex.lock();
borlanic 0:380207fcb5c1 215 printf("TCP: tx -> %d\r\n", td);
borlanic 0:380207fcb5c1 216 iomutex.unlock();
borlanic 0:380207fcb5c1 217 }
borlanic 0:380207fcb5c1 218 tx_seq.skip(td);
borlanic 0:380207fcb5c1 219 tx_count += td;
borlanic 0:380207fcb5c1 220 } else if (td != NSAPI_ERROR_WOULD_BLOCK) {
borlanic 0:380207fcb5c1 221 // We may fail to send because of buffering issues,
borlanic 0:380207fcb5c1 222 // cut buffer in half
borlanic 0:380207fcb5c1 223 if (window > MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MIN) {
borlanic 0:380207fcb5c1 224 window /= 2;
borlanic 0:380207fcb5c1 225 }
borlanic 0:380207fcb5c1 226
borlanic 0:380207fcb5c1 227 if (MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_DEBUG) {
borlanic 0:380207fcb5c1 228 iomutex.lock();
borlanic 0:380207fcb5c1 229 printf("TCP: Not sent (%d), window = %d\r\n", td, window);
borlanic 0:380207fcb5c1 230 iomutex.unlock();
borlanic 0:380207fcb5c1 231 }
borlanic 0:380207fcb5c1 232 }
borlanic 0:380207fcb5c1 233 }
borlanic 0:380207fcb5c1 234
borlanic 0:380207fcb5c1 235 // Verify received data
borlanic 0:380207fcb5c1 236 while (rx_count < size) {
borlanic 0:380207fcb5c1 237 int rd = sock.recv(buffer, buffer_size);
borlanic 0:380207fcb5c1 238 TEST_ASSERT(rd > 0 || rd == NSAPI_ERROR_WOULD_BLOCK);
borlanic 0:380207fcb5c1 239 if (rd > 0) {
borlanic 0:380207fcb5c1 240 if (MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_DEBUG) {
borlanic 0:380207fcb5c1 241 iomutex.lock();
borlanic 0:380207fcb5c1 242 printf("TCP: rx <- %d\r\n", rd);
borlanic 0:380207fcb5c1 243 iomutex.unlock();
borlanic 0:380207fcb5c1 244 }
borlanic 0:380207fcb5c1 245 int diff = rx_seq.cmp(buffer, rd);
borlanic 0:380207fcb5c1 246 TEST_ASSERT_EQUAL(0, diff);
borlanic 0:380207fcb5c1 247 rx_seq.skip(rd);
borlanic 0:380207fcb5c1 248 rx_count += rd;
borlanic 0:380207fcb5c1 249 } else if (rd == NSAPI_ERROR_WOULD_BLOCK) {
borlanic 0:380207fcb5c1 250 break;
borlanic 0:380207fcb5c1 251 }
borlanic 0:380207fcb5c1 252 }
borlanic 0:380207fcb5c1 253 }
borlanic 0:380207fcb5c1 254
borlanic 0:380207fcb5c1 255 err = sock.close();
borlanic 0:380207fcb5c1 256 TEST_ASSERT_EQUAL(0, err);
borlanic 0:380207fcb5c1 257 }
borlanic 0:380207fcb5c1 258 }
borlanic 0:380207fcb5c1 259 };
borlanic 0:380207fcb5c1 260
borlanic 0:380207fcb5c1 261 PressureTest *pressure_tests[MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS];
borlanic 0:380207fcb5c1 262
borlanic 0:380207fcb5c1 263
borlanic 0:380207fcb5c1 264 void test_tcp_packet_pressure_parallel()
borlanic 0:380207fcb5c1 265 {
borlanic 0:380207fcb5c1 266 uint8_t *buffer;
borlanic 0:380207fcb5c1 267 size_t buffer_size;
borlanic 0:380207fcb5c1 268 generate_buffer(&buffer, &buffer_size,
borlanic 0:380207fcb5c1 269 MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MIN,
borlanic 0:380207fcb5c1 270 MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MAX);
borlanic 0:380207fcb5c1 271
borlanic 0:380207fcb5c1 272 size_t buffer_subsize = buffer_size / MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS;
borlanic 0:380207fcb5c1 273 printf("MBED: Generated buffer %d\r\n", buffer_size);
borlanic 0:380207fcb5c1 274 printf("MBED: Split into %d buffers %d\r\n",
borlanic 0:380207fcb5c1 275 MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS,
borlanic 0:380207fcb5c1 276 buffer_subsize);
borlanic 0:380207fcb5c1 277
borlanic 0:380207fcb5c1 278 net = MBED_CONF_APP_OBJECT_CONSTRUCTION;
borlanic 0:380207fcb5c1 279 int err = MBED_CONF_APP_CONNECT_STATEMENT;
borlanic 0:380207fcb5c1 280 TEST_ASSERT_EQUAL(0, err);
borlanic 0:380207fcb5c1 281
borlanic 0:380207fcb5c1 282 printf("MBED: TCPClient IP address is '%s'\n", net->get_ip_address());
borlanic 0:380207fcb5c1 283
borlanic 0:380207fcb5c1 284 #if defined(MBED_CONF_APP_ECHO_SERVER_ADDR) && defined(MBED_CONF_APP_ECHO_SERVER_PORT)
borlanic 0:380207fcb5c1 285 tcp_addr.set_ip_address(MBED_CONF_APP_ECHO_SERVER_ADDR);
borlanic 0:380207fcb5c1 286 tcp_addr.set_port(MBED_CONF_APP_ECHO_SERVER_PORT);
borlanic 0:380207fcb5c1 287 #else /* MBED_CONF_APP_ECHO_SERVER_ADDR && MBED_CONF_APP_ECHO_SERVER_PORT */
borlanic 0:380207fcb5c1 288 char recv_key[] = "host_port";
borlanic 0:380207fcb5c1 289 char ipbuf[60] = {0};
borlanic 0:380207fcb5c1 290 char portbuf[16] = {0};
borlanic 0:380207fcb5c1 291 unsigned int port = 0;
borlanic 0:380207fcb5c1 292
borlanic 0:380207fcb5c1 293 greentea_send_kv("target_ip", net->get_ip_address());
borlanic 0:380207fcb5c1 294 greentea_send_kv("host_ip", " ");
borlanic 0:380207fcb5c1 295 greentea_parse_kv(recv_key, ipbuf, sizeof(recv_key), sizeof(ipbuf));
borlanic 0:380207fcb5c1 296
borlanic 0:380207fcb5c1 297 greentea_send_kv("host_port", " ");
borlanic 0:380207fcb5c1 298 greentea_parse_kv(recv_key, portbuf, sizeof(recv_key), sizeof(ipbuf));
borlanic 0:380207fcb5c1 299 sscanf(portbuf, "%u", &port);
borlanic 0:380207fcb5c1 300
borlanic 0:380207fcb5c1 301 tcp_addr.set_ip_address(ipbuf);
borlanic 0:380207fcb5c1 302 tcp_addr.set_port(port);
borlanic 0:380207fcb5c1 303 #endif /* MBED_CONF_APP_ECHO_SERVER_ADDR && MBED_CONF_APP_ECHO_SERVER_PORT */
borlanic 0:380207fcb5c1 304
borlanic 0:380207fcb5c1 305 timer.start();
borlanic 0:380207fcb5c1 306
borlanic 0:380207fcb5c1 307 // Startup pressure tests in parallel
borlanic 0:380207fcb5c1 308 for (int i = 0; i < MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS; i++) {
borlanic 0:380207fcb5c1 309 pressure_tests[i] = new PressureTest(&buffer[i * buffer_subsize], buffer_subsize);
borlanic 0:380207fcb5c1 310 pressure_tests[i]->start();
borlanic 0:380207fcb5c1 311 }
borlanic 0:380207fcb5c1 312
borlanic 0:380207fcb5c1 313 for (int i = 0; i < MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS; i++) {
borlanic 0:380207fcb5c1 314 pressure_tests[i]->join();
borlanic 0:380207fcb5c1 315 delete pressure_tests[i];
borlanic 0:380207fcb5c1 316 }
borlanic 0:380207fcb5c1 317
borlanic 0:380207fcb5c1 318 timer.stop();
borlanic 0:380207fcb5c1 319 printf("MBED: Time taken: %fs\r\n", timer.read());
borlanic 0:380207fcb5c1 320 printf("MBED: Speed: %.3fkb/s\r\n",
borlanic 0:380207fcb5c1 321 MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_THREADS *
borlanic 0:380207fcb5c1 322 8 * (2 * MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MAX -
borlanic 0:380207fcb5c1 323 MBED_CONF_APP_TCP_CLIENT_PACKET_PRESSURE_MIN) / (1000 * timer.read()));
borlanic 0:380207fcb5c1 324
borlanic 0:380207fcb5c1 325 net->disconnect();
borlanic 0:380207fcb5c1 326 }
borlanic 0:380207fcb5c1 327
borlanic 0:380207fcb5c1 328
borlanic 0:380207fcb5c1 329 // Test setup
borlanic 0:380207fcb5c1 330 utest::v1::status_t test_setup(const size_t number_of_cases)
borlanic 0:380207fcb5c1 331 {
borlanic 0:380207fcb5c1 332 GREENTEA_SETUP(120, "tcp_echo");
borlanic 0:380207fcb5c1 333 return verbose_test_setup_handler(number_of_cases);
borlanic 0:380207fcb5c1 334 }
borlanic 0:380207fcb5c1 335
borlanic 0:380207fcb5c1 336 Case cases[] = {
borlanic 0:380207fcb5c1 337 Case("TCP packet pressure parallel", test_tcp_packet_pressure_parallel),
borlanic 0:380207fcb5c1 338 };
borlanic 0:380207fcb5c1 339
borlanic 0:380207fcb5c1 340 Specification specification(test_setup, cases);
borlanic 0:380207fcb5c1 341
borlanic 0:380207fcb5c1 342 int main()
borlanic 0:380207fcb5c1 343 {
borlanic 0:380207fcb5c1 344 return !Harness::run(specification);
borlanic 0:380207fcb5c1 345 }