Inclusion of unit test for keep_alive and correction of build.sh

parent 07c5b898
CFLAGS= -Wall -Wno-missing-braces -ggdb `pkg-config --cflags criterion`
LDFLAGS= `pkg-config --libs criterion` -L $(OPEN62541_HOME)/lib
LIB_DIR=$(SRC_DIR)te
CC=gcc
CFLAGS= -l:libopen62541.so -L/usr/local/lib -Wall -Wno-missing-braces -ggdb `pkg-config --cflags criterion` -I /usr/local/include/ -I ~/git/open62541/src/pubsub/ -I ~/git/open62541/deps/
LDFLAGS= `pkg-config --libs criterion` -lmbedcrypto -lmbedx509
OUT_DIR=build/
all: test_common test_modio_i2c test_keep_alive
all: test_common test_modio_i2c test_keep_alive test_keep_alive_publisher
test_common: test_common.o
@mkdir -p $(OUT_DIR)
......@@ -17,7 +17,12 @@ test_modio_i2c: test_modio_i2c.o
test_keep_alive: test_keep_alive.o
@mkdir -p $(OUT_DIR)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
@mv $@ $(OUT_DIR)
test_keep_alive_publisher: test_keep_alive_publisher.o
@mkdir -p $(OUT_DIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
@mv $@ $(OUT_DIR)
......@@ -25,7 +30,7 @@ run: all
@${OUT_DIR}/test_common --tap=${OUT_DIR}/test_common.tap
@${OUT_DIR}/test_modio_i2c --tap=${OUT_DIR}/test_modio_i2c.tap
@${OUT_DIR}/test_keep_alive --tap=${OUT_DIR}/test_keep_alive.tap
@${OUT_DIR}/test_keep_alive_publisher --tap=${OUT_DIR}/test_keep_alive_publisher.tap
clean:
@rm $(OUT_DIR)test_common 2>/dev/null || true
......@@ -34,6 +39,8 @@ clean:
@rm $(OUT_DIR)test_modio_i2c.tap 2>/dev/null || true
@rm $(OUT_DIR)test_keep_alive 2>/dev/null || true
@rm $(OUT_DIR)test_keep_alive.tap 2>/dev/null || true
@rm $(OUT_DIR)test_keep_alive_publisher 2>/dev/null || true
@rm $(OUT_DIR)test_keep_alive_publisher.tap 2>/dev/null || true
@rm *.o 2>/dev/null || true
......
/* ================ Includes ===================== */
#include <criterion/criterion.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
......
/* ================ Includes ===================== */
#include <criterion/criterion.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <string.h>
#include <open62541/plugin/log_stdout.h>
#include "../../coupler/opc-ua-server/mod_io_i2c.h"
......@@ -14,7 +9,7 @@
/* ================ Function Tests =============== */
// ############# get I2C Slave List Length ##############
// ############# test safe mode ##############
Test(keepalive, gotoSafeMode) {
int result = 1;
......@@ -24,7 +19,7 @@ Test(keepalive, gotoSafeMode) {
cr_expect_eq(I2C_VIRTUAL_MODE, result);
}
// ############# Set Relay State (only virtual mode) ##############
// ############# test normal mode ##############
Test(keepalive, gotoNormalMode) {
int result = 0;
......
/* ================ Includes ===================== */
#include <criterion/criterion.h>
#include <linux/i2c-dev.h>
#include <open62541/plugin/log_stdout.h>
#include <open62541/server.h>
// #include "../../coupler/opc-ua-server/server.c"
// #include "../../coupler/opc-ua-server/common.h"
// #include "../../coupler/opc-ua-server/mod_io_i2c.h"
// #include "../../coupler/opc-ua-server/keep_alive_publisher.h"
/* ================ Function Tests =============== */
// ############# check heart beats of the server ##############
// Test(keepalivepublisher, callbackTicHeartBeat) {
// int result = 1;
// callbackTicHeartBeat();
// cr_expect_geq(HEART_BEATS, result);
// }
/* ================ Includes ===================== */
#include <criterion/criterion.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <string.h>
#include "../../coupler/opc-ua-server/mod_io_i2c.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment