Repository navigation
RDKEMW-9172: L2testcase for rdkNativeScript #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: JSRuntime L2 Tests with Coverage | |
| permissions: | |
| contents: read | |
| checks: write | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [topic/RDKEMW-9172] | |
| pull_request: | |
| branches: [topic/RDKEMW-9172] | |
| jobs: | |
| build-nativescript: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main source repository | |
| uses: actions/checkout@v3 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y \ | |
| git cmake gperf ruby-dev libglew-dev libglut-dev \ | |
| libglib2.0-dev libglib2.0-0 g++ meson bison libjpeg-dev libpng-dev \ | |
| libfreetype6-dev libicu-dev autoconf libtool libxml2-dev \ | |
| libcurl4-openssl-dev libexpat1-dev doxygen vim libcjson-dev \ | |
| libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ | |
| gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ | |
| gstreamer1.0-plugins-ugly gstreamer1.0-libav \ | |
| gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa \ | |
| libwayland-bin libwayland-dev wayland-protocols \ | |
| libreadline-dev net-tools libmount1 libpcre3 libselinux1 zlib1g \ | |
| libunwind-dev libboost-dev libboost-system-dev libboost-thread-dev libboost-chrono-dev libwebsocketpp-dev jq \ | |
| lcov | |
| - name: Get asset ID for externals.zip | |
| id: asset | |
| run: | | |
| ASSET_ID=$(curl -s -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ | |
| https://api.github.com/repos/rdk-e/rdkNativeScript_tests/releases/tags/extlibs | \ | |
| jq '.assets[] | select(.name=="externals.zip") | .id') | |
| echo "ASSET_ID=$ASSET_ID" >> $GITHUB_ENV | |
| - name: Download externals.zip using asset ID | |
| run: | | |
| curl -L \ | |
| -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ | |
| -H "Accept: application/octet-stream" \ | |
| -o externals.zip \ | |
| https://api.github.com/repos/rdk-e/rdkNativeScript_tests/releases/assets/$ASSET_ID | |
| - name: Check externals.zip download | |
| run: | | |
| file externals.zip | |
| ls -lh externals.zip | |
| unzip -l externals.zip | head -20 | |
| - name: Extract externals.zip | |
| run: | | |
| unzip -o externals.zip | |
| - name: Set LD_LIBRARY_PATH for ICU 66 | |
| run: echo "LD_LIBRARY_PATH=$(pwd)/externals/extlibs/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| - name: Configure and build nativescript with coverage | |
| run: | | |
| mkdir -p build | |
| cd build | |
| cmake .. \ | |
| -DENABLE_JSRUNTIME_ESSOS=ON \ | |
| -DJSRUNTIME_ENGINE_NAME=jsc \ | |
| -DENABLE_JSRUNTIME_PLAYER=ON \ | |
| -DENABLE_AAMP_JSBINDINGS_DYNAMIC=ON \ | |
| -DBUILD_JSRUNTIME_CLIENT=ON \ | |
| -DENABLE_JSRUNTIME_SERVER=ON \ | |
| -DENABLE_COVERAGE=ON \ | |
| -DNATIVEJS_DEVELOPER_MODE=ON \ | |
| -DNATIVEJS_L2_BUILD=ON \ | |
| -DCMAKE_CXX_FLAGS="-I../externals/extlibs/include/rtcore" \ | |
| -DCMAKE_BUILD_TYPE=Debug | |
| cmake --build . | |
| # CRITICAL: Remove any .gcda files created during build | |
| # These zero-count files can interfere with test coverage | |
| echo "Cleaning any .gcda files created during build..." | |
| find . -name "*.gcda" -type f -delete 2>/dev/null || true | |
| gcda_after_build=$(find . -name "*.gcda" -type f | wc -l) | |
| echo "Remaining .gcda files after build cleanup: $gcda_after_build" | |
| - name: Setup modules directory | |
| run: | | |
| cd build | |
| mkdir -p modules | |
| cp -R ../utils jsc_modules | |
| cp -R ../src/jsc/modules/* modules/. | |
| cp -R ../utils/* modules/. | |
| - name: Set library paths | |
| run: | | |
| echo "LD_LIBRARY_PATH=$(pwd)/build:$(pwd)/externals/extlibs/lib:/usr/lib/javascriptcore:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| - name: Checkout L2 test repository | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: rdk-e/rdkNativeScript_tests | |
| token: ${{ secrets.GH_PAT }} | |
| path: rdkNativeScript_tests | |
| ref: topic/RDKEMW-9172 | |
| - name: Run L2 tests with coverage | |
| run: | | |
| # Pre-test cleanup: Ensure absolutely no .gcda files exist | |
| echo "=== Pre-test .gcda cleanup ===" | |
| find build -name "*.gcda" -type f -delete 2>/dev/null || true | |
| gcda_before_test=$(find build -name "*.gcda" -type f | wc -l) | |
| echo "✓ .gcda files before tests: $gcda_before_test (should be 0)" | |
| cd rdkNativeScript_tests/L2/test_framework | |
| export JSRUNTIME_BINARY=$(pwd)/../../../build/JSRuntimeJSC | |
| export GST_DEBUG=2 | |
| export GST_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gstreamer-1.0 | |
| export GST_DEBUG_NO_COLOR=1 | |
| export PULSE_SERVER=/dev/null | |
| chmod +x ./coverage.sh ./run_tests.sh | |
| ./coverage.sh | |
| - name: Verify test execution | |
| run: | | |
| echo "=== Test Results Summary ===" | |
| ls -lh rdkNativeScript_tests/L2/test_results/ | |
| echo "" | |
| echo "=== Tests that ran ===" | |
| for log in rdkNativeScript_tests/L2/test_results/*.log; do | |
| echo "$(basename $log): $(wc -l < $log) lines" | |
| done | |
| echo "" | |
| echo "=== Coverage data files (.gcda) ===" | |
| gcda_count=$(find build -name "*.gcda" -type f | wc -l) | |
| echo "Total .gcda files: $gcda_count" | |
| find build -name "*.gcda" -type f -exec ls -lh {} \; | head -20 | |
| echo "" | |
| echo "=== .gcda file timestamps (verify they're fresh) ===" | |
| find build -name "*.gcda" -type f -printf '%T+ %p\n' | head -10 | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: l2-coverage-report | |
| path: rdkNativeScript_tests/L2/coverage_report/ | |
| if-no-files-found: error | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: l2-test-results | |
| path: rdkNativeScript_tests/L2/test_results/ | |
| if-no-files-found: warn | |
| - name: Check coverage summary | |
| run: | | |
| if [ -f "rdkNativeScript_tests/L2/coverage_report/coverage_summary.txt" ]; then | |
| echo "=== Coverage Summary ===" | |
| cat rdkNativeScript_tests/L2/coverage_report/coverage_summary.txt | |
| fi | |