Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
osie
Commits
ad52d450
Commit
ad52d450
authored
Nov 11, 2022
by
Balakrishna Balakrishna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inclusion of unit test for keep_alive and correction of build.sh
parent
07c5b898
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
17 deletions
+38
-17
tests/unit_test/Makefile
tests/unit_test/Makefile
+13
-6
tests/unit_test/test_common.c
tests/unit_test/test_common.c
+0
-1
tests/unit_test/test_keep_alive.c
tests/unit_test/test_keep_alive.c
+2
-7
tests/unit_test/test_keep_alive_publisher.c
tests/unit_test/test_keep_alive_publisher.c
+23
-0
tests/unit_test/test_modio_i2c.c
tests/unit_test/test_modio_i2c.c
+0
-3
No files found.
tests/unit_test/Makefile
View file @
ad52d450
C
FLAGS
=
-Wall
-Wno-missing-braces
-ggdb
`
pkg-config
--cflags
criterion
`
LDFLAGS
=
`
pkg-config
--libs
criterion
`
-L
$(OPEN62541_HOME)
/lib
L
IB_DIR
=
$(SRC_DIR)
te
C
C
=
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/
L
DFLAGS
=
`
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
...
...
tests/unit_test/test_common.c
View file @
ad52d450
/* ================ Includes ===================== */
#include <criterion/criterion.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
...
...
tests/unit_test/test_keep_alive.c
View file @
ad52d450
/* ================ 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
;
...
...
tests/unit_test/test_keep_alive_publisher.c
0 → 100644
View file @
ad52d450
/* ================ 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);
// }
tests/unit_test/test_modio_i2c.c
View file @
ad52d450
/* ================ 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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment