Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
npoltorapavlo committed Feb 8, 2024
1 parent d72e51c commit 333bdde
Show file tree
Hide file tree
Showing 20 changed files with 1,321 additions and 338 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/L0-PersistentStore-grpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: L0-PersistentStore-grpc

on:
push:
paths:
- PersistentStore/grpc/**
pull_request:
paths:
- PersistentStore/grpc/**

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
path: ${{github.repository}}

- name: Install valgrind, coverage, cmake, protoc, grpc_cpp_plugin, grpc
run: |
sudo apt update
sudo apt install -y valgrind lcov cmake protobuf-compiler protobuf-compiler-grpc libgrpc++-dev
- name: Build Thunder
working-directory: ${{github.workspace}}
run: sh +x ${GITHUB_REPOSITORY}/.github/workflows/BuildThunder.sh

- name: Build
working-directory: ${{github.workspace}}
run: |
cmake -S ${GITHUB_REPOSITORY}/PersistentStore/grpc/l0test -B build/persistentstoregrpcl0test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror"
cmake --build build/persistentstoregrpcl0test --target install
- name: Run
working-directory: ${{github.workspace}}
run: PATH=${PWD}/install/usr/bin:${PATH} LD_LIBRARY_PATH=${PWD}/install/usr/lib:${LD_LIBRARY_PATH} valgrind --tool=memcheck --log-file=valgrind_log --leak-check=yes --show-reachable=yes --track-fds=yes --fair-sched=try grpcl0test

- name: Generate coverage
working-directory: ${{github.workspace}}
run: |
lcov -c -o coverage.info -d build/persistentstoregrpcl0test
genhtml -o coverage coverage.info
- name: Upload artifacts
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
coverage/
valgrind_log
if-no-files-found: warn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: L1-PersistentStore
name: L0-PersistentStore

on:
push:
Expand All @@ -13,43 +13,41 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: rdkservices
path: ${{github.repository}}

- name: Install valgrind, coverage, cmake, sqlite
- name: Install valgrind, coverage, cmake
run: |
sudo apt update
sudo apt install -y valgrind lcov cmake libsqlite3-dev
sudo apt install -y valgrind lcov cmake
- name: Build Thunder
working-directory: ${{github.workspace}}
run: sh +x rdkservices/.github/workflows/BuildThunder.sh

- name: Configure
working-directory: ${{github.workspace}}
run: cmake -S rdkservices/PersistentStore/l1test -B build/persistentstorel1test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror"
run: sh +x ${GITHUB_REPOSITORY}/.github/workflows/BuildThunder.sh

- name: Build
working-directory: ${{github.workspace}}
run: cmake --build build/persistentstorel1test --target install
run: |
cmake -S ${GITHUB_REPOSITORY}/PersistentStore/l0test -B build/persistentstorel0test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror"
cmake --build build/persistentstorel0test --target install
- name: Run
working-directory: ${{github.workspace}}
run: PATH=${PWD}/install/usr/bin:${PATH} LD_LIBRARY_PATH=${PWD}/install/usr/lib:${LD_LIBRARY_PATH} valgrind --tool=memcheck --log-file=valgrind_log --leak-check=yes --show-reachable=yes --track-fds=yes --fair-sched=try persistentstorel1test
run: PATH=${PWD}/install/usr/bin:${PATH} LD_LIBRARY_PATH=${PWD}/install/usr/lib:${LD_LIBRARY_PATH} valgrind --tool=memcheck --log-file=valgrind_log --leak-check=yes --show-reachable=yes --track-fds=yes --fair-sched=try persistentstorel0test

- name: Generate coverage
working-directory: ${{github.workspace}}
run: |
lcov -c -o coverage.info -d build/persistentstorel1test
lcov -c -o coverage.info -d build/persistentstorel0test
genhtml -o coverage coverage.info
- name: Upload artifacts
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
coverage/
valgrind_log
if-no-files-found: warn
if-no-files-found: warn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: L1-Sqlite
name: L1-PersistentStore-sqlite

on:
push:
Expand Down
11 changes: 6 additions & 5 deletions PersistentStore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ find_package(WPEFramework)

project_version(1.0.0)

set(MODULE_NAME ${NAMESPACE}${PROJECT_NAME})
set(MODULE_NAME ${NAMESPACE} ${PROJECT_NAME})

message("Setup ${MODULE_NAME} v${PROJECT_VERSION}")

Expand Down Expand Up @@ -55,13 +55,14 @@ add_library(${MODULE_NAME} SHARED
PersistentStore.cpp
PersistentStoreJsonRpc.cpp
sqlite/Handle.cpp
sqlite/ServiceRegistration.cpp
Module.cpp
)
)

set_target_properties(${MODULE_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES
)
)

add_definitions(${SQLITE_CFLAGS_OTHER})
link_directories(${SQLITE_LIBRARY_DIRS})
Expand All @@ -71,14 +72,14 @@ target_include_directories(${MODULE_NAME} PRIVATE
${SQLITE_INCLUDE_DIRS}
${IARMBUS_INCLUDE_DIRS}
${IARMSYS_INCLUDE_DIRS}
)
)

target_link_libraries(${MODULE_NAME} PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
${NAMESPACE}Definitions::${NAMESPACE}Definitions
${SQLITE_LIBRARIES}
${IARMBUS_LIBRARIES}
)
)

install(TARGETS ${MODULE_NAME}
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)
Expand Down
29 changes: 0 additions & 29 deletions PersistentStore/PersistentStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@

#include "PersistentStore.h"

#include "sqlite/Handle.h"
#include "sqlite/Store2Type.h"
#include "sqlite/Store2WithReconnectType.h"
#if defined(WITH_CLOCK_SYNC)
#include "sqlite/Store2WithClockSyncType.h"
#endif
#include "sqlite/StoreCacheType.h"
#include "sqlite/StoreInspectorType.h"
#include "sqlite/StoreLimitType.h"

#include <fstream>

#define API_VERSION_NUMBER_MAJOR 1
Expand All @@ -52,25 +42,6 @@ namespace {

namespace Plugin {

#if defined(WITH_CLOCK_SYNC)
class SqliteStore2 : public Sqlite::Store2WithClockSyncType<Sqlite::Store2WithReconnectType<Sqlite::Store2Type<Sqlite::Handle>>> {
};
#else
class SqliteStore2 : public Sqlite::Store2WithReconnectType<Sqlite::Store2Type<Sqlite::Handle>> {
};
#endif
class SqliteStoreCache : public Sqlite::StoreCacheType<Sqlite::Handle> {
};
class SqliteStoreInspector : public Sqlite::StoreInspectorType<Sqlite::Handle> {
};
class SqliteStoreLimit : public Sqlite::StoreLimitType<Sqlite::Handle> {
};

SERVICE_REGISTRATION(SqliteStore2, 1, 0);
SERVICE_REGISTRATION(SqliteStoreCache, 1, 0);
SERVICE_REGISTRATION(SqliteStoreInspector, 1, 0);
SERVICE_REGISTRATION(SqliteStoreLimit, 1, 0);

SERVICE_REGISTRATION(PersistentStore, API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH);

const string PersistentStore::Initialize(PluginHost::IShell* service)
Expand Down
Loading

0 comments on commit 333bdde

Please sign in to comment.