1*495ae853SAndroid Build Coastguard Worker# AvcEncTest 2*495ae853SAndroid Build Coastguard WorkerThe AvcEncoder Test Suite validates the Avc encoder. 3*495ae853SAndroid Build Coastguard Worker 4*495ae853SAndroid Build Coastguard Worker## Linux x86/x64 5*495ae853SAndroid Build Coastguard Worker 6*495ae853SAndroid Build Coastguard Worker### Requirements 7*495ae853SAndroid Build Coastguard Worker- cmake (3.9.1 or above) 8*495ae853SAndroid Build Coastguard Worker- make 9*495ae853SAndroid Build Coastguard Worker- clang (12.0 or above) 10*495ae853SAndroid Build Coastguard Worker 11*495ae853SAndroid Build Coastguard Worker### Steps to build 12*495ae853SAndroid Build Coastguard WorkerClone libavc repository 13*495ae853SAndroid Build Coastguard Worker``` 14*495ae853SAndroid Build Coastguard Worker$ git clone https://android.googlesource.com/platform/external/libavc 15*495ae853SAndroid Build Coastguard Worker``` 16*495ae853SAndroid Build Coastguard WorkerCreate a directory inside libavc and change directory 17*495ae853SAndroid Build Coastguard Worker``` 18*495ae853SAndroid Build Coastguard Worker $ cd libavc 19*495ae853SAndroid Build Coastguard Worker $ mkdir build 20*495ae853SAndroid Build Coastguard Worker $ cd build 21*495ae853SAndroid Build Coastguard Worker``` 22*495ae853SAndroid Build Coastguard Worker 23*495ae853SAndroid Build Coastguard WorkerBuild with -DENABLE_TESTS=1. 24*495ae853SAndroid Build Coastguard Worker``` 25*495ae853SAndroid Build Coastguard Worker $ cmake .. -DENABLE_TESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ 26*495ae853SAndroid Build Coastguard Worker -DCMAKE_BUILD_TYPE=Debug 27*495ae853SAndroid Build Coastguard Worker $ make 28*495ae853SAndroid Build Coastguard Worker``` 29*495ae853SAndroid Build Coastguard Worker 30*495ae853SAndroid Build Coastguard WorkerOptionally, enable sanitizers by passing -DSANITIZE 31*495ae853SAndroid Build Coastguard Worker``` 32*495ae853SAndroid Build Coastguard Worker $ cmake .. -DENABLE_TESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ 33*495ae853SAndroid Build Coastguard Worker -DCMAKE_BUILD_TYPE=Debug -DSANITIZE=fuzzer-no-link,address,\ 34*495ae853SAndroid Build Coastguard Worker signed-integer-overflow,unsigned-integer-overflow 35*495ae853SAndroid Build Coastguard Worker $ make 36*495ae853SAndroid Build Coastguard Worker``` 37*495ae853SAndroid Build Coastguard Worker 38*495ae853SAndroid Build Coastguard WorkerThe media files for the tests are present [at](https://dl.google.com/android-unittest/media/external/libavc/tests/AvcTestRes-1.0.zip). 39*495ae853SAndroid Build Coastguard WorkerDownload and extract these the current folder. 40*495ae853SAndroid Build Coastguard Worker 41*495ae853SAndroid Build Coastguard Workerusage: AvcEncTest -P \<path_to_the local folder\> 42*495ae853SAndroid Build Coastguard Worker 43*495ae853SAndroid Build Coastguard Worker``` 44*495ae853SAndroid Build Coastguard Worker$./AvcEncTest -P ./ 45*495ae853SAndroid Build Coastguard Worker``` 46*495ae853SAndroid Build Coastguard Worker 47*495ae853SAndroid Build Coastguard Worker## Android 48*495ae853SAndroid Build Coastguard Worker 49*495ae853SAndroid Build Coastguard WorkerRun the following steps to build the test suite: 50*495ae853SAndroid Build Coastguard Worker``` 51*495ae853SAndroid Build Coastguard Workerm AvcEncTest 52*495ae853SAndroid Build Coastguard Worker``` 53*495ae853SAndroid Build Coastguard Worker 54*495ae853SAndroid Build Coastguard WorkerTo test 64-bit binary push binaries from nativetest64. 55*495ae853SAndroid Build Coastguard Worker``` 56*495ae853SAndroid Build Coastguard Workeradb push ${OUT}/data/nativetest64/AvcEncTest/AvcEncTest /data/local/tmp/ 57*495ae853SAndroid Build Coastguard Worker``` 58*495ae853SAndroid Build Coastguard Worker 59*495ae853SAndroid Build Coastguard WorkerTo test 32-bit binary push binaries from nativetest. 60*495ae853SAndroid Build Coastguard Worker``` 61*495ae853SAndroid Build Coastguard Workeradb push ${OUT}/data/nativetest/AvcEncTest/AvcEncTest /data/local/tmp/ 62*495ae853SAndroid Build Coastguard Worker``` 63*495ae853SAndroid Build Coastguard Worker 64*495ae853SAndroid Build Coastguard WorkerThe resource file for the tests is taken from [here](https://dl.google.com/android-unittest/media/external/libavc/tests/AvcTestRes-1.0.zip) 65*495ae853SAndroid Build Coastguard Worker 66*495ae853SAndroid Build Coastguard WorkerDownload, unzip and push these files into device for testing. 67*495ae853SAndroid Build Coastguard Worker 68*495ae853SAndroid Build Coastguard Worker``` 69*495ae853SAndroid Build Coastguard Workeradb push AvcTestRes-1.0 /sdcard/test/ 70*495ae853SAndroid Build Coastguard Worker``` 71*495ae853SAndroid Build Coastguard Worker 72*495ae853SAndroid Build Coastguard Workerusage: AvcEncTest -P \<path_to_folder\> 73*495ae853SAndroid Build Coastguard Worker``` 74*495ae853SAndroid Build Coastguard Workeradb shell /data/local/tmp/AvcEncTest -P /sdcard/test/AvcTestRes-1.0/ 75*495ae853SAndroid Build Coastguard Worker``` 76*495ae853SAndroid Build Coastguard WorkerAlternatively, the test can also be run using atest command. 77*495ae853SAndroid Build Coastguard Worker 78*495ae853SAndroid Build Coastguard Worker``` 79*495ae853SAndroid Build Coastguard Workeratest AvcEncTest 80*495ae853SAndroid Build Coastguard Worker``` 81