You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add test setup for writev tests
* Add more tests
* Fix the tests and add macro
* Add details about writev tests
* Update readme and the formatting on transport interface test file
* Make changes pointed out in the comments
* Fix README according the review comments
* Fix PR comments
Copy file name to clipboardExpand all lines: src/transport_interface/README.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,17 @@ The test directly exercises the transport interface on the device under testing
21
21
* A PC to run the provided echo server.
22
22
* A test application which runs on the device under test with transport interface implemented.
23
23
24
+
_NOTE: The writev tests are optional and can be used to verify the implementation of writev method using the scatter-gather approach._
25
+
24
26
The test application is usually implemented by calling the provided transport interface test routine from the main function.
25
27
26
28
27
29
## 2. Transport Interface Test Cases
28
30
29
31
The transport interface tests verify the implementation by running various test cases. The test cases are designed according to the guidelines in the transport interface header file.
30
32
33
+
###Mandatory Test Cases
34
+
31
35
|Test Case |Test Case Detail |Expected result |
32
36
|--- |--- |--- |
33
37
|TransportSend_NetworkContextNullPtr |Test transport interface send with NULL network context pointer handling |Negative value should be returned |
@@ -36,15 +40,29 @@ The transport interface tests verify the implementation by running various test
36
40
|TransportRecv_NetworkContextNullPtr |Test transport interface recv with NULL network context pointer handling |Negative value should be returned |
37
41
|TransportRecv_BufferNullPtr |Test transport interface recv with NULL buffer pointer handling |Negative value should be returned |
38
42
|TransportRecv_ZeroByteToRecv |Test transport interface recv with zero byte to receive handling |Negative value should be returned |
39
-
|Transport_SendOneByteRecvCompare |Test send receive behavior in the following order<br>Send : 1 byte<br>Send : ( TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH - 1 ) bytes<br>Receive : TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes | Send/receive/compare should has no error|
40
-
|Transport_SendRecvOneByteCompare |Test send receive behavior in the following order<br>Send : TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes<br>Receive : 1 byte<br>Receive : ( TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH - 1 ) bytes |Send/receive/compare should has no error|
41
-
|Transport_SendRecvCompare |Test transport interface with send, receive and compare on bulk of data.<br>The data size ranges from 1 byte to TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes |Send/receive/compare should has no error within timeout |
42
-
|Transport_SendRecvCompareMultithreaded |Test transport interface with send, receive and compare on bulk of data in multiple threads.<br>Each thread will create a network connection.<br>The data size ranges from 1 byte to TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes |Send/receive/compare should has no error within timeout |
43
+
|Transport_SendOneByteRecvCompare |Test send receive behavior in the following order<br>Send : 1 byte<br>Send : ( TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH - 1 ) bytes<br>Receive : TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes | Send/receive/compare should have no errors|
44
+
|Transport_SendRecvOneByteCompare |Test send receive behavior in the following order<br>Send : TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes<br>Receive : 1 byte<br>Receive : ( TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH - 1 ) bytes |Send/receive/compare should have no errors |
45
+
|Transport_SendRecvCompare |Test transport interface with send, receive and compare on bulk of data.<br>The data size ranges from 1 byte to TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes |Send/receive/compare should have no error within timeout |
46
+
|Transport_SendRecvCompareMultithreaded |Test transport interface with send, receive and compare on bulk of data in multiple threads.<br>Each thread will create a network connection.<br>The data size ranges from 1 byte to TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes |Send/receive/compare should have no error within timeout |
43
47
|TransportSend_RemoteDisconnect |Test transport interface send function return value when disconnected by remote server |Negative value should be returned |
44
48
|TransportRecv_RemoteDisconnect |Test transport interface receive function return value when disconnected by remote server |Negative value should be returned |
45
49
|TransportRecv_NoDataToReceive |Test transport interface receive function return value when no data to receive |0 should be returned |
46
50
|TransportRecv_ReturnZeroRetry |Test transport interface receive function return zero due to no data to receive. Send data to echo server then retry the receive function. Transport receive function should be able to receive data from echo server and return positive value. |Postive value should be returned after retry transport receive |
47
51
52
+
###Optional Test Cases
53
+
54
+
|Test Case |Test Case Detail |Expected result |
55
+
|--- |--- |--- |
56
+
|TransportWritev_NetworkContextNullPtr |Test transport interface writev with NULL network context pointer handling |Negative value should be returned |
57
+
|TransportWritev_BufferNullPtr |Test transport interface writev with NULL transport vector array pointer handling |Negative value should be returned |
58
+
|TransportWritev_ZeroByteToSend |Test transport interface writev with zero vector array length to send handling |Negative value should be returned |
59
+
|TransportWritev_OneVectorBufferNullPtr |Test transport interface writev with one data pointer in the array pointing to NULL. |Negative value should be returned |
60
+
|TransportWritev_OneVectorLengthZero |Test transport interface writev with one vector length being 0 |Negative value should be returned |
61
+
|Transport_WritevOneByteRecvCompare |Test writev receive behavior in the following order<br>Send : 1 byte<br>Send : ( TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH - 1 ) bytes<br>Receive : TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes | Send/receive/compare should have no errors |
62
+
|Transport_WritevRecvCompare |Test transport interface with writev, receive and compare on bulk of data.<br>The data size ranges from 1 byte to TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes |Send/receive/compare should have no error within timeout |
63
+
|Transport_WritevRecvCompareMultithreaded |Test transport interface with writev, receive and compare on bulk of data in multiple threads.<br>Each thread will create a network connection.<br>The data size ranges from 1 byte to TRANSPORT_TEST_BUFFER_WRITABLE_LENGTH bytes |Send/receive/compare should have no error within timeout |
64
+
|TransportWritev_RemoteDisconnect |Test transport interface writev function return value when disconnected by remote server |Negative value should be returned |
65
+
48
66
Assert may be used to check invalid parameters. In that case, you need to replace
49
67
the assert macro to return negative value in your transport interface implementation
50
68
to ensure invalid parameter error can be catched by assert.<br><br>
@@ -173,7 +191,13 @@ int FRTest_ThreadTimedJoin( FRTestThreadHandle_t threadHandle,
173
191
#defineTRANSPORT_INTERFACE_TEST_ENABLED ( 1 ) /* Set 1 to enable the transport interface test. */
174
192
```
175
193
176
-
6. Implement the main function and call the **RunQualificationTest**.
194
+
7. Optionally define **TRANSPORT_TEST_EXECUTE_WRITEV_TESTS**, in **test_param_config.h** to enable the execution of writev tests.
195
+
196
+
```C
197
+
#define TRANSPORT_TEST_EXECUTE_WRITEV_TESTS
198
+
```
199
+
200
+
8. Implement the main function and call the **RunQualificationTest**.
177
201
178
202
The following is an example test application.
179
203
@@ -240,7 +264,7 @@ void yourMainFunction( void )
240
264
241
265
## 6. Run The Transport Interface Test
242
266
243
-
The go-based echo_server.go program can setup a TCP server to echo back data. This echo server is used in the transport interface test to verify the transport interface implementation.
267
+
The go-based echo_server.go program located [here](../../tools/echo_server) can setup a TCP server to echo back data. This echo server is used in the transport interface test to verify the transport interface implementation.
244
268
245
269
The transport interface test starts with the following steps:
0 commit comments