Query on unit testing of sockets in c language using RTRT testing tool

458 Views Asked by At

Software is developed on VXworks operating system using C programming language.

Application establishes socket connection with other application and during the process it calls many inbuilt VXworks system calls like send(),recv(),bzero() and bcopy().

The question is i'm trying to carry out the unit testing(statement coverage) of my software using RTRT testing tool.

As send(),recv() are inbuilt system calls,the values passed to and return by these system calls are out of my control.How to carry out unit testing of sockets using RTRT tool ?

1

There are 1 best solutions below

0
Joe On

bzero and bcopy don't need checking. In terms of send and recv, you could pass send and recv functors to your function and use them. In production code they just resolve to the system send and recv, in unit test code you could write your own send and recv functions that allow you to unit test as you need.