Skip to content

Commit 3a1f30e

Browse files
committed
[GHA] Add func tests for Android
1 parent 2990b0c commit 3a1f30e

File tree

1 file changed

+102
-7
lines changed

1 file changed

+102
-7
lines changed

.github/workflows/android.yml

Lines changed: 102 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ jobs:
212212
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CMAKE_CXX_COMPILER_LAUNCHER }} \
213213
-DCMAKE_C_COMPILER_LAUNCHER=${{ env.CMAKE_C_COMPILER_LAUNCHER }} \
214214
-DENABLE_LTO=ON \
215+
-DENABLE_TEMPLATE=ON \
215216
-DENABLE_PYTHON=OFF \
216217
-S ${OPENVINO_REPO} \
217218
-B ${BUILD_DIR}
@@ -243,8 +244,8 @@ jobs:
243244
cmake --install ${BUILD_DIR} --config ${{ env.BUILD_TYPE }} --prefix ${INSTALL_TEST_DIR} --component tests
244245
245246
# Install runtime into install dir; fallback to full install if component is unavailable
246-
cmake --install ${BUILD_DIR} --config ${{ env.BUILD_TYPE }} --prefix ${INSTALL_DIR} --component core \
247-
|| cmake --install ${BUILD_DIR} --config ${{ env.BUILD_TYPE }} --prefix ${INSTALL_DIR}
247+
cmake --install ${BUILD_DIR} --config ${{ env.BUILD_TYPE }} --prefix ${INSTALL_DIR} --component core
248+
cmake --install ${BUILD_DIR} --config ${{ env.BUILD_TYPE }} --prefix ${INSTALL_DIR} --component cpu
248249
249250
# If tests were installed under tests/, move CPU test binaries to expected path
250251
if [ -d "${INSTALL_TEST_DIR}/tests" ]; then
@@ -354,19 +355,113 @@ jobs:
354355
echo "Pulling unit test results..."
355356
adb pull /data/local/tmp/ov_test/unit_test_results.xml ./unit_test_results.xml || { echo "Warning: Could not pull unit test results"; adb shell "ls -la /data/local/tmp/ov_test/"; adb shell "cat /data/local/tmp/ov_test/unit_test_results.xml" || echo "No unit test results file"; }
356357
357-
- name: Upload test results
358+
- name: Upload unit test results
358359
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
359360
if: always()
360361
with:
361-
name: cpu_tests_results_android_x64
362+
name: cpu_unit_tests_results_android_x64
363+
path: ./unit_test_results.xml
364+
if-no-files-found: 'ignore'
365+
366+
CXX_Func_Tests:
367+
needs: [Smart_CI, Docker, Build]
368+
timeout-minutes: 120
369+
runs-on: aks-linux-4-cores-16gb
370+
container:
371+
image: ${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_android }}
372+
volumes:
373+
- /mount:/mount
374+
options: --device /dev/kvm
375+
env:
376+
ANDROID_API_LEVEL: 30
377+
ANDROID_TARGET: google_apis
378+
ANDROID_ARCH: x86_64
379+
INSTALL_DIR: android_package
380+
INSTALL_TEST_DIR: android_tests
381+
GTEST_FILTER: '*EltwiseLayer*'
382+
steps:
383+
- name: Checkout
384+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
385+
timeout-minutes: 15
386+
387+
- name: Download CPU test binaries
388+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
389+
with:
390+
name: ov_cpu_tests_android_x64
391+
path: ${{ env.INSTALL_TEST_DIR }}
392+
393+
- name: Download OpenVINO runtime package (Android)
394+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
395+
with:
396+
name: ov_android_package_x64
397+
path: ${{ env.INSTALL_DIR }}
398+
399+
- name: Setup KVM permissions
400+
run: |
401+
/usr/local/bin/setup-kvm.sh || true
402+
ls -la /dev/kvm || echo "KVM device not available"
403+
404+
- name: Set up Java 17
405+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
406+
with:
407+
java-version: '17'
408+
distribution: 'temurin'
409+
410+
- name: Setup Android SDK
411+
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
412+
413+
- name: AVD cache
414+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
415+
id: avd-cache
416+
if: github.ref_name == 'master'
417+
with:
362418
path: |
363-
./unit_test_results.xml
364-
./func_test_results.xml
419+
~/.android/avd/*
420+
~/.android/adb*
421+
key: avd-${{ env.ANDROID_API_LEVEL }}-${{ env.ANDROID_TARGET }}-${{ env.ANDROID_ARCH }}
422+
423+
- name: Run CPU func tests on emulator
424+
id: func-tests
425+
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
426+
with:
427+
api-level: ${{ env.ANDROID_API_LEVEL }}
428+
target: ${{ env.ANDROID_TARGET }}
429+
arch: ${{ env.ANDROID_ARCH }}
430+
force-avd-creation: false
431+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 -partition-size 8192 -qemu -cpu host
432+
disable-animations: true
433+
emulator-boot-timeout: 900
434+
script: |
435+
set -e
436+
adb wait-for-device
437+
438+
[ -f "${INSTALL_TEST_DIR}/bin/intel64/Release/ov_cpu_func_tests" ] || { echo "Error: ov_cpu_func_tests binary not found"; exit 1; }
439+
440+
chmod +x ${INSTALL_TEST_DIR}/bin/intel64/Release/ov_cpu_func_tests
441+
442+
adb shell "rm -rf /data/local/tmp/ov_test_func && mkdir -p /data/local/tmp/ov_test_func/intel64/Release"
443+
echo "Pushing functional test binary and libraries to device..."
444+
adb push ${INSTALL_TEST_DIR}/bin/intel64/Release/ov_cpu_func_tests /data/local/tmp/ov_test_func/intel64/Release/ov_cpu_func_tests
445+
# Push OpenVINO libraries from runtime package
446+
for lib in ${INSTALL_DIR}/runtime/lib/intel64/*.so*; do [ -f "$lib" ] && adb push "$lib" /data/local/tmp/ov_test_func/; done
447+
for lib in ${INSTALL_DIR}/lib/*.so*; do [ -f "$lib" ] && adb push "$lib" /data/local/tmp/ov_test_func/; done
448+
adb shell "chmod 755 /data/local/tmp/ov_test_func/intel64/Release/ov_cpu_func_tests"
449+
echo "Running CPU functional tests..."
450+
adb shell "cd /data/local/tmp/ov_test_func && export LD_LIBRARY_PATH=/data/local/tmp/ov_test_func:$LD_LIBRARY_PATH && timeout 3600 ./intel64/Release/ov_cpu_func_tests --gtest_filter=${{ env.GTEST_FILTER }} --gtest_output=xml:/data/local/tmp/ov_test_func/func_test_results.xml" || { echo "Functional test execution failed"; adb shell "ls -la /data/local/tmp/ov_test_func/"; exit 1; }
451+
echo "Pulling functional test results..."
452+
adb pull /data/local/tmp/ov_test_func/func_test_results.xml ./func_test_results.xml || { echo "Warning: Could not pull functional test results"; adb shell "ls -la /data/local/tmp/ov_test_func/"; adb shell "cat /data/local/tmp/ov_test_func/func_test_results.xml" || echo "No functional test results file"; }
453+
454+
- name: Upload functional test results
455+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
456+
if: always()
457+
with:
458+
name: cpu_func_tests_results_android_x64
459+
path: ./func_test_results.xml
365460
if-no-files-found: 'ignore'
366461

367462
Overall_Status:
368463
name: ci/gha_overall_status_android
369-
needs: [Smart_CI, Build, CXX_Unit_Tests]
464+
needs: [Smart_CI, Build, CXX_Unit_Tests, CXX_Func_Tests]
370465
if: ${{ always() }}
371466
runs-on: ubuntu-latest
372467
steps:

0 commit comments

Comments
 (0)