Skip to content

Commit 371e366

Browse files
trupthi1403tboova469_comcast
authored andcommitted
RDKEMW-9172: L2testcase for rdkNativeScript
Reason for change: Added jsruntime_L2tests.yml and updated to run L2 test cases Test Procedure: Able to build and run test cases in CI Risks: low Priority: P2
2 parents 88a1597 + ed86930 commit 371e366

7 files changed

Lines changed: 262 additions & 127 deletions

File tree

.github/workflows/jsruntime_L1tests.yml

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: JSRuntime L2 Tests with Coverage
2+
permissions:
3+
contents: read
4+
checks: write
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [topic/RDKEMW-9172]
10+
pull_request:
11+
branches: [topic/RDKEMW-9172]
12+
13+
jobs:
14+
build-nativescript:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout main source repository
19+
uses: actions/checkout@v3
20+
21+
- name: Install dependencies
22+
run: |
23+
sudo apt-get update && sudo apt-get install -y \
24+
git cmake gperf ruby-dev libglew-dev libglut-dev \
25+
libglib2.0-dev libglib2.0-0 g++ meson bison libjpeg-dev libpng-dev \
26+
libfreetype6-dev libicu-dev autoconf libtool libxml2-dev \
27+
libcurl4-openssl-dev libexpat1-dev doxygen vim libcjson-dev \
28+
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
29+
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
30+
gstreamer1.0-plugins-ugly gstreamer1.0-libav \
31+
gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa \
32+
libwayland-bin libwayland-dev wayland-protocols \
33+
libreadline-dev net-tools libmount1 libpcre3 libselinux1 zlib1g \
34+
libunwind-dev libboost-dev libboost-system-dev libboost-thread-dev libboost-chrono-dev libwebsocketpp-dev jq \
35+
lcov
36+
37+
- name: Print GCC/G++/GCOV version
38+
run: |
39+
echo "GCC version:"; gcc --version
40+
echo "G++ version:"; g++ --version
41+
echo "GCOV version:"; gcov --version
42+
43+
- name: Get asset ID for externals.zip
44+
id: asset
45+
run: |
46+
ASSET_ID=$(curl -s -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
47+
https://api.github.com/repos/rdk-e/rdkNativeScript_tests/releases/tags/extlibs | \
48+
jq '.assets[] | select(.name=="externals.zip") | .id')
49+
echo "ASSET_ID=$ASSET_ID" >> $GITHUB_ENV
50+
51+
- name: Download externals.zip using asset ID
52+
run: |
53+
curl -L \
54+
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
55+
-H "Accept: application/octet-stream" \
56+
-o externals.zip \
57+
https://api.github.com/repos/rdk-e/rdkNativeScript_tests/releases/assets/$ASSET_ID
58+
59+
- name: Check externals.zip download
60+
run: |
61+
file externals.zip
62+
ls -lh externals.zip
63+
unzip -l externals.zip | head -20
64+
65+
- name: Extract externals.zip
66+
run: |
67+
unzip -o externals.zip
68+
69+
- name: Set LD_LIBRARY_PATH for ICU 66
70+
run: echo "LD_LIBRARY_PATH=$(pwd)/externals/extlibs/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
71+
72+
- name: Configure and build nativescript with coverage
73+
run: |
74+
mkdir -p build
75+
cd build
76+
cmake .. \
77+
-DENABLE_JSRUNTIME_ESSOS=ON \
78+
-DJSRUNTIME_ENGINE_NAME=jsc \
79+
-DENABLE_JSRUNTIME_PLAYER=ON \
80+
-DENABLE_AAMP_JSBINDINGS_DYNAMIC=ON \
81+
-DBUILD_JSRUNTIME_CLIENT=ON \
82+
-DENABLE_JSRUNTIME_SERVER=ON \
83+
-DENABLE_COVERAGE=ON \
84+
-DNATIVEJS_DEVELOPER_MODE=ON \
85+
-DNATIVEJS_L2_BUILD=ON \
86+
-DCMAKE_CXX_FLAGS="-I../externals/extlibs/include/rtcore" \
87+
-DCMAKE_BUILD_TYPE=Debug
88+
cmake --build .
89+
90+
- name: Setup modules directory
91+
run: |
92+
cd build
93+
mkdir -p modules
94+
cp -R ../utils jsc_modules
95+
cp -R ../src/jsc/modules/* modules/.
96+
cp -R ../utils/* modules/.
97+
98+
- name: Set library paths
99+
run: |
100+
echo "LD_LIBRARY_PATH=$(pwd)/build:$(pwd)/externals/extlibs/lib:/usr/lib/javascriptcore:$LD_LIBRARY_PATH" >> $GITHUB_ENV
101+
102+
- name: Checkout L2 test repository
103+
uses: actions/checkout@v3
104+
with:
105+
repository: rdk-e/rdkNativeScript_tests
106+
token: ${{ secrets.GH_PAT }}
107+
path: rdkNativeScript_tests
108+
ref: topic/RDKEMW-9172
109+
110+
- name: Run L2 tests with coverage
111+
run: |
112+
export SRC_REPO_DIR="${GITHUB_WORKSPACE}"
113+
export BUILD_DIR="${SRC_REPO_DIR}/build"
114+
export TEST_REPO_DIR="${GITHUB_WORKSPACE}/rdkNativeScript_tests"
115+
export TEST_FRAMEWORK_DIR="${TEST_REPO_DIR}/L2/test_framework"
116+
export TEST_SCRIPTS_DIR="${TEST_REPO_DIR}/L2/test_scripts"
117+
export TEST_RESULTS_DIR="${TEST_FRAMEWORK_DIR}/../test_results"
118+
export JSRUNTIME_BINARY="${BUILD_DIR}/JSRuntimeJSC"
119+
export LD_LIBRARY_PATH="${BUILD_DIR}:${SRC_REPO_DIR}/externals/extlibs/lib:${SRC_REPO_DIR}/externals/extlibs/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}"
120+
export GST_DEBUG=2
121+
export GST_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gstreamer-1.0
122+
export GST_DEBUG_NO_COLOR=1
123+
export PULSE_SERVER=/dev/null
124+
cd "${TEST_FRAMEWORK_DIR}"
125+
chmod +x ./coverage.sh ./run_tests.sh
126+
./coverage.sh
127+
128+
- name: Verify test execution
129+
run: |
130+
echo "=== Test Results Summary ==="
131+
ls -lh rdkNativeScript_tests/L2/test_results/
132+
echo ""
133+
echo "=== Tests that ran ==="
134+
for log in rdkNativeScript_tests/L2/test_results/*.log; do
135+
echo "$(basename $log): $(wc -l < $log) lines"
136+
done
137+
echo ""
138+
echo "=== Coverage data files (.gcda) ==="
139+
gcda_count=$(find build -name "*.gcda" -type f | wc -l)
140+
echo "Total .gcda files: $gcda_count"
141+
find build -name "*.gcda" -type f -exec ls -lh {} \; | head -20
142+
echo ""
143+
echo "=== .gcda file timestamps (verify they're fresh) ==="
144+
find build -name "*.gcda" -type f -printf '%T+ %p\n' | head -10
145+
146+
- name: Upload coverage report
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: l2-coverage-report
150+
path: rdkNativeScript_tests/L2/coverage_report/
151+
if-no-files-found: error
152+
153+
- name: Upload test results
154+
uses: actions/upload-artifact@v4
155+
with:
156+
name: l2-test-results
157+
path: rdkNativeScript_tests/L2/test_results/
158+
if-no-files-found: warn
159+
160+
- name: Check coverage summary
161+
run: |
162+
if [ -f "rdkNativeScript_tests/L2/coverage_report/coverage_summary.txt" ]; then
163+
echo "=== Coverage Summary ==="
164+
cat rdkNativeScript_tests/L2/coverage_report/coverage_summary.txt
165+
fi

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [1.0.10](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.9...1.0.10)
8+
9+
- RDKEMW-9765 : [BUG_FIX]UserAgent string need to be aligned with browser for diff… [`#77`](https://github.com/rdkcentral/rdkNativeScript/pull/77)
10+
- RDKEMW-9765 : [BUG_FIX]UserAgent string need to be aligned with browser for different agents [`881b332`](https://github.com/rdkcentral/rdkNativeScript/commit/881b332528ae114f0a9c2f767c8a1436154d380c)
11+
- Merge tag '1.0.9' into develop [`b60efc0`](https://github.com/rdkcentral/rdkNativeScript/commit/b60efc01bf49975196c7a55aa3e6736af753916b)
12+
713
#### [1.0.9](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.8...1.0.9)
814

9-
- RDK-59629 : UserAgent string need to be aligned with browser for diff… [`#74`](https://github.com/rdkcentral/rdkNativeScript/pull/74)
10-
- RDK-59629 : UserAgent string need to be aligned with browser for different agents [`55af0ec`](https://github.com/rdkcentral/rdkNativeScript/commit/55af0ec4471fa402421f3dd29370712e23e452b9)
15+
> 22 October 2025
16+
17+
- RDKEMW-59629 : UserAgent string need to be aligned with browser for diff… [`#74`](https://github.com/rdkcentral/rdkNativeScript/pull/74)
18+
- RDKEMW-59629 : UserAgent string need to be aligned with browser for different agents [`55af0ec`](https://github.com/rdkcentral/rdkNativeScript/commit/55af0ec4471fa402421f3dd29370712e23e452b9)
19+
- 1.0.9 release changelog updates [`85fcc69`](https://github.com/rdkcentral/rdkNativeScript/commit/85fcc6933d60d3b46da0fd144adb19f3d458575b)
1120
- Merge tag '1.0.8' into develop [`bad6257`](https://github.com/rdkcentral/rdkNativeScript/commit/bad62579572069c5a3f06bb70c0152022ddc7ce7)
1221

1322
#### [1.0.8](https://github.com/rdkcentral/rdkNativeScript/compare/1.0.7...1.0.8)
@@ -53,7 +62,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
5362
> 7 September 2025
5463
5564
- RDKEMW-7489: Adding Href support [`#54`](https://github.com/rdkcentral/rdkNativeScript/pull/54)
56-
- Ticket:RDKEMW-5556: Bug for terminateApplication [`#51`](https://github.com/rdkcentral/rdkNativeScript/pull/51)
65+
- RDKEMW-5556: Bug for terminateApplication [`#51`](https://github.com/rdkcentral/rdkNativeScript/pull/51)
5766
- 1.0.4 release changelog updates [`2e56742`](https://github.com/rdkcentral/rdkNativeScript/commit/2e56742d0adda04fe61277fa0782e2b5b2dde19c)
5867
- Merge tag '1.0.3' into develop [`e15828d`](https://github.com/rdkcentral/rdkNativeScript/commit/e15828d5a330b072753e682f5c446b0f9ae14531)
5968

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ option(BUILD_JSRUNTIME_APP "BUILD_JSRUNTIME_APP" ON)
2626
option(ENABLE_JSRUNTIME_SERVER "ENABLE_JSRUNTIME_SERVER" OFF)
2727
option(BUILD_JSRUNTIME_CLIENT "BUILD_JSRUNTIME_CLIENT" OFF)
2828
option(NATIVEJS_DEVELOPER_MODE "NATIVEJS_DEVELOPER_MODE" OFF)
29+
option(NATIVEJS_L2_BUILD "NATIVEJS_L2_BUILD" OFF)
2930

3031
#can be jsc or node or v8 or quickjs
3132
option(JSRUNTIME_ENGINE_NAME "JSRUNTIME_ENGINE_NAME" "jsc")
@@ -39,6 +40,7 @@ option(ENABLE_JSRUNTIME_PLAYER "ENABLE_JSRUNTIME_PLAYER" OFF)
3940
option(ENABLE_JSRUNTIME_THUNDER_SECURITYAGENT "ENABLE_JSRUNTIME_THUNDER_SECURITYAGENT" OFF)
4041
option(BUILD_JSRUNTIME_DESKTOP "BUILD_JSRUNTIME_DESKTOP" ON)
4142
option(USE_ETHANLOG "USE_ETHANLOG" OFF)
43+
option(ENABLE_COVERAGE "ENABLE_COVERAGE" OFF)
4244
option(PKG_CONFIG_SYSROOT_DIR "PKG_CONFIG_SYSROOT_DIR" "${CMAKE_CURRENT_SOURCE_DIR}/externals/extlibs")
4345

4446
if(JSRUNTIME_ENGINE_NAME STREQUAL "jsc")
@@ -101,6 +103,14 @@ if (ENABLE_JSRUNTIME_THUNDER_SECURITYAGENT)
101103
add_definitions("-DENABLE_JSRUNTIME_THUNDER_SECURITYAGENT")
102104
endif (ENABLE_JSRUNTIME_THUNDER_SECURITYAGENT)
103105

106+
if (NATIVEJS_DEVELOPER_MODE)
107+
add_definitions("-DNATIVEJS_DEVELOPER_MODE")
108+
endif (NATIVEJS_DEVELOPER_MODE)
109+
110+
if (NATIVEJS_L2_BUILD)
111+
add_definitions("-DNATIVEJS_L2_BUILD")
112+
endif (NATIVEJS_L2_BUILD)
113+
104114
include (${JSRUNTIME_SOURCE_DIRECTORY}/include.cmake)
105115
set(JSRUNTIME_APP_FILES
106116
${JSRUNTIME_COMMON_SOURCE_DIRECTORY}/jsruntime.cpp
@@ -188,6 +198,16 @@ if (APPLE)
188198
endif (APPLE)
189199

190200
add_definitions("-std=c++17 -DUSE_LIBUV")
201+
202+
# Coverage support
203+
if (ENABLE_COVERAGE)
204+
message("Enabling code coverage support")
205+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
206+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
207+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
208+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
209+
endif (ENABLE_COVERAGE)
210+
191211
set_target_properties(${JSRUNTIME_LIBRARY_NAME} PROPERTIES
192212
CXX_STANDARD 17
193213
CXX_STANDARD_REQUIRED YES)

include/NativeJSRenderer.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <ModuleSettings.h>
3232
#include <condition_variable>
3333
#include <list>
34+
#include <thread>
3435

3536
namespace JsRuntime {
3637

@@ -125,7 +126,10 @@ namespace JsRuntime {
125126
bool terminate();
126127
void run();
127128
void setEnvForConsoleMode(ModuleSettings& moduleSettings);
128-
bool runApplication(uint32_t id, std::string url);
129+
static std::atomic_bool consoleLoop;
130+
std::atomic_bool mShutdownConsole{false};
131+
std::thread mConsoleThread;
132+
bool runApplication(uint32_t id, std::string url);
129133
bool runJavaScript(uint32_t id, std::string code);
130134
uint32_t createApplication(ModuleSettings& moduleSettings, std::string userAgent = DEFAULT_USER_AGENT) ;
131135
bool terminateApplication(uint32_t id);

0 commit comments

Comments
 (0)