Skip to content

Commit

Permalink
Run benchmark tests on android device from host
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushsoni111 committed Dec 6, 2023
1 parent 808963b commit a8abfdc
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,17 @@ NOTE: To not build unit tests, skip passing -DUHDR_BUILD_TESTS=1

### Building Benchmark

cmake {cmake_options} -DUHDR_BUILD_BENCHMARK=1
To build benchmarks, pass -DUHDR_BUILD_BENCHMARK=1 to cmake configure command and build.

This will additionally generate,

**ultrahdr_bm**<br> Benchmark tests

To run benchmark tests on device from host, use atest:

```
atest ultrahdr_benchmark
```

### Building Fuzzers

Expand Down
37 changes: 37 additions & 0 deletions benchmark/AndroidTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration description="Test module config for ultrahdr benchmark tests">
<option name="test-suite-tag" value="ultrahdr_benchmark" />
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="ultrahdr_benchmark->/data/local/tmp/ultrahdr_benchmark/" />
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
<option name="target" value="host" />
<option name="config-filename" value="ultrahdr_benchmark" />
<option name="version" value="1.0"/>
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
<option name="push-all" value="true" />
<option name="media-folder-name" value="UltrahdrBenchmarkTestRes-1.0"/>
<option name="dynamic-config-module" value="ultrahdr_benchmark" />
</target_preparer>
<test class="com.android.tradefed.testtype.GoogleBenchmarkTest" >
<option name="native-benchmark-device-path" value="/data/local/tmp" />
<option name="benchmark-module-name" value="ultrahdr_benchmark" />
<option name="file-exclusion-filter-regex" value=".*/bench_[^/]*$" />
</test>
</configuration>
20 changes: 20 additions & 0 deletions benchmark/DynamicConfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Copyright (C) 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<dynamicConfig>
<entry key="media_files_url">
<value>https://storage.googleapis.com/android_media/external/libultrahdr/benchmark/UltrahdrBenchmarkTestRes-1.0.zip</value>
</entry>
</dynamicConfig>
4 changes: 4 additions & 0 deletions benchmark/benchmark_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@

using namespace ultrahdr;

#ifdef __ANDROID__
std::string kTestImagesPath = "/sdcard/test/UltrahdrBenchmarkTestRes-1.0/";
#else
std::string kTestImagesPath = "./data/UltrahdrBenchmarkTestRes-1.0/";
#endif

std::vector<std::string> kDecodeAPITestImages{
// 12mp test vectors
Expand Down

0 comments on commit a8abfdc

Please sign in to comment.