This document describes how to perform target testing using Wind River Workbench IDE in the VxWorks 6.9 target execution environment.

The application example environment is as follows, and the log interface uses TCP socket communication.

Target test application and execution order

1. Setting Target environment

  • On [right click on project] -> [properties] -> [Target test] -> [Target environment Setting], Just fill in the log interface of the Run tab, apply and close. The environment covered in this document is a manual build and run method, so the other tabs do not affect testing. The source below is the log interface applied to the example environment (VxWorks 6.9).
//Do not modify this header file.
#include "cs_tfx_types.h"

//Below is an example.

#define AF_INET	2
#define SOCK_STREAM 1
#define htons(x) (x)

struct in_addr {
	unsigned int s_addr;
};

struct sockaddr_in {
	unsigned char sin_len;
	unsigned char sin_family;
	unsigned short sin_port;
	struct in_addr sin_addr;
	char sin_zero[8];
};

int sock;
struct sockaddr_in addr;

//This function called at test start.
void cs_io_initialize()
{
 sock = socket(AF_INET, SOCK_STREAM, 0);
 if (sock < 0)
 {
  printf("create socket failed\n");
 }

 memset (&addr, 0, sizeof(addr));
 addr.sin_addr.s_addr = inet_addr("211.116.222.180"); // IP address of the PC where the CT 2023.12 is installed
 addr.sin_port = htons(2019); // The port to be used by the target log collector
 addr.sin_family = AF_INET;
 addr.sin_len = sizeof(addr);

 if ((connect(sock, (struct sockaddr_in *)&addr, sizeof(addr))) < 0) {
  printf("connect failed");
 }
 else
  printf("connected to server!\n");

 printf("Controller Tester Init End!!!!\n");
}

//This function called at test end.
void cs_io_finalize()
{
 //Close socket.
 close(sock);
}

void cs_io_flush()
{

}

//This function prints the test result
void cs_io_putbyte(char v)
{
 //Send the target test result.
 printf("%c",v);
 send(sock, &v, 1, 0);
}

2. Target Test Execution

  • For accurate testing, execute the test case unit by using the [Run Target Test Case] menu. You can test multiple test cases or functions at once, if memory is available.


  • Project in CT 2023.12 will be locked when the target test is executed.

3. Build

  • Rebuild Project the exported code in Wind River Workbench IDE.

4. Target log collector settings

  • Set the target log collector according to the port created in the log interface and run it.
  • The target log collector is installed in %appdata%\CodeScroll\TargetLogCollector\TargetLogCollector.exe.
  • The first time you run the target log collector in cmd, %appdata%\CodeScroll\TargetLogCollector\setting.ini is created. You can configure the target log collector with this file.
  • The example below is the target log collector setting according to the log interface example.
[LogReceiveServer]
; TCP, UDP server port
port=2019
; tcp, udp, uart or serial
protocol=tcp
; timeout(second)
timeout=60
lastString=CSET#
; serial(UART) port (Windows: COM#, Linux: /dev/ttyS#)
serialPort=COM1
; serial port setting
baudRate=9600
dataBits=8
stopBits=1
parity=0
flowControl=0

[ScanLog]
; log directory(default: scan/log)
dir=
; log file extension(if empty, scan everything)
fileExtension=log
; begin character when filtering the string of log (ascii code with value separator ;)
beginCharacter=4;5;6
; end character when filtering the string of log (ascii code with value separator ; , 10 is LF)
endCharacter=10

[LogSendServer]
; send log to Controller Tester
port=2020

5. Setting the target log collector for CT 2023.12

  • In CT 2023.12, in [Preferences] -> [Target Test] -> [Target Log Collector], select Use the default target log collector and turn on auto-detect.

6. Run binary on target

  • Move the built binary to VxWorks OS and put it on the target to run it.

7. Restore source from CT 2023.12

  • Restore the source from CT 2023.12 to get the target test log.

8. Get target test log

  • The created log is automatically loaded according to the set Auto-detect cycle.

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.