Skip to content

Commit 1247691

Browse files
committed
test CI
1 parent 80272d8 commit 1247691

File tree

65 files changed

+1854
-1681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1854
-1681
lines changed

.github/workflows/coverage_tests.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: "Unit Tests"
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Install Dependencies
14+
run: |
15+
sudo apt-get -y update
16+
sudo apt-get install -y git build-essential gcc pkg-config cmake python3 check
17+
sudo apt install python3-pip -y
18+
pip3 install coverage
19+
pip3 install gcovr
20+
git clone https://github.com/open62541/open62541
21+
cd open62541
22+
git fetch --all --tags
23+
git checkout tags/v1.4.6 -b v1.4.6-branch
24+
git submodule update --init --recursive
25+
mkdir build && cd build
26+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_NAMESPACE_ZERO=FULL -DUA_ENABLE_JSON_ENCODING=ON -DUA_MULTITHREADING=200 ..
27+
sudo make install
28+
cd ..
29+
git clone https://github.com/FraunhoferIOSB/swap-it-open62541-server-template.git
30+
cd swap-it-open62541-server-template
31+
mkdir build && cd build
32+
cmake ..
33+
sudo make install
34+
cd /home/runner/work/swap-it-registry-module
35+
ls
36+
pwd
37+
- name: Fetch
38+
uses: actions/checkout@v4
39+
with:
40+
path: main
41+
- name: Run registry module coverage tests
42+
run: |
43+
cd main
44+
mkdir build && cd build
45+
cmake ..
46+
make -j $(nproc)
47+
make test
48+
gcovr -r .. --gcov-ignore-parse-errors -e ../build/ -e ../deps/ -e ../tests/ -e ../main.c ../coverage.html
49+
50+
- name: Upload coverage reports to Codecov
51+
uses: codecov/codecov-action@v3
52+
with:
53+
gcov: true
54+
gcov_include: node_finder.c
55+
queue_handler.c
56+
register_callbacks.c
57+
server_internal.c
58+
swap_it.c
59+
60+
token: ${{ secrets.CODECOV_TOKEN }}
61+
slug: FlorianDue/check_registry_module
62+

.github/workflows/unit_tests.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Unit Tests"
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Install Dependencies
14+
run: |
15+
sudo apt-get -y update
16+
sudo apt-get install -y git build-essential gcc pkg-config cmake python3 check
17+
sudo apt install python3-pip -y
18+
pip3 install coverage
19+
git clone https://github.com/open62541/open62541
20+
cd open62541
21+
git fetch --all --tags
22+
git checkout tags/v1.4.6 -b v1.4.6-branch
23+
git submodule update --init --recursive
24+
mkdir build && cd build
25+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_NAMESPACE_ZERO=FULL -DUA_ENABLE_JSON_ENCODING=ON -DUA_MULTITHREADING=200 ..
26+
sudo make install
27+
cd ..
28+
git clone https://github.com/FraunhoferIOSB/swap-it-open62541-server-template.git
29+
cd swap-it-open62541-server-template
30+
mkdir build && cd build
31+
cmake ..
32+
sudo make install
33+
cd /home/runner/work/swap-it-registry-module
34+
ls
35+
pwd
36+
- name: Fetch
37+
uses: actions/checkout@v4
38+
with:
39+
path: main
40+
- name: Run registry module unit tests
41+
run: |
42+
cd main
43+
mkdir build && cd build
44+
cmake ..
45+
make -j $(nproc)
46+
make test
47+
48+

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ docker-compose.yml
55
Dockerfile
66
.idea
77
.vscode
8+
9+
10+
coverage.html

CMakeLists.txt

+38-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1+
#[[/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/]]
19
cmake_minimum_required(VERSION 3.20.0)
210
project(swap-it-registry-module)
311

412
find_package(open62541 1.4 REQUIRED)
513
set(CMAKE_C_STANDARD 99)
614

7-
set( CMAKE_C_FLAGS "-Wall -Werror -Wunused -O4 -fvisibility=hidden ${CMAKE_C_FLAGS}" )
8-
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
9-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_DEBUG} -no-pie")
15+
#set( CMAKE_C_FLAGS "-Wall -Werror -Wunused -O4 -fvisibility=hidden ${CMAKE_C_FLAGS}" )
16+
set(GCC_COVERAGE_COMPILE_FLAGS "--coverage -g -O0 -fprofile-arcs -ftest-coverage")
17+
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})
18+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
19+
1020

1121
file(MAKE_DIRECTORY "${GENERATE_OUTPUT_DIR}")
1222
set(GENERATE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/src_generated/")
1323
include_directories("${GENERATE_OUTPUT_DIR}")
1424

1525
set(PATH_TO_INFORMATION_MODELS ${PROJECT_SOURCE_DIR}/model)
26+
set(INFORMATION_MODEL_DIR ${PROJECT_SOURCE_DIR}/tests/InformationModels)
1627

1728
set(INCLUDE_SRC_FILES
1829
${PROJECT_SOURCE_DIR}/src/registry_module_config_parse.c
@@ -52,6 +63,29 @@ ua_generate_nodeset_and_datatypes(
5263
INTERNAL
5364
)
5465

66+
#generate c code from the pfdl types model
67+
ua_generate_nodeset_and_datatypes(
68+
NAME "pfdl_parameter"
69+
FILE_BSD "${INFORMATION_MODEL_DIR}/SWAP.Fraunhofer.Demo.Scenario.Model.Types.bsd"
70+
FILE_CSV "${INFORMATION_MODEL_DIR}/DemoScenarioTypes.ModelDesign.csv"
71+
FILE_NS "${INFORMATION_MODEL_DIR}/SWAP.Fraunhofer.Demo.Scenario.Model.NodeSet2.xml"
72+
OUTPUT_DIR ${GENERATE_OUTPUT_DIR}
73+
INTERNAL
74+
)
75+
#generate c code from the warehouse model and set the dependencies to the common and pfdl types models
76+
ua_generate_nodeset_and_datatypes(
77+
NAME "warehouse"
78+
DEPENDS "common"
79+
DEPENDS "pfdl_parameter"
80+
FILE_BSD "${INFORMATION_MODEL_DIR}/SWAP.Fraunhofer.Demo.Scenario.Warehouse.Model.Types.bsd"
81+
FILE_CSV "${INFORMATION_MODEL_DIR}/DemoScenarioWarehouse.ModelDesign.csv"
82+
FILE_NS "${INFORMATION_MODEL_DIR}/SWAP.Fraunhofer.Demo.Scenario.Warehouse.Model.NodeSet2.xml"
83+
IMPORT_BSD "TYPES_COMMON#${PATH_TO_INFORMATION_MODELS}/SWAP.Fraunhofer.Common.Model.Types.bsd"
84+
IMPORT_BSD "TYPES_PFDL_PARAMETER#${INFORMATION_MODEL_DIR}/SWAP.Fraunhofer.Demo.Scenario.Model.Types.bsd"
85+
OUTPUT_DIR ${GENERATE_OUTPUT_DIR}
86+
INTERNAL
87+
)
88+
5589
add_executable(swap-it-registry-module main.c
5690
${UA_NODESET_COMMON_SOURCES}
5791
${UA_TYPES_COMMON_SOURCES}
@@ -69,7 +103,7 @@ target_link_libraries(swap-it-registry-module pthread)
69103

70104
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/deps/cmake")
71105
enable_testing()
72-
add_subdirectory(tests)
106+
add_subdirectory(tests/unit_tests)
73107

74108
macro(print_all_variables)
75109
message(STATUS "print_all_variables------------------------------------------{")

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,51 @@ For open source projects, say how it is licensed.
9090

9191
## Project status
9292
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
93+
94+
95+
## Build Documentation
96+
97+
To build the documentation, sphinx and the sphinx rtd theme are required. Both can be installed with:
98+
99+
sphinx sphinx-rtd-theme myst_parser rst2pdf
100+
101+
Build the Registry-Module:
102+
103+
/*install dependencies check and open62541)*/
104+
apt-get -y update
105+
apt-get -y install git build-essential gcc pkg-config cmake python3 check
106+
git clone https://github.com/open62541/open62541
107+
cd open62541
108+
109+
/*switch to open62541 version 1.3.10*/
110+
git fetch --all --tags
111+
git checkout tags/v1.4.6 -b v1.4.6-branch
112+
113+
/* init submodules, build and install open62541*/
114+
git submodule update --init --recursive
115+
mkdir build && cd build
116+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_NAMESPACE_ZERO=FULL -DUA_ENABLE_JSON_ENCODING=ON -DUA_MULTITHREADING=200 ..
117+
make install
118+
119+
/*install the server template*/
120+
git clone https://github.com/FraunhoferIOSB/swap-it-open62541-server-template
121+
cd swap-it-open62541-server-template
122+
mkdir build && cd build
123+
cmake ..
124+
make install
125+
126+
/*build and start the registry module*/
127+
git clone https://github.com/FraunhoferIOSB/swap-it-registry-module
128+
cd swap-it-registry-module
129+
mkdir build && cd build
130+
cmake ..
131+
make
132+
./swap-it-registry-module
133+
134+
Build the documentation:
135+
136+
cd this repository
137+
#html
138+
sphinx-build -M html documentation/source/ documentation/build/html
139+
#pdf
140+
sphinx-build -b pdf documentation/source/ documentation/build/pdf/

aggregation_server_config.json5

-43
This file was deleted.

include/registry_module_callback_functions.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
1+
/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/
29
#ifndef OPEN62541_CALLBACK_FUNCTIONS_H_
310
#define OPEN62541_CALLBACK_FUNCTIONS_H_
411

include/registry_module_capability_matching_functions.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
//
2-
// Created by flo47663 on 03.03.2023.
3-
//
1+
/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/
49
#ifndef OPEN62541_CAPABILITY_MATCHING_FUNCTIONS_H_
510
#define OPEN62541_CAPABILITY_MATCHING_FUNCTIONS_H_
611

include/registry_module_clear.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/
19
#ifndef REGISTRY_MODULE_CLEAR_H_
210
#define REGISTRY_MODULE_CLEAR_H_
311

4-
/*
5-
#include "registry_module_client_interface.h"*/
612
#include "registry_module_internal.h"
713

814
UA_StatusCode clear_node_context(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle);

include/registry_module_client_interface.h

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/
19
#ifndef REGISTRY_MODULE_CLIENT_INTERFACE_H_
210
#define REGISTRY_MODULE_CLIENT_INTERFACE_H_
311
#include <pthread.h>

include/registry_module_config_parse.h

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/
19
#ifndef REGISTRY_MODULE_CONFIG_PARSE_H_
210
#define REGISTRY_MODULE_CONFIG_PARSE_H_
311

include/registry_module_init.h

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Licensed under the MIT License.
3+
* For details on the licensing terms, see the LICENSE file.
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Copyright 2024 (c) Fraunhofer IOSB (Author: Florian Düwel)
7+
*
8+
*/
19
#ifndef REGISTRY_MODULE_INIT_H_
210
#define REGISTRY_MODULE_INIT_H_
311

0 commit comments

Comments
 (0)