Skip to content

Commit

Permalink
Encoder test updates
Browse files Browse the repository at this point in the history
- Rename AvcEncoderTest as AvcEncTest
- Enable AvcEncTest in cmake builds
- Rename AvcEncoderTestEnvironment.h as TestArgs.h

Change-Id: Iceba9c33e060bcb1138f03833da67c0ff6e84b2b
  • Loading branch information
harishdm committed Sep 28, 2023
1 parent 44e03c7 commit 9e37abf
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{github.workspace}}/out -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_MVC=1 -DENABLE_SVC=1
run: cmake -B ${{github.workspace}}/out -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_MVC=1 -DENABLE_SVC=1 -DENABLE_TESTS=1

- name: Build
run: cmake --build ${{github.workspace}}/out --config ${{env.BUILD_TYPE}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
third_party
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(AVC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(AVC_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
option(ENABLE_MVC "Enables svcenc and svcdec builds" OFF)
option(ENABLE_SVC "Enables svcenc and svcdec builds" OFF)
option(ENABLE_TESTS "Enables gtest based unit tests" OFF)

if("${AVC_ROOT}" STREQUAL "${AVC_CONFIG_DIR}")
message(
Expand Down Expand Up @@ -67,3 +68,7 @@ if (${ENABLE_SVC})
include("${AVC_ROOT}/fuzzer/svc_enc_fuzzer.cmake")
include("${AVC_ROOT}/fuzzer/svc_dec_fuzzer.cmake")
endif()

if (${ENABLE_TESTS})
include("${AVC_ROOT}/tests/AvcEncTest.cmake")
endif()
4 changes: 2 additions & 2 deletions tests/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ package {
}

cc_test {
name: "AvcEncoderTest",
name: "AvcEncTest",
gtest: true,

srcs : [ "AvcEncoderTest.cpp" ],
srcs : [ "AvcEncTest.cpp" ],

shared_libs: [
"libutils",
Expand Down
10 changes: 5 additions & 5 deletions tests/AndroidTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
limitations under the License.
-->
<configuration description="Test module config for AVC encoder unit tests">
<option name="test-suite-tag" value="AvcEncoderTest" />
<option name="test-suite-tag" value="AvcEncTest" />
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="AvcEncoderTest->/data/local/tmp/AvcEncoderTest/" />
<option name="push" value="AvcEncTest->/data/local/tmp/AvcEncTest/" />
<option name="push-file"
key="https://storage.googleapis.com/android_media/external/libavc/tests/AvcEncoder.zip?unzip=true"
value="/data/local/tmp/AvcEncoderTestRes/" />
value="/data/local/tmp/AvcEncTestRes/" />
</target_preparer>

<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" />
<option name="module-name" value="AvcEncoderTest" />
<option name="native-test-flag" value="-P /data/local/tmp/AvcEncoderTestRes/" />
<option name="module-name" value="AvcEncTest" />
<option name="native-test-flag" value="-P /data/local/tmp/AvcEncTestRes/" />
</test>
</configuration>
21 changes: 21 additions & 0 deletions tests/AvcEncTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://android.googlesource.com/platform/external/googletest
GIT_TAG main
PREFIX ${AVC_ROOT}/third_party/build/googletest
SOURCE_DIR ${AVC_ROOT}/third_party/googletest
TMP_DIR ${AVC_ROOT}/third_party/build/googletest/tmp
INSTALL_COMMAND ""
)

list(
APPEND
AVCENCTEST_SRCS
"${AVC_ROOT}/tests/AvcEncTest.cpp")

libavc_add_executable(AvcEncTest libavcenc
SOURCES ${AVCENCTEST_SRCS}
INCLUDES "${AVC_ROOT}/third_party/googletest/googletest/include")
target_link_libraries(AvcEncTest
${AVC_ROOT}/third_party/build/googletest/src/googletest-build/lib/libgtest.a
${AVC_ROOT}/third_party/build/googletest/src/googletest-build/lib/libgtest_main.a)
Loading

0 comments on commit 9e37abf

Please sign in to comment.