Skip to content

Commit 0957954

Browse files
committed
[install] Add install test
1 parent ec24b34 commit 0957954

File tree

22 files changed

+989
-66
lines changed

22 files changed

+989
-66
lines changed

.github/workflows/c-cpp.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/install-test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Install test
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: make gcc install
17+
run: make BUILD_TYPE=Release INSTALL_PREFIX=/tmp/install-gcc tests-install-gcc-native
18+
- name: make clang install
19+
run: make BUILD_TYPE=Release INSTALL_PREFIX=/tmp/install-clang tests-install-clang-native
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Unit test in Debug build
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: make gcc Debug
17+
run: make gcc-native BUILD_TYPE=Debug
18+
- name: unit tests gcc Debug
19+
run: make tests-gcc-native BUILD_TYPE=Debug
20+
- name: make clang Debug
21+
run: make clang-native BUILD_TYPE=Debug
22+
- name: unit tests clang
23+
run: make tests-clang-native BUILD_TYPE=Debug
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Unit test in Release build
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: make gcc Release
17+
run: make gcc-native BUILD_TYPE=Release
18+
- name: unit tests gcc Release
19+
run: make tests-gcc-native BUILD_TYPE=Release
20+
- name: make clang Release
21+
run: make clang-native BUILD_TYPE=Release
22+
- name: unit tests clang
23+
run: make tests-clang-native BUILD_TYPE=Release

3rdparty/libwebsockets/lib/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ if (LWS_WITH_STATIC)
169169
target_include_directories(websockets PRIVATE ${LWS_LIB_BUILD_INC_PATHS})
170170
target_compile_definitions(websockets PRIVATE LWS_BUILDING_STATIC)
171171

172-
if (WIN32)
172+
#if (WIN32)
173173
# Windows uses the same .lib ending for static libraries and shared
174174
# library linker files, so rename the static library.
175175
set_target_properties(websockets
176176
PROPERTIES
177177
OUTPUT_NAME websockets_static)
178-
endif()
178+
#endif()
179179

180180
endif()
181181

@@ -375,4 +375,3 @@ set(LIB_LIST_AT_END ${LIB_LIST_AT_END} PARENT_SCOPE)
375375
endif()
376376
set(USE_WOLFSSL ${USE_WOLFSSL} PARENT_SCOPE)
377377
set(LWS_DEPS_LIB_PATHS ${LWS_DEPS_LIB_PATHS} PARENT_SCOPE)
378-

CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ if(${BUILD_STATIC_LIBRARY})
7272
json
7373
ws
7474
websockets
75-
76-
dl
7775
)
7876
set_target_properties(open-ocpp-static PROPERTIES OUTPUT_NAME "open-ocpp_static")
7977
set(OPEN_OCPP_STATIC_TARGET open-ocpp-static)
@@ -97,7 +95,7 @@ target_link_libraries(open-ocpp-dynamic
9795
ws
9896
websockets
9997

100-
dl
98+
stdc++fs
10199
)
102100
set_target_properties(open-ocpp-dynamic PROPERTIES OUTPUT_NAME "open-ocpp")
103101

@@ -107,8 +105,6 @@ include(GNUInstallDirs)
107105
file(GLOB_RECURSE PUBLIC_HEADERS RELATIVE ${CMAKE_SOURCE_DIR} "src/*.h")
108106

109107
install(TARGETS open-ocpp-dynamic ${OPEN_OCPP_STATIC_TARGET}
110-
EXPORT LibOpenOcppTargets
111-
112108
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
113109
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
114110
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -117,7 +113,7 @@ install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/openocpp
117113

118114
# Generate pkgconfig files
119115
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
120-
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/openocpp")
116+
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include/openocpp")
121117
set(PKG_CONFIG_LIBS "-L\${libdir}")
122118
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
123119

CMakeLists_Options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ add_compile_definitions(LOG_LEVEL=${LOG_LEVEL})
1010

1111
# Static library
1212
if(NOT DEFINED BUILD_STATIC_LIBRARY)
13-
set(BUILD_STATIC_LIBRARY ON)
13+
set(BUILD_STATIC_LIBRARY OFF)
1414
endif()
1515

1616
# Unit tests

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ Then you wil be able to use the following targets as dependencies for your proje
364364

365365
**Note**: If **Open OCPP** has been installed in a non standard directory, the search path for the ```pkg_search_module``` command must be specified using the following command => ```set(ENV{PKG_CONFIG_PATH} "/your/directory/containing/the/.pc/files")```
366366

367+
See the deploy test [CMakeLists.txt](./tests/deploy/CMakeLists.txt) as an example
368+
367369
## Quick start
368370

369371
The best way to start is to take a look at the [examples](./examples/README.md) and more specifically at the [quick start Charge Point example](./examples/quick_start_chargepoint/README.md) and the [quick start Central System example](./examples/quick_start_centralsystem/README.md).

examples/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ target_include_directories(examples_common PUBLIC . config simulators)
1414
# Dependencies
1515
target_link_libraries(examples_common
1616
open-ocpp-dynamic
17+
pthread
1718
)

examples/common/DefaultCentralSystemEventsHandler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ bool DefaultCentralSystemEventsHandler::ChargePointRequestHandler::signCertifica
357357
std::stringstream sign_cert_cmd_line;
358358
sign_cert_cmd_line << "openssl x509 -req -sha256 -days 3650 -in " << csr_filename << " -CA " << ca_cert_path << " -CAkey "
359359
<< ca_cert_key_path << " -CAcreateserial -out " << certificate_filename;
360-
system(sign_cert_cmd_line.str().c_str());
360+
int err = WEXITSTATUS(system(sign_cert_cmd_line.str().c_str()));
361+
cout << "Command line : " << sign_cert_cmd_line.str() << " => " << err << endl;
361362

362363
// Check if the certificate has been generated
363364
if (std::filesystem::exists(certificate_filename))
@@ -366,7 +367,8 @@ bool DefaultCentralSystemEventsHandler::ChargePointRequestHandler::signCertifica
366367
std::string bundle_filename = certificate_filename + ".bundle";
367368
std::stringstream generate_bundle_cmd_line;
368369
generate_bundle_cmd_line << "cat " << certificate_filename << " " << ca_cert_path << " > " << bundle_filename;
369-
system(generate_bundle_cmd_line.str().c_str());
370+
err = WEXITSTATUS(system(generate_bundle_cmd_line.str().c_str()));
371+
cout << "Command line : " << generate_bundle_cmd_line.str() << " => " << err << endl;
370372
if (std::filesystem::exists(bundle_filename))
371373
{
372374
m_generated_certificate = bundle_filename;

0 commit comments

Comments
 (0)