Skip to content

Commit

Permalink
Merge pull request #5007 from rdkcentral/RDK-45037-qs027
Browse files Browse the repository at this point in the history
Merge pull request #5006 from rdkcentral/RDK-45037-main
  • Loading branch information
anand-ky authored Mar 11, 2024
2 parents 660345e + 01633b0 commit 8f0416d
Show file tree
Hide file tree
Showing 48 changed files with 3,585 additions and 2,228 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/BuildThunder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
set -e

############################
# From https://rdkcentral.github.io/Thunder/introduction/build_linux/
# DO NOT MODIFY

############################
# 1. Install Dependencies

sudo apt install -y build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev

pip install jsonref

############################
# 2. Build Thunder Tools

git clone https://github.com/rdkcentral/ThunderTools.git

cmake -G Ninja -S ThunderTools -B build/ThunderTools -DCMAKE_INSTALL_PREFIX="install/usr"

cmake --build build/ThunderTools --target install

############################
# 3. Build Thunder

git clone https://github.com/rdkcentral/Thunder.git

cmake -G Ninja -S Thunder -B build/Thunder \
-DBUILD_SHARED_LIBS=ON \
-DBINDING="127.0.0.1" \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_INSTALL_PREFIX="install/usr" \
-DCMAKE_MODULE_PATH="${PWD}/install/usr/include/WPEFramework/Modules" \
-DDATA_PATH="${PWD}/install/usr/share/WPEFramework" \
-DPERSISTENT_PATH="${PWD}/install/var/wpeframework" \
-DPORT="55555" \
-DPROXYSTUB_PATH="${PWD}/install/usr/lib/wpeframework/proxystubs" \
-DSYSTEM_PATH="${PWD}/install/usr/lib/wpeframework/plugins" \
-DVOLATILE_PATH="tmp"

cmake --build build/Thunder --target install

############################
# 4. Build ThunderInterfaces

git clone https://github.com/rdkcentral/ThunderInterfaces.git

cmake -G Ninja -S ThunderInterfaces -B build/ThunderInterfaces \
-DCMAKE_INSTALL_PREFIX="install/usr" \
-DCMAKE_MODULE_PATH="${PWD}/install/usr/include/WPEFramework/Modules"

cmake --build build/ThunderInterfaces --target install
53 changes: 53 additions & 0 deletions .github/workflows/L0-PersistentStore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: L0-PersistentStore

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

jobs:
build:
runs-on: ubuntu-latest

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

- name: Install valgrind, coverage, cmake
run: |
sudo apt update
sudo apt install -y valgrind lcov cmake
- 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/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 persistentstorel0test

- name: Generate coverage
working-directory: ${{github.workspace}}
run: |
lcov -c -o coverage.info -d build/persistentstorel0test
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
53 changes: 53 additions & 0 deletions .github/workflows/L1-PersistentStore-sqlite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: L1-PersistentStore-sqlite

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

jobs:
build:
runs-on: ubuntu-latest

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

- name: Install valgrind, coverage, cmake, sqlite
run: |
sudo apt update
sudo apt install -y valgrind lcov cmake libsqlite3-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/sqlite/l1test -B build/sqlitel1test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror"
cmake --build build/sqlitel1test --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 sqlitel1test

- name: Generate coverage
working-directory: ${{github.workspace}}
run: |
lcov -c -o coverage.info -d build/sqlitel1test
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
53 changes: 53 additions & 0 deletions .github/workflows/L1-PersistentStore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: L1-PersistentStore

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

jobs:
build:
runs-on: ubuntu-latest

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

- name: Install valgrind, coverage, cmake
run: |
sudo apt update
sudo apt install -y valgrind lcov cmake
- 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/l1test -B build/persistentstorel1test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror"
cmake --build build/persistentstorel1test --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

- name: Generate coverage
working-directory: ${{github.workspace}}
run: |
lcov -c -o coverage.info -d build/persistentstorel1test
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
1 change: 0 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ jobs:
-DPLUGIN_DATACAPTURE=ON
-DPLUGIN_DEVICEDIAGNOSTICS=ON
-DPLUGIN_LOCATIONSYNC=ON
-DPLUGIN_PERSISTENTSTORE=ON
-DPLUGIN_TIMER=ON
-DPLUGIN_SECURITYAGENT=ON
-DPLUGIN_DEVICEIDENTIFICATION=ON
Expand Down
11 changes: 11 additions & 0 deletions PersistentStore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ All notable changes to this RDK Service will be documented in this file.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.

## [1.0.6] - 2024-03-11
### Added
- RPC COM interface IStore2, IStoreInspector, IStoreLimit
- JSON RPC API getStorageSizes, getNamespaceStorageLimit, setNamespaceStorageLimit
- "scope" parameter (defaults to "device")
- "ttl" parameter
- Configuration "limit" parameter
- L0, L1 unit tests
- Thunder master branch support
- Out-of-process support

## [1.0.5] - 2024-01-02
### Security
- resolved security vulnerabilities
Expand Down
77 changes: 37 additions & 40 deletions PersistentStore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,56 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(PLUGIN_NAME PersistentStore)
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})
cmake_minimum_required(VERSION 3.14)

set(PLUGIN_PERSISTENTSTORE_PATH /opt/secure/persistent/rdkservicestore CACHE STRING "Path")
set(PLUGIN_PERSISTENTSTORE_KEY "" CACHE STRING "Encryption key")
set(PLUGIN_PERSISTENTSTORE_STARTUPORDER "" CACHE STRING "To configure startup order of PersistentStore plugin")

find_package(${NAMESPACE}Plugins REQUIRED)
project(PersistentStore)

find_package(PkgConfig)
set(CMAKE_CXX_STANDARD 11)

# enabling the secure extension requires a license: https://www.hwaci.com/cgi-bin/see-step1
if (USE_SQLITE_SEE)
find_package(SqliteSee REQUIRED)
else ()
find_package(Sqlite REQUIRED)
endif ()
find_package(WPEFramework)
set(MODULE_NAME "${NAMESPACE}${PROJECT_NAME}")

# nonce generator
if (BUILD_WITH_PLABELS AND USE_SQLITE_SEE)
find_package(DL REQUIRED)
find_package(Plabels REQUIRED)
find_package(GLIB REQUIRED)
endif ()
set(PLUGIN_PERSISTENTSTORE_MODE "Off" CACHE STRING "Controls if the plugin should run in its own process, in process or remote")
set(PLUGIN_PERSISTENTSTORE_URI "ss.eu.prod.developer.comcast.com:443" CACHE STRING "Account scope endpoint")
set(PLUGIN_PERSISTENTSTORE_PATH "/opt/secure/persistent/rdkservicestore" CACHE STRING "Path")
set(PLUGIN_PERSISTENTSTORE_LEGACYPATH "/opt/persistent/rdkservicestore" CACHE STRING "Previously used path")
set(PLUGIN_PERSISTENTSTORE_KEY "" CACHE STRING "Encryption key")
set(PLUGIN_PERSISTENTSTORE_MAXSIZE "1000000" CACHE STRING "For all text data, in bytes")
set(PLUGIN_PERSISTENTSTORE_MAXVALUE "3000" CACHE STRING "For single text data, in bytes")
set(PLUGIN_PERSISTENTSTORE_LIMIT "10000" CACHE STRING "Default for all text data in namespace, in bytes")
set(PLUGIN_PERSISTENTSTORE_STARTUPORDER "" CACHE STRING "To configure startup order of PersistentStore plugin")

add_library(${MODULE_NAME} SHARED
PersistentStore.cpp
PersistentStoreJsonRpc.cpp
SqliteStore.cpp
sqlite/Store2.cpp
sqlite/StoreCache.cpp
sqlite/StoreInspector.cpp
sqlite/StoreLimit.cpp
Module.cpp
)

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

add_definitions(${SQLITE_CFLAGS_OTHER} ${PLABELS_FLAGS})
link_directories(${SQLITE_LIBRARY_DIRS})

target_include_directories(${MODULE_NAME} PRIVATE
${SQLITE_INCLUDE_DIRS}
${PLABELS_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
../helpers)
)

find_package(${NAMESPACE}Plugins REQUIRED)
find_package(${NAMESPACE}Definitions REQUIRED)
target_link_libraries(${MODULE_NAME} PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
${SQLITE_LIBRARIES}
${PLABELS_LIBRARIES}
${GLIB_LIBRARIES}
${DL_LIBRARIES})
${NAMESPACE}Definitions::${NAMESPACE}Definitions
)

find_package(PkgConfig REQUIRED)
pkg_search_module(SQLITE REQUIRED sqlite3)
target_link_libraries(${MODULE_NAME} PRIVATE ${SQLITE_LIBRARIES})

find_library(IARMBUS_LIBRARIES NAMES IARMBus)
if (IARMBUS_LIBRARIES)
find_path(IARMBUS_INCLUDE_DIRS NAMES libIBus.h PATH_SUFFIXES rdk/iarmbus REQUIRED)
find_path(IARMSYS_INCLUDE_DIRS NAMES sysMgr.h PATH_SUFFIXES rdk/iarmmgrs/sysmgr REQUIRED)
target_include_directories(${MODULE_NAME} PRIVATE ${IARMBUS_INCLUDE_DIRS} ${IARMSYS_INCLUDE_DIRS})
target_link_libraries(${MODULE_NAME} PRIVATE ${IARMBUS_LIBRARIES})
add_definitions(-DWITH_SYSMGR)
endif ()

install(TARGETS ${MODULE_NAME}
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)

write_config(${PLUGIN_NAME})
write_config()
Loading

0 comments on commit 8f0416d

Please sign in to comment.