libavc/tests
Harish Mahendrakar 5ff80617fa Enable unit tests in postsubmit
After some time of running these in postsubmit, these will be changed
to presubmit.

- Added AvcEncTest to device-tests test suite
- Also run bpfmt on test/Android.bp

Bug: 304383609
Test: atest AvcEncTest
Change-Id: Ic18b25d8ed27313b6e3a984259af1215ae240c9e
2024-01-30 15:45:17 -08:00
..
Android.bp Enable unit tests in postsubmit 2024-01-30 15:45:17 -08:00
AndroidTest.xml AvcEncTest: Use MediaPreparer to download test files 2023-10-17 10:28:03 -07:00
AvcEncTest.cmake Add dependency on googletest for AvcEncTest 2023-10-17 11:02:51 -07:00
AvcEncTest.cpp Encoder test updates 2023-09-28 10:22:54 +05:30
DynamicConfig.xml Use media file zip from dl.google.com 2024-01-29 13:58:44 -08:00
README.md Use media file zip from dl.google.com 2024-01-29 13:58:44 -08:00
TestArgs.h Encoder test updates 2023-09-28 10:22:54 +05:30

AvcEncTest

The AvcEncoder Test Suite validates the Avc encoder.

Linux x86/x64

Requirements

  • cmake (3.9.1 or above)
  • make
  • clang (12.0 or above)

Steps to build

Clone libavc repository

$ git clone https://android.googlesource.com/platform/external/libavc

Create a directory inside libavc and change directory

 $ cd libavc
 $ mkdir build
 $ cd build

Build with -DENABLE_TESTS=1.

 $ cmake .. -DENABLE_TESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
   -DCMAKE_BUILD_TYPE=Debug
 $ make

Optionally, enable sanitizers by passing -DSANITIZE

 $ cmake .. -DENABLE_TESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
   -DCMAKE_BUILD_TYPE=Debug -DSANITIZE=fuzzer-no-link,address,\
   signed-integer-overflow,unsigned-integer-overflow
 $ make

The media files for the tests are present at. Download and extract these the current folder.

usage: AvcEncTest -P <path_to_the local folder>

$./AvcEncTest -P ./

Android

Run the following steps to build the test suite:

m AvcEncTest

To test 64-bit binary push binaries from nativetest64.

adb push ${OUT}/data/nativetest64/AvcEncTest/AvcEncTest /data/local/tmp/

To test 32-bit binary push binaries from nativetest.

adb push ${OUT}/data/nativetest/AvcEncTest/AvcEncTest /data/local/tmp/

The resource file for the tests is taken from here

Download, unzip and push these files into device for testing.

adb push AvcTestRes-1.0 /sdcard/test/

usage: AvcEncTest -P <path_to_folder>

adb shell /data/local/tmp/AvcEncTest -P /sdcard/test/AvcTestRes-1.0/

Alternatively, the test can also be run using atest command.

atest AvcEncTest